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
134e2b15
Commit
134e2b15
authored
Oct 10, 2016
by
Andreas Valder
Browse files
moved inserting of video in own function
parent
c30c4541
Changes
1
Hide whitespace changes
Inline
Side-by-side
sorter.py
View file @
134e2b15
...
...
@@ -26,6 +26,15 @@ def to_ascii(inputstring):
asciistring
=
asciistring
.
replace
(
charset
[
0
],
charset
[
1
])
return
asciistring
def
insert_video
(
lectureid
,
dbfilepath
,
filepath
,
fileformatid
):
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)
VALUES
(?,0,?,?,"","","",?,?,?,?,"",?)'''
,
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
())
@
app
.
route
(
'/sort/now'
)
@
mod_required
@
sched_func
(
600
)
...
...
@@ -130,13 +139,7 @@ def sort_now():
if
not
'format'
in
data
:
data
[
'format'
]
=
0
# insert the video into videos_data and log
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)
VALUES
(?,0,?,?,"","","",?,?,?,?,"",?)'''
,
matches
[
0
][
'id'
],
dbfilepath
,
data
[
'format'
],
datetime
.
now
(),
datetime
.
now
(),
datetime
.
now
(),
-
1
,
os
.
stat
(
filepath
).
st_size
)
query
(
'INSERT INTO sortlog (lecture_id,video_id,path,`when`) VALUES (?,?,?,?)'
,
matches
[
0
][
'id'
],
video_id
,
dbfilepath
,
datetime
.
now
())
insert_video
(
matches
[
0
][
'id'
],
dbfilepath
,
filepath
,
fileformatid
)
else
:
# if we couldn't match the video on exactly one lecture, log an error
matches_id
=
[]
...
...
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