validate_playlists after run_queue from VideoDownloader

This commit is contained in:
simon 2021-11-18 22:35:08 +07:00
parent d0e0903d48
commit fcddf85245
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
2 changed files with 16 additions and 0 deletions

View File

@ -637,3 +637,18 @@ class VideoDownloader:
response = requests.delete(url, auth=es_auth)
if not response.ok and not response.status_code == 404:
print(response.text)
def validate_playlists(self):
"""update playlists"""
print("sync playlists")
all_indexed = PendingList().get_all_indexed()
all_youtube_ids = [i["youtube_id"] for i in all_indexed]
for channel_id in self.channels:
playlists = YoutubeChannel(channel_id).get_indexed_playlists()
all_playlist_ids = [i["playlist_id"] for i in playlists]
for playlist_id in all_playlist_ids:
playlist_handler = YoutubePlaylist(
playlist_id, all_youtube_ids=all_youtube_ids
)
_ = playlist_handler.update_playlist()
playlist_handler.add_vids_to_playlist()

View File

@ -71,6 +71,7 @@ def download_pending():
downloader = VideoDownloader()
downloader.add_pending()
downloader.run_queue()
downloader.validate_playlists()
else:
print("Did not acquire download lock.")