progress message on validate_playlists

This commit is contained in:
simon 2021-11-19 15:53:06 +07:00
parent 3881d305f9
commit 3b6e70b4dc
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4

View File

@ -677,12 +677,29 @@ class VideoDownloader:
print("sync playlists") print("sync playlists")
all_indexed = PendingList().get_all_indexed() all_indexed = PendingList().get_all_indexed()
all_youtube_ids = [i["youtube_id"] for i in all_indexed] all_youtube_ids = [i["youtube_id"] for i in all_indexed]
c_counter = 1
for channel_id in self.channels: for channel_id in self.channels:
playlists = YoutubeChannel(channel_id).get_indexed_playlists() playlists = YoutubeChannel(channel_id).get_indexed_playlists()
all_playlist_ids = [i["playlist_id"] for i in playlists] all_playlist_ids = [i["playlist_id"] for i in playlists]
p_counter = 1
for playlist_id in all_playlist_ids: for playlist_id in all_playlist_ids:
playlist_handler = YoutubePlaylist( playlist_handler = YoutubePlaylist(
playlist_id, all_youtube_ids=all_youtube_ids playlist_id, all_youtube_ids=all_youtube_ids
) )
_ = playlist_handler.update_playlist() _ = playlist_handler.update_playlist()
playlist_handler.add_vids_to_playlist() playlist_handler.add_vids_to_playlist()
# notify
title = (
"Processing playlists for channels: "
+ f"{c_counter}/{len(self.channels)}"
)
message = f"Progress: {p_counter}/{len(all_playlist_ids)}"
mess_dict = {
"status": "downloading",
"level": "info",
"title": title,
"message": message,
}
RedisArchivist().set_message("progress:download", mess_dict)
p_counter = p_counter + 1
c_counter = c_counter + 1