fix stop iterator, better channel overwrite unpack
This commit is contained in:
parent
4edb5adead
commit
05cfeb9d99
|
@ -382,14 +382,14 @@ class DownloadPostProcess:
|
|||
playlist = YoutubePlaylist(playlist_id)
|
||||
playlist.update_playlist(skip_on_empty=True)
|
||||
|
||||
if self.download.task:
|
||||
if not self.download.task:
|
||||
continue
|
||||
|
||||
channel_name = playlist.json_data["playlist_channel"]
|
||||
playlist_title = playlist.json_data["playlist_name"]
|
||||
message = [
|
||||
f"Post Processing Playlists for: {channel_name}",
|
||||
f"Validate: {playlist_title} - {idx + 1}/{total_playlist}",
|
||||
f"{playlist_title} [{idx + 1}/{total_playlist}]",
|
||||
]
|
||||
progress = (idx + 1) / total_playlist
|
||||
self.download.task.send_progress(message, progress=progress)
|
||||
|
@ -407,9 +407,9 @@ class DownloadPostProcess:
|
|||
channel = YoutubeChannel(channel_id)
|
||||
channel.get_from_es()
|
||||
overwrites = channel.get_overwrites()
|
||||
if overwrites and overwrites.get("index_playlists"):
|
||||
if "index_playlists" in overwrites:
|
||||
channel.get_all_playlists()
|
||||
to_refresh.extend(channel.all_playlists)
|
||||
to_refresh.extend([i[0] for i in channel.all_playlists])
|
||||
|
||||
subs = PlaylistSubscription().get_playlists()
|
||||
for playlist in subs:
|
||||
|
|
|
@ -225,9 +225,7 @@ class YoutubeChannel(YouTubeItem):
|
|||
"""delete all indexed playlist from es"""
|
||||
all_playlists = self.get_indexed_playlists()
|
||||
for playlist in all_playlists:
|
||||
playlist_id = playlist["playlist_id"]
|
||||
playlist = YoutubePlaylist(playlist_id)
|
||||
YoutubePlaylist(playlist_id).delete_metadata()
|
||||
YoutubePlaylist(playlist["playlist_id"]).delete_metadata()
|
||||
|
||||
def delete_channel(self):
|
||||
"""delete channel and all videos"""
|
||||
|
@ -324,9 +322,9 @@ class YoutubeChannel(YouTubeItem):
|
|||
all_playlists = IndexPaginate("ta_playlist", data).get_results()
|
||||
return all_playlists
|
||||
|
||||
def get_overwrites(self):
|
||||
def get_overwrites(self) -> dict:
|
||||
"""get all per channel overwrites"""
|
||||
return self.json_data.get("channel_overwrites", False)
|
||||
return self.json_data.get("channel_overwrites", {})
|
||||
|
||||
def set_overwrites(self, overwrites):
|
||||
"""set per channel overwrites"""
|
||||
|
|
|
@ -168,7 +168,7 @@ class YoutubePlaylist(YouTubeItem):
|
|||
return False
|
||||
|
||||
if skip_on_empty:
|
||||
has_item_downloaded = next(
|
||||
has_item_downloaded = any(
|
||||
i["downloaded"] for i in self.json_data["playlist_entries"]
|
||||
)
|
||||
if not has_item_downloaded:
|
||||
|
|
Loading…
Reference in New Issue