Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Video AG Infrastruktur
website
Commits
6b00abd1
Commit
6b00abd1
authored
7 years ago
by
Julian Rother
Browse files
Options
Downloads
Patches
Plain Diff
Added interface to manually add remux and reencode jobs
parent
2ae7b0d7
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
encoding.py
+28
-2
28 additions, 2 deletions
encoding.py
sorter.py
+1
-0
1 addition, 0 deletions
sorter.py
templates/jobs_overview.html
+26
-3
26 additions, 3 deletions
templates/jobs_overview.html
with
55 additions
and
5 deletions
encoding.py
+
28
−
2
View file @
6b00abd1
...
...
@@ -10,7 +10,17 @@ def set_metadata(dest, course, lecture):
dest
[
'
metadata
'
]
=
metadata
dest
[
'
chapters
'
]
=
chapters
def
schedule_remux
(
lectureid
):
@app.route
(
'
/internal/jobs/add/remux
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
@mod_required
@csrf_protect
def
schedule_remux
(
lectureid
=
None
,
videoid
=
None
):
ret
=
None
if
not
lectureid
:
lectureid
=
request
.
values
.
get
(
'
lectureid
'
)
videoid
=
request
.
values
.
get
(
'
videoid
'
)
if
not
lectureid
:
lectureid
=
query
(
'
SELECT lecture_id FROM videos WHERE id = ?
'
,
videoid
)[
0
][
'
lecture_id
'
]
ret
=
redirect
(
request
.
values
.
get
(
'
ref
'
,
url_for
(
'
jobs_overview
'
)))
lecture
=
query
(
'
SELECT * FROM lectures WHERE id = ?
'
,
lectureid
)[
0
]
course
=
query
(
'
SELECT * FROM courses WHERE id = ?
'
,
lecture
[
'
course_id
'
])[
0
]
videos
=
query
(
'''
SELECT videos.*, sources.path AS srcpath, sources.hash AS srchash, formats.options AS fmtopts
...
...
@@ -21,6 +31,8 @@ def schedule_remux(lectureid):
for
video
in
videos
:
if
not
video
[
'
source
'
]:
continue
if
videoid
and
video
[
'
id
'
]
!=
videoid
:
continue
data
=
{
'
path
'
:
video
[
'
path
'
],
'
srcpath
'
:
video
[
'
srcpath
'
],
'
srchash
'
:
video
[
'
srchash
'
]}
fmt
=
json
.
loads
(
video
[
'
fmtopts
'
])
if
'
format
'
in
fmt
:
...
...
@@ -28,6 +40,7 @@ def schedule_remux(lectureid):
data
[
'
options
'
]
=
fmt
.
get
(
'
options
'
,
{})
set_metadata
(
data
,
course
,
lecture
)
schedule_job
(
'
remux
'
,
data
)
return
ret
def
schedule_transcode
(
source
,
fmt_id
=
None
,
video
=
None
):
if
video
:
...
...
@@ -49,7 +62,7 @@ def schedule_transcode(source, fmt_id=None, video=None):
basename
=
os
.
path
.
basename
(
source
[
'
path
'
]).
rsplit
(
'
.
'
,
1
)[
0
]
data
[
'
output
'
][
'
path
'
]
=
'
pub/
'
+
course
[
'
handle
'
]
+
'
/
'
+
basename
+
fmt
[
'
suffix
'
]
if
video
:
old_source
=
query
(
'
SELECT * FROM sources WHERE id = ?
'
,
video
[
'
source
'
])
old_source
=
query
(
'
SELECT * FROM sources WHERE id = ?
'
,
video
[
'
source
'
])
[
0
]
data
[
'
output
'
][
'
path
'
]
=
video
[
'
path
'
]
data
[
'
video_id
'
]
=
video
[
'
id
'
]
data
[
'
srcpath
'
]
=
old_source
[
'
path
'
]
...
...
@@ -60,6 +73,19 @@ def schedule_transcode(source, fmt_id=None, video=None):
data
[
'
source_id
'
]
=
source
[
'
id
'
]
schedule_job
(
'
transcode
'
,
data
,
queue
=
"
background
"
)
@app.route
(
'
/internal/jobs/add/reencode
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
@mod_required
@csrf_protect
@handle_errors
(
'
jobs_overview
'
,
'
Video nicht gefunden!
'
,
404
,
IndexError
)
def
schedule_reencode
():
video
=
query
(
'
SELECT * FROM videos WHERE id = ?
'
,
request
.
values
[
'
videoid
'
])[
0
]
if
not
video
[
'
source
'
]:
flash
(
'
Manuell erstellte Videos können nicht neukodiert werden!
'
)
else
:
source
=
query
(
'''
SELECT sources.* FROM sources WHERE sources.id = ? ORDER BY time_created
'''
,
video
[
'
source
'
])[
-
1
]
schedule_transcode
(
source
,
video
=
video
)
return
redirect
(
request
.
values
.
get
(
'
ref
'
,
url_for
(
'
jobs_overview
'
)))
@job_handler
(
'
probe-raw
'
)
def
update_lecture_videos
(
jobid
,
jobtype
,
data
,
state
,
status
):
if
'
lecture_id
'
not
in
data
:
...
...
This diff is collapsed.
Click to expand it.
sorter.py
+
1
−
0
View file @
6b00abd1
...
...
@@ -51,6 +51,7 @@ def insert_video(lectureid, dbfilepath, fileformatid, hash="", filesize=-1):
@app.route
(
'
/internal/jobs/add/thumbnail
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
@mod_required
@csrf_protect
@handle_errors
(
'
jobs_overview
'
,
'
Zu dieser Veranstaltung existieren keine Videos!
'
,
404
,
IndexError
)
def
schedule_thumbnail
(
lectureid
=
None
):
ret
=
None
...
...
This diff is collapsed.
Click to expand it.
templates/jobs_overview.html
+
26
−
3
View file @
6b00abd1
...
...
@@ -12,15 +12,38 @@
</div>
<div
class=
"modal-body"
>
<ul
class=
"nav nav-tabs"
role=
"tablist"
>
<li
role=
"presentation"
class=
"active"
><a
href=
"#add_thtumbnail"
aria-controls=
"thumbnail"
role=
"tab"
data-toggle=
"tab"
>
Thumbnail
</a></li>
<li
role=
"presentation"
class=
"active"
><a
href=
"#add_thumbnail"
aria-controls=
"thumbnail"
role=
"tab"
data-toggle=
"tab"
>
Thumbnail
</a></li>
<li
role=
"presentation"
><a
href=
"#add_remux"
aria-controls=
"remux"
role=
"tab"
data-toggle=
"tab"
>
Remux
</a></li>
<li
role=
"presentation"
><a
href=
"#add_reencode"
aria-controls=
"remux"
role=
"tab"
data-toggle=
"tab"
>
Reencode
</a></li>
</ul>
<div
class=
"tab-content"
style=
"margin-top: 10px;"
>
<div
role=
"tabpanel"
class=
"tab-pane active"
id=
"add_thumbnail"
>
<form
class=
"form-inline"
action=
"{{url_for('schedule_thumbnail', ref=request.url)}}"
method=
"post"
>
<div
class=
"form-group"
>
<input
type=
"text"
class=
"form-control"
placeholder=
"Lecture ID"
name=
"lectureid"
>
<button
type=
"submit"
class=
"btn btn-primary"
>
Hinzufügen
</button>
<button
type=
"submit"
class=
"btn btn-primary"
>
Thumbnail erzeugen
</button>
</div>
</form>
</div>
<div
role=
"tabpanel"
class=
"tab-pane"
id=
"add_remux"
>
<form
class=
"form-inline"
action=
"{{url_for('schedule_remux', ref=request.url)}}"
method=
"post"
>
<div
class=
"form-group"
>
<input
type=
"text"
class=
"form-control"
placeholder=
"Lecture ID"
name=
"lectureid"
>
<button
type=
"submit"
class=
"btn btn-primary"
>
Videos remuxen
</button>
</div>
</form><br>
<form
class=
"form-inline"
action=
"{{url_for('schedule_remux', ref=request.url)}}"
method=
"post"
>
<div
class=
"form-group"
>
<input
type=
"text"
class=
"form-control"
placeholder=
"Video ID"
name=
"videoid"
>
<button
type=
"submit"
class=
"btn btn-primary"
>
Einzelnes Video remuxen
</button>
</div>
</form>
</div>
<div
role=
"tabpanel"
class=
"tab-pane"
id=
"add_reencode"
>
<form
class=
"form-inline"
action=
"{{url_for('schedule_reencode', ref=request.url)}}"
method=
"post"
>
<div
class=
"form-group"
>
<input
type=
"text"
class=
"form-control"
placeholder=
"Video ID"
name=
"videoid"
>
<button
type=
"submit"
class=
"btn btn-primary"
>
Video neukodieren
</button>
</div>
</form>
</div>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment