From 4a54c4fe301f37ae63e98defe8240a5d526361c6 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Sat, 16 Feb 2019 16:11:53 -0800 Subject: subscriptions: store video duration in database --- youtube/subscriptions.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'youtube') diff --git a/youtube/subscriptions.py b/youtube/subscriptions.py index 0d31bd4..a0f7e48 100644 --- a/youtube/subscriptions.py +++ b/youtube/subscriptions.py @@ -33,6 +33,7 @@ def open_database(): uploader_id integer NOT NULL REFERENCES subscribed_channels(id) ON UPDATE CASCADE ON DELETE CASCADE, video_id text NOT NULL, title text NOT NULL, + duration text, time_published integer NOT NULL, description text, )''') @@ -72,7 +73,7 @@ def _get_videos(number, offset): connection = open_database() try: cursor = connection.cursor() - cursor.execute('''SELECT video_id, title, time_published, description, channel_id, channel_name + cursor.execute('''SELECT video_id, title, duration, time_published, description, channel_id, channel_name FROM videos INNER JOIN subscribed_channels on videos.uploader_id = subscribed_channels.id ORDER BY time_published DESC -- cgit v1.2.3