Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
W
website
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
84
Issues
84
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
1
Merge Requests
1
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Video AG Infrastruktur
website
Commits
7182a338
Commit
7182a338
authored
Dec 04, 2017
by
Julian Rother
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved handlers to the right places
parent
7047b2bf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
29 deletions
+29
-29
chapters.py
chapters.py
+17
-0
encoding.py
encoding.py
+0
-29
sorter.py
sorter.py
+12
-0
No files found.
chapters.py
View file @
7182a338
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'
]
...
...
encoding.py
View file @
7182a338
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
]
...
...
sorter.py
View file @
7182a338
...
...
@@ -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)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment