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
Wiki
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
Jannik Hellenkamp
website
Commits
c695d754
Commit
c695d754
authored
7 years ago
by
Andreas Valder
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of git.fsmpi.rwth-aachen.de:videoaginfra/website
parents
602fc3de
f43130f7
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
chapters.py
+17
-0
17 additions, 0 deletions
chapters.py
encoding.py
+0
-29
0 additions, 29 deletions
encoding.py
sorter.py
+13
-1
13 additions, 1 deletion
sorter.py
with
30 additions
and
30 deletions
chapters.py
+
17
−
0
View file @
c695d754
import
json
from
server
import
*
@job_handler
(
'
probe
'
,
'
probe-raw
'
)
def
import_xmp_chapters
(
jobid
,
jobtype
,
data
,
state
,
status
):
if
'
lecture_id
'
not
in
data
and
data
.
get
(
'
import-chapters
'
,
False
):
return
times
=
set
()
# Only add new chapters, deleted chapters are taken into account here
for
chapter
in
query
(
'
SELECT * FROM chapters WHERE lecture_id = ?
'
,
data
[
'
lecture_id
'
]):
for
offset
in
range
(
5
):
times
.
add
(
chapter
[
'
time
'
]
-
offset
)
times
.
add
(
chapter
[
'
time
'
]
+
offset
)
for
chapter
in
status
.
get
(
'
xmp_chapters
'
,
[]):
if
int
(
chapter
[
'
time
'
])
in
times
:
continue
modify
(
'
INSERT INTO chapters (lecture_id, time, text, visible, time_created, time_updated) VALUES (?, ?, ?, 0, ?, ?)
'
,
data
[
'
lecture_id
'
],
int
(
chapter
[
'
time
'
]),
chapter
[
'
text
'
],
datetime
.
now
(),
datetime
.
now
())
@app.route
(
'
/internal/newchapter/<int:lectureid>
'
,
methods
=
[
'
POST
'
,
'
GET
'
])
def
suggest_chapter
(
lectureid
):
time
=
request
.
values
[
'
time
'
]
...
...
This diff is collapsed.
Click to expand it.
encoding.py
+
0
−
29
View file @
c695d754
from
server
import
*
@job_handler
(
'
probe
'
,
'
probe-raw
'
)
def
import_xmp_chapters
(
jobid
,
jobtype
,
data
,
state
,
status
):
if
'
lecture_id
'
not
in
data
and
data
.
get
(
'
import-chapters
'
,
False
):
return
times
=
set
()
# Only add new chapters, deleted chapters are taken into account here
for
chapter
in
query
(
'
SELECT * FROM chapters WHERE lecture_id = ?
'
,
data
[
'
lecture_id
'
]):
for
offset
in
range
(
5
):
times
.
add
(
chapter
[
'
time
'
]
-
offset
)
times
.
add
(
chapter
[
'
time
'
]
+
offset
)
for
chapter
in
status
.
get
(
'
xmp_chapters
'
,
[]):
if
int
(
chapter
[
'
time
'
])
in
times
:
continue
modify
(
'
INSERT INTO chapters (lecture_id, time, text, visible, time_created, time_updated) VALUES (?, ?, ?, 0, ?, ?)
'
,
data
[
'
lecture_id
'
],
int
(
chapter
[
'
time
'
]),
chapter
[
'
text
'
],
datetime
.
now
(),
datetime
.
now
())
@job_handler
(
'
probe
'
,
'
remux
'
,
'
transcode
'
)
def
update_video_metadata
(
jobid
,
jobtype
,
data
,
state
,
status
):
if
'
video_id
'
not
in
data
:
return
if
jobtype
not
in
[
'
remux
'
,
'
transcode
'
]:
video
=
query
(
'
SELECT * FROM videos WHERE id = ?
'
,
data
[
'
video_id
'
])[
0
]
if
video
[
'
hash
'
]
and
video
[
'
hash
'
]
!=
status
[
'
hash
'
]:
print
(
'
Hash mismatch for video
'
,
data
[
'
video_id
'
])
return
modify
(
'
UPDATE videos_data SET hash = ?, file_size = ? WHERE id = ?
'
,
status
[
'
hash
'
],
status
[
'
filesize
'
],
data
[
'
video_id
'
])
def
schedule_remux
(
lectureid
):
lecture
=
query
(
'
SELECT * FROM lectures WHERE id = ?
'
,
lectureid
)[
0
]
course
=
query
(
'
SELECT * FROM courses WHERE id = ?
'
,
lecture
[
'
course_id
'
])[
0
]
...
...
This diff is collapsed.
Click to expand it.
sorter.py
+
13
−
1
View file @
c695d754
...
...
@@ -25,6 +25,18 @@ def to_ascii(inputstring):
asciistring
=
asciistring
.
replace
(
charset
[
0
],
charset
[
1
])
return
asciistring
@job_handler
(
'
probe
'
,
'
remux
'
,
'
transcode
'
)
def
update_video_metadata
(
jobid
,
jobtype
,
data
,
state
,
status
):
if
'
video_id
'
not
in
data
:
return
if
jobtype
not
in
[
'
remux
'
,
'
transcode
'
]:
video
=
query
(
'
SELECT * FROM videos WHERE id = ?
'
,
data
[
'
video_id
'
])[
0
]
if
video
[
'
hash
'
]
and
video
[
'
hash
'
]
!=
status
[
'
hash
'
]:
print
(
'
Hash mismatch for video
'
,
data
[
'
video_id
'
])
return
modify
(
'
UPDATE videos_data SET hash = ?, file_size = ? WHERE id = ?
'
,
status
[
'
hash
'
],
status
[
'
filesize
'
],
data
[
'
video_id
'
])
def
insert_video
(
lectureid
,
dbfilepath
,
fileformatid
,
hash
=
""
,
filesize
=-
1
):
video_id
=
modify
(
'''
INSERT INTO videos_data
(lecture_id, visible, path, video_format, title, comment, internal, file_modified, time_created, time_updated, created_by, hash, file_size)
...
...
@@ -62,7 +74,7 @@ def sort_file(filename, course=None, lectures=None):
handle
=
'
-
'
.
join
(
splitfilename
[:
2
])
courses
=
query
(
'
SELECT * FROM courses WHERE handle = ?
'
,
handle
)
if
not
courses
:
return
[]
return
[]
,
0
course
=
courses
[
0
]
if
not
lectures
:
lectures
=
query
(
'
SELECT * from lectures where course_id = ?
'
,
course
[
'
id
'
])
...
...
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