From 178e47b05330bb0cf3a64af72fea3183aad2e098 Mon Sep 17 00:00:00 2001 From: yosh Date: Sat, 20 May 2023 15:40:46 -0500 Subject: [PATCH] add --no-unzip --- free_bandcamp_downloader/main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/free_bandcamp_downloader/main.py b/free_bandcamp_downloader/main.py index 1c94e10..fa17d94 100644 --- a/free_bandcamp_downloader/main.py +++ b/free_bandcamp_downloader/main.py @@ -1,6 +1,6 @@ """Download free albums and tracks from Bandcamp Usage: - bcdl-free (-a | -l )[--force][-d | --dir ][-e | --email ] + bcdl-free (-a | -l )[--force][--no-unzip][-d | --dir ][-e | --email ] [-z | --zipcode ][-c | --country ][-f | --format ] bcdl-free setdefault [-d | --dir ][-e | --email ][-z | --zipcode ] [-c | --country ][-f | --format ] @@ -14,6 +14,7 @@ Options: -a Download the album at URL -l Download all free albums of the label at URL --force Download even if album has been downloaded before + --no-unzip Don't unzip downloaded albums setdefault Set default options defaults List the default options clear Clear download history @@ -163,12 +164,12 @@ def download_file(driver, album_data=None): logger.info(f'Downloading {name}, {size / length * 100: .1f}%') response.close() logger.info(f'Downloaded {file_name}') - if file_name.endswith('zip'): + if file_name.endswith('zip') and not arguments['--no-unzip']: # Unzip archive dir_name = file_name[:-4] with zipfile.ZipFile(file_name, 'r') as f: f.extractall(dir_name) - logger.info(f'Unzipped to {dir_name}') + logger.info(f'Unzipped to {dir_name}. Use --no-unzip to prevent this') os.remove(file_name) files = glob.glob(os.path.join(dir_name, "*")) else: