Commit 32dc398a authored by Julian Rother's avatar Julian Rother
Browse files

Added notifications for new videos

parent 07046471
......@@ -48,6 +48,10 @@ def insert_video(lectureid, dbfilepath, fileformatid, hash="", filesize=-1):
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, 'video_id': video_id, 'import-chapters': True})
video = query('SELECT videos.*, "format" AS sep, formats.* FROM videos JOIN formats ON formats.id = videos.video_format WHERE videos.id = ?', video_id)[0]
lecture = query('SELECT * FROM lectures WHERE id = ?', lectureid)[0]
course = query('SELECT * FROM courses WHERE id = ?', lecture['course_id'])[0]
notify_mods('new_video', course['id'], course=course, lecture=lecture, video=video)
@app.route('/internal/jobs/add/thumbnail', methods=['GET', 'POST'])
@mod_required
......@@ -82,6 +86,10 @@ def insert_transcoded_video(jobid, jobtype, data, state, status):
datetime.now(), datetime.now(), datetime.now(), -1, status['hash'],
status['filesize'], data['source_id'])
schedule_thumbnail(data['lecture_id'])
video = query('SELECT videos.*, "format" AS sep, formats.* FROM videos JOIN formats ON formats.id = videos.video_format WHERE videos.id = ?', video_id)[0]
lecture = query('SELECT * FROM lectures WHERE id = ?', data['lecture_id'])[0]
course = query('SELECT * FROM courses WHERE id = ?', lecture['course_id'])[0]
notify_mods('new_video', course['id'], course=course, lecture=lecture, video=video)
def sort_file(filename, course=None, lectures=None):
# filenames: <handle>-<sorter>-<format>.mp4
......
Für den Termin {% if lecture.title %}"{{lecture.title}}" {% endif %}vom {{ lecture.time|fulldate }} der Veranstaltung "{{ course.title }}" ({{ course.semester|semester }}) wurde ein Video im Format "{{ video.format.description }}" {% if video.source %}fertig kodiert{% else %}hochgeladen{% endif %}.
{% if not video.visible %}
Video freischalten: {{ url_for('course', handle=course.handle, _external=True)}}#lecture-{{lecture.id}}
{% endif %}
Link zum Video: {{ url_for('lecture', id=lecture.id, course=course.handle, _external=True) }}
Neues Video verfügbar: {{ video.path.split('/')[-1] }}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment