From a468454a04e6a915fcd964df85d50e8ed45498f6 Mon Sep 17 00:00:00 2001 From: Rafael Moraes <50295204+glomatico@users.noreply.github.com> Date: Sat, 21 Sep 2024 22:16:27 -0300 Subject: [PATCH] update playlist file when file is not downloaded --- votify/downloader_episode.py | 10 ++++++---- votify/downloader_song.py | 11 ++++++----- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/votify/downloader_episode.py b/votify/downloader_episode.py index 45d67c9..75572a4 100644 --- a/votify/downloader_episode.py +++ b/votify/downloader_episode.py @@ -114,6 +114,7 @@ class DownloaderEpisode: ) cover_path = self.get_cover_path(final_path) cover_url = self.downloader.get_cover_url(show_metadata) + decrypted_path = None if final_path.exists() and not self.downloader.overwrite: logger.warning(f'Track already exists at "{final_path}", skipping') return @@ -142,10 +143,11 @@ class DownloaderEpisode: logger.debug(f'Saving cover to "{cover_path}"') self.downloader.save_cover_file(cover_path, cover_url) return - logger.debug("Applying tags") - self.downloader.apply_tags(decrypted_path, tags, cover_url) - logger.debug(f'Moving to "{final_path}"') - self.downloader.move_to_final_path(decrypted_path, final_path) + if decrypted_path: + logger.debug("Applying tags") + self.downloader.apply_tags(decrypted_path, tags, cover_url) + logger.debug(f'Moving to "{final_path}"') + self.downloader.move_to_final_path(decrypted_path, final_path) if self.downloader.save_playlist and playlist_metadata: playlist_file_path = self.downloader.get_playlist_file_path(tags) logger.debug(f'Updating M3U8 playlist from "{playlist_file_path}"') diff --git a/votify/downloader_song.py b/votify/downloader_song.py index 975e733..1ead865 100644 --- a/votify/downloader_song.py +++ b/votify/downloader_song.py @@ -201,11 +201,11 @@ class DownloaderSong: lrc_path = self.downloader.get_lrc_path(final_path) cover_path = self.get_cover_path(final_path) cover_url = self.downloader.get_cover_url(album_metadata) + decrypted_path = None if self.lrc_only: pass elif final_path.exists() and not self.downloader.overwrite: logger.warning(f'Track already exists at "{final_path}", skipping') - return else: if not decryption_key: logger.debug("Getting decryption key") @@ -238,10 +238,11 @@ class DownloaderSong: logger.debug(f'Saving cover to "{cover_path}"') self.downloader.save_cover_file(cover_path, cover_url) return - logger.debug("Applying tags") - self.downloader.apply_tags(decrypted_path, tags, cover_url) - logger.debug(f'Moving to "{final_path}"') - self.downloader.move_to_final_path(decrypted_path, final_path) + if decrypted_path: + logger.debug("Applying tags") + self.downloader.apply_tags(decrypted_path, tags, cover_url) + logger.debug(f'Moving to "{final_path}"') + self.downloader.move_to_final_path(decrypted_path, final_path) if not self.lrc_only and self.downloader.save_playlist and playlist_metadata: playlist_file_path = self.downloader.get_playlist_file_path(tags) logger.debug(f'Updating M3U8 playlist from "{playlist_file_path}"')