From 167b5817e7709701a4f536a6e92fafaac9b97039 Mon Sep 17 00:00:00 2001 From: AdeHub Date: Tue, 23 Jul 2024 21:11:05 +1200 Subject: [PATCH] forcePostProcess more encoding - encode all download dirs so subsequent decode will work --- headphones/postprocessor.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/headphones/postprocessor.py b/headphones/postprocessor.py index 4ba268fa..c6db9d4f 100755 --- a/headphones/postprocessor.py +++ b/headphones/postprocessor.py @@ -1195,16 +1195,15 @@ def forcePostProcess(dir=None, expand_subfolders=True, album_dir=None, keep_orig if dir: download_dirs.append(dir) - if headphones.CONFIG.DOWNLOAD_DIR and not dir: - download_dirs.append(headphones.CONFIG.DOWNLOAD_DIR) - if headphones.CONFIG.SOULSEEK_DOWNLOAD_DIR and not dir: - download_dirs.append(headphones.CONFIG.SOULSEEK_DOWNLOAD_DIR) - if headphones.CONFIG.DOWNLOAD_TORRENT_DIR and not dir: - download_dirs.append( - headphones.CONFIG.DOWNLOAD_TORRENT_DIR.encode(headphones.SYS_ENCODING, 'replace')) - if headphones.CONFIG.BANDCAMP and not dir: - download_dirs.append( - headphones.CONFIG.BANDCAMP_DIR.encode(headphones.SYS_ENCODING, 'replace')) + else: + if headphones.CONFIG.DOWNLOAD_DIR: + download_dirs.append(headphones.CONFIG.DOWNLOAD_DIR) + if headphones.CONFIG.SOULSEEK_DOWNLOAD_DIR: + download_dirs.append(headphones.CONFIG.SOULSEEK_DOWNLOAD_DIR) + if headphones.CONFIG.DOWNLOAD_TORRENT_DIR: + download_dirs.append(headphones.CONFIG.DOWNLOAD_TORRENT_DIR) + if headphones.CONFIG.BANDCAMP: + download_dirs.append(headphones.CONFIG.BANDCAMP_DIR) # If DOWNLOAD_DIR and DOWNLOAD_TORRENT_DIR are the same, remove the duplicate to prevent us from trying to process the same folder twice. download_dirs = list(set(download_dirs)) @@ -1214,6 +1213,7 @@ def forcePostProcess(dir=None, expand_subfolders=True, album_dir=None, keep_orig folders = [] for download_dir in download_dirs: + download_dir = download_dir.encode(headphones.SYS_ENCODING, 'replace') if not os.path.isdir(download_dir): logger.warn('Directory %s does not exist. Skipping', download_dir) continue