forcePostProcess more encoding

- encode all download dirs so subsequent decode will work
This commit is contained in:
AdeHub
2024-07-23 21:11:05 +12:00
parent 46c7582fb1
commit 167b5817e7

View File

@@ -1195,16 +1195,15 @@ def forcePostProcess(dir=None, expand_subfolders=True, album_dir=None, keep_orig
if dir: if dir:
download_dirs.append(dir) download_dirs.append(dir)
if headphones.CONFIG.DOWNLOAD_DIR and not dir: else:
download_dirs.append(headphones.CONFIG.DOWNLOAD_DIR) if headphones.CONFIG.DOWNLOAD_DIR:
if headphones.CONFIG.SOULSEEK_DOWNLOAD_DIR and not dir: download_dirs.append(headphones.CONFIG.DOWNLOAD_DIR)
download_dirs.append(headphones.CONFIG.SOULSEEK_DOWNLOAD_DIR) if headphones.CONFIG.SOULSEEK_DOWNLOAD_DIR:
if headphones.CONFIG.DOWNLOAD_TORRENT_DIR and not dir: download_dirs.append(headphones.CONFIG.SOULSEEK_DOWNLOAD_DIR)
download_dirs.append( if headphones.CONFIG.DOWNLOAD_TORRENT_DIR:
headphones.CONFIG.DOWNLOAD_TORRENT_DIR.encode(headphones.SYS_ENCODING, 'replace')) download_dirs.append(headphones.CONFIG.DOWNLOAD_TORRENT_DIR)
if headphones.CONFIG.BANDCAMP and not dir: if headphones.CONFIG.BANDCAMP:
download_dirs.append( download_dirs.append(headphones.CONFIG.BANDCAMP_DIR)
headphones.CONFIG.BANDCAMP_DIR.encode(headphones.SYS_ENCODING, 'replace'))
# If DOWNLOAD_DIR and DOWNLOAD_TORRENT_DIR are the same, remove the duplicate to prevent us from trying to process the same folder twice. # 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)) download_dirs = list(set(download_dirs))
@@ -1214,6 +1213,7 @@ def forcePostProcess(dir=None, expand_subfolders=True, album_dir=None, keep_orig
folders = [] folders = []
for download_dir in download_dirs: for download_dir in download_dirs:
download_dir = download_dir.encode(headphones.SYS_ENCODING, 'replace')
if not os.path.isdir(download_dir): if not os.path.isdir(download_dir):
logger.warn('Directory %s does not exist. Skipping', download_dir) logger.warn('Directory %s does not exist. Skipping', download_dir)
continue continue