From b6d38e9319fabefe83c9df76fe543367add3ee0b Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 6 Jul 2025 21:59:26 +0700 Subject: [PATCH] return complete vid_entry dict from scan --- backend/appsettings/src/reindex.py | 6 ++++-- backend/download/src/queue.py | 4 ++-- backend/download/src/subscriptions.py | 13 ++++++------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/backend/appsettings/src/reindex.py b/backend/appsettings/src/reindex.py index 56fd339e..712eac72 100644 --- a/backend/appsettings/src/reindex.py +++ b/backend/appsettings/src/reindex.py @@ -510,12 +510,14 @@ class ChannelFullScan: self.to_update = [] for video in all_local_videos: video_id = video["youtube_id"] - remote_match = [i for i in all_remote_videos if i[0] == video_id] + remote_match = [ + i for i in all_remote_videos if i["id"] == video_id + ] if not remote_match: print(f"{video_id}: no remote match found") continue - expected_type = remote_match[0][-1] + expected_type = remote_match[0]["vid_type"] if video["vid_type"] != expected_type: self.to_update.append( { diff --git a/backend/download/src/queue.py b/backend/download/src/queue.py index aa214ac9..3bd202a1 100644 --- a/backend/download/src/queue.py +++ b/backend/download/src/queue.py @@ -258,8 +258,8 @@ class PendingList(PendingIndex): video_results = ChannelSubscription().get_last_youtube_videos( url, limit=False, query_filter=vid_type ) - for video_id, _, vid_type in video_results: - self._add_video(video_id, vid_type) + for video_entry in video_results: + self._add_video(video_entry["id"], video_entry["vid_type"]) def _parse_playlist(self, url): """add all videos of playlist to list""" diff --git a/backend/download/src/subscriptions.py b/backend/download/src/subscriptions.py index abc0a4eb..524202e5 100644 --- a/backend/download/src/subscriptions.py +++ b/backend/download/src/subscriptions.py @@ -65,12 +65,9 @@ class ChannelSubscription: if not channel_query: continue - last_videos.extend( - [ - (i["id"], i["title"], vid_type) - for i in channel_query["entries"] - ] - ) + for entry in channel_query["entries"]: + entry["vid_type"] = vid_type + last_videos.append(entry) return last_videos @@ -93,7 +90,9 @@ class ChannelSubscription: if last_videos: ids_to_add = is_missing([i[0] for i in last_videos]) - for video_id, _, vid_type in last_videos: + for video_entry in last_videos: + video_id = video_entry["id"] + vid_type = video_entry["vid_type"] if video_id in ids_to_add: missing_videos.append((video_id, vid_type))