map channel overwrite to video id for later efficient mapping

This commit is contained in:
simon 2022-03-18 21:39:33 +07:00
parent a6937db5fd
commit ac9df4e082
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4

View File

@ -28,6 +28,7 @@ class PendingIndex:
self.all_videos = False self.all_videos = False
self.all_channels = False self.all_channels = False
self.all_overwrites = False self.all_overwrites = False
self.video_overwrites = False
self.to_skip = False self.to_skip = False
def get_download(self): def get_download(self):
@ -77,6 +78,18 @@ class PendingIndex:
{channel_id: channel.get("channel_overwrites")} {channel_id: channel.get("channel_overwrites")}
) )
self._map_overwrites()
def _map_overwrites(self):
"""map video ids to channel ids overwrites"""
self.video_overwrites = {}
for video in self.all_pending:
video_id = video["youtube_id"]
channel_id = video["channel_id"]
overwrites = self.all_overwrites.get(channel_id, False)
if overwrites:
self.video_overwrites.update({video_id: overwrites})
class PendingInteract: class PendingInteract:
"""interact with items in download queue""" """interact with items in download queue"""