program2 exports the playlists
This commit is contained in:
26
app/cache/video_summary.py
vendored
Normal file
26
app/cache/video_summary.py
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
# cache/video_summary.py
|
||||
import db
|
||||
|
||||
def rebuild_video_summary():
|
||||
with db.get_conn() as conn:
|
||||
conn.execute("DROP TABLE IF EXISTS video_summary")
|
||||
conn.execute("""
|
||||
CREATE TABLE video_summary AS
|
||||
SELECT
|
||||
v.file_name,
|
||||
v.raw_file,
|
||||
v.mp4_file,
|
||||
v.record_datetime,
|
||||
v.day_of_week,
|
||||
v.difficulty_level,
|
||||
v.address,
|
||||
GROUP_CONCAT(DISTINCT l.name) AS labels,
|
||||
GROUP_CONCAT(DISTINCT p.name) AS playlists
|
||||
FROM videos v
|
||||
LEFT JOIN video_labels vl ON vl.video_file_name = v.file_name
|
||||
LEFT JOIN labels l ON l.id = vl.label_id
|
||||
LEFT JOIN video_playlists vp ON vp.video_file_name = v.file_name
|
||||
LEFT JOIN playlists p ON p.id = vp.playlist_id
|
||||
GROUP BY v.file_name
|
||||
""")
|
||||
conn.commit()
|
||||
Reference in New Issue
Block a user