Skip to content

Commit aa94a5c

Browse files
Merge pull request #51 from Web-Multi-Media/dash_packaging
Add dash packager in backend and dashjs in frontend
2 parents a063bce + b0d071f commit aa94a5c

29 files changed

+1106
-247
lines changed

README.md

+13-6
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
Intro
44
-------------------
5-
This project is a video presentation server based on Django Rest Framework and React. It provides automatic video indexing and classification.
5+
This project is a video presentation server based on Django Rest Framework and React. It provides automatic video indexing and classification.
66

77
![](doc/preview.jpeg )
88

9-
10-
Support is currently limited to H264 encoded content.
11-
Subtitles are added automatically if an adequate match is found. You can also upload you own subtitle or resync existing ones.
9+
Subtitles are added automatically if an adequate match is found. You can also upload you own subtitle or resync existing ones. Any input video format is supported as we reencode it to enable adaptive streaming (MPEG Dash).
1210

1311

1412
How to use
@@ -26,7 +24,7 @@ Pull the images:
2624

2725
Migrate the database:
2826

29-
docker-compose -f docker-compose-prod.yml run --rm web python3 manage.py migrate
27+
docker-compose -f docker-compose-prod.yml run --rm web ./wait-for-it.sh db:5432 -- python3 manage.py migrate
3028

3129
Populate the database:
3230

@@ -40,12 +38,21 @@ Now the application should be accessible from your browser at `http://localhost:
4038

4139
A built-in torrent server is available at: `http://localhost:1337/transmission/web/`
4240

41+
Once your torrent download is finished, you can trigger an update with:
42+
43+
docker-compose -f docker-compose-prod.yml run --rm web python3 manage.py updatedb
44+
45+
Encoding time can be quite long (We generate SD and HD layers), so you shoud probabably run this command in a background process.
46+
47+
docker-compose -f docker-compose-prod.yml run -d --rm web python3 manage.py updatedb
48+
49+
4350

4451
#### CONFIGURATION
4552

4653
Change torrent admin password:
4754

48-
docker-compose -f docker-compose-prod.yml run --rm nginx htpasswd -c /usr/torrent/.htpasswd user1
55+
docker-compose -f docker-compose-prod.yml run --rm nginx htpasswd -c /usr/torrent/.htpasswd admin
4956

5057
The videos contained in the Videos/ folder are indexed everytime the populatedb command is launched.
5158

backend/Dockerfile

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11

22
FROM python:3.8
33

4-
RUN apt-get update -y && apt-get install -y ffmpeg
4+
RUN apt-get update -y && apt-get install -y ffmpeg transmission-daemon build-essential pkg-config git zlib1g-dev
55

66
COPY ./backend/openssl.cnf /etc/ssl/openssl.cnf
77

8+
RUN git clone --depth=1 https://github.com/gpac/gpac gpac_public && cd gpac_public && ./configure --static-mp4box && make && make install
9+
10+
RUN apt-get remove -y build-essential pkg-config git
11+
812
ENV PYTHONUNBUFFERED 1
9-
COPY ./backend/ /usr/src/app/
13+
#COPY ./backend/ /usr/src/app/
14+
#WORKDIR /usr/src/app
15+
ADD ./backend/requirements.txt /srv/requirements.txt
16+
RUN pip install -r /srv/requirements.txt
17+
1018
WORKDIR /usr/src/app
1119

12-
RUN pip3 install -r requirements.txt

backend/Dockerfile.prod

+5-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ RUN npm run build
1212

1313
FROM python:3.8
1414

15-
RUN apt-get update -y && apt-get install -y ffmpeg transmission-daemon
15+
RUN apt-get update -y && apt-get install -y ffmpeg transmission-daemon build-essential pkg-config git zlib1g-dev
16+
17+
RUN git clone --depth=1 https://github.com/gpac/gpac gpac_public && cd gpac_public && ./configure --static-mp4box && make && make install
18+
19+
RUN apt-get remove -y build-essential pkg-config git
1620

1721
RUN service transmission-daemon stop
1822
COPY ./backend/transmission.json /etc/transmission-daemon/settings.json

backend/StreamServerApp/admin.py

+79-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,89 @@
22
from StreamServerApp.models import Video, Movie, Series, Subtitle
33
from StreamServerApp.database_utils import delete_DB_Infos, populate_db_from_local_folder, update_db_from_local_folder
44
from django.conf import settings
5+
import os
6+
import shutil
57

68

79
class VideoAdmin(admin.ModelAdmin):
810
search_fields = ['name']
11+
model = Video
12+
13+
def delete_queryset(self, request, queryset):
14+
print(
15+
'========================delete_queryset========================')
16+
print(queryset)
17+
#queryset.delete()
18+
for videos in queryset:
19+
print(videos.video_folder)
20+
playlistdir = os.path.split(videos.video_folder)[0]
21+
if os.path.isdir(playlistdir):
22+
print("removing directory: {}".format(playlistdir))
23+
shutil.rmtree(playlistdir, ignore_errors=True)
24+
25+
queryset.delete()
26+
27+
28+
class VideoAdmin(admin.ModelAdmin):
29+
search_fields = ['name']
30+
model = Video
31+
32+
def delete_queryset(self, request, queryset):
33+
print(
34+
'========================delete_queryset========================')
35+
print(queryset)
36+
#queryset.delete()
37+
for videos in queryset:
38+
print(videos.video_folder)
39+
playlistdir = os.path.split(videos.video_folder)[0]
40+
if os.path.isdir(playlistdir):
41+
print("removing directory: {}".format(playlistdir))
42+
shutil.rmtree(playlistdir, ignore_errors=True)
43+
44+
queryset.delete()
45+
46+
47+
class SeriesAdmin(admin.ModelAdmin):
48+
search_fields = ['name']
49+
model = Series
50+
51+
def delete_queryset(self, request, queryset):
52+
print(
53+
'========================delete_queryset========================')
54+
print(queryset)
55+
#queryset.delete()
56+
for series in queryset:
57+
video_queryset = Video.objects.filter(series=series.id)
58+
for videos in video_queryset:
59+
playlistdir = os.path.split(videos.video_folder)[0]
60+
if os.path.isdir(playlistdir):
61+
print("removing directory: {}".format(playlistdir))
62+
shutil.rmtree(playlistdir, ignore_errors=True)
63+
64+
queryset.delete()
65+
66+
67+
class MovieAdmin(admin.ModelAdmin):
68+
search_fields = ['name']
69+
model = Movie
70+
71+
def delete_queryset(self, request, queryset):
72+
print(
73+
'========================delete_queryset========================')
74+
print(queryset)
75+
#queryset.delete()
76+
for movies in queryset:
77+
video_queryset = Video.objects.filter(movie=movies.id)
78+
for videos in video_queryset:
79+
playlistdir = os.path.split(videos.video_folder)[0]
80+
if os.path.isdir(playlistdir):
81+
print("removing directory: {}".format(playlistdir))
82+
shutil.rmtree(playlistdir, ignore_errors=True)
83+
84+
queryset.delete()
85+
986

1087
admin.site.register(Video, VideoAdmin)
11-
admin.site.register(Movie)
12-
admin.site.register(Series)
88+
admin.site.register(Movie, MovieAdmin)
89+
admin.site.register(Series, SeriesAdmin)
1390
admin.site.register(Subtitle)

0 commit comments

Comments
 (0)