Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Video AG Infrastruktur
website
Commits
1d152578
Commit
1d152578
authored
Nov 30, 2017
by
Julian Rother
Browse files
Implemented xmp-chapter extraction
parent
9d860562
Changes
3
Hide whitespace changes
Inline
Side-by-side
encoding.py
0 → 100644
View file @
1d152578
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'
])
server.py
View file @
1d152578
...
...
@@ -470,6 +470,7 @@ if 'ICAL_URL' in config:
import
meetings
import
l2pauth
from
jobs
import
job_handler
,
schedule_job
import
encoding
import
timetable
import
chapters
import
icalexport
...
...
sorter.py
View file @
1d152578
...
...
@@ -34,6 +34,7 @@ def insert_video(lectureid,dbfilepath,filepath,fileformatid):
lectureid
,
dbfilepath
,
fileformatid
,
datetime
.
now
(),
datetime
.
now
(),
datetime
.
now
(),
-
1
,
os
.
stat
(
filepath
).
st_size
)
query
(
'INSERT INTO sortlog (lecture_id,video_id,path,`when`) VALUES (?,?,?,?)'
,
lectureid
,
video_id
,
dbfilepath
,
datetime
.
now
())
schedule_thumbnail
(
lectureid
)
schedule_job
(
'probe'
,
{
'path'
:
dbfilepath
,
'lecture_id'
:
lectureid
,
'import-chapters'
:
True
})
def
schedule_thumbnail
(
lectureid
,
filePath
=
None
):
videos
=
query
(
'''
...
...
Julian Rother
@julianr
mentioned in issue
#256 (closed)
·
Dec 19, 2017
mentioned in issue
#256 (closed)
mentioned in issue #256
Toggle commit list
Write
Preview
Supports
Markdown
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