mirror of
https://github.com/THIS-IS-NOT-A-BACKUP/zspotify.git
synced 2024-11-26 09:53:17 +01:00
Support subfolders for each disc.
Must be enabled manually in zs_config.json
This commit is contained in:
parent
e75ea14faa
commit
8770de741d
@ -7,5 +7,6 @@
|
||||
"FORCE_PREMIUM": false,
|
||||
"ANTI_BAN_WAIT_TIME": 1,
|
||||
"OVERRIDE_AUTO_WAIT": false,
|
||||
"CHUNK_SIZE": 50000
|
||||
"CHUNK_SIZE": 50000,
|
||||
"SPLIT_ALBUM_DISCS": false
|
||||
}
|
19
zspotify.py
19
zspotify.py
@ -118,6 +118,7 @@ def client():
|
||||
print("[ DETECTED FREE ACCOUNT - USING HIGH QUALITY ]\n\n")
|
||||
QUALITY = AudioQuality.HIGH
|
||||
|
||||
while True:
|
||||
if len(sys.argv) > 1:
|
||||
if sys.argv[1] == "-p" or sys.argv[1] == "--playlist":
|
||||
download_from_user_playlist()
|
||||
@ -310,7 +311,8 @@ def download_episode(episode_id_str):
|
||||
# print("### DOWNLOADING '" + podcast_name + " - " +
|
||||
# episode_name + "' - THIS MAY TAKE A WHILE ###")
|
||||
|
||||
os.makedirs(ZS_CONFIG["ROOT_PODCAST_PATH"] + extra_paths, exist_ok=True)
|
||||
os.makedirs(ZS_CONFIG["ROOT_PODCAST_PATH"] +
|
||||
extra_paths, exist_ok=True)
|
||||
|
||||
total_size = stream.input_stream.size
|
||||
with open(ZS_CONFIG["ROOT_PODCAST_PATH"] + extra_paths + filename + ".wav", 'wb') as file, tqdm(
|
||||
@ -455,7 +457,8 @@ def convert_audio_format(filename):
|
||||
bitrate = "320k"
|
||||
else:
|
||||
bitrate = "160k"
|
||||
raw_audio.export(filename, format=ZS_CONFIG["MUSIC_FORMAT"], bitrate=bitrate)
|
||||
raw_audio.export(
|
||||
filename, format=ZS_CONFIG["MUSIC_FORMAT"], bitrate=bitrate)
|
||||
|
||||
|
||||
def set_audio_tags(filename, artists, name, album_name, release_year, disc_number, track_number):
|
||||
@ -610,6 +613,11 @@ def download_track(track_id_str: str, extra_paths="", prefix=False, prefix_value
|
||||
if prefix:
|
||||
song_name = f'{prefix_value.zfill(2)} - {song_name}' if prefix_value.isdigit(
|
||||
) else f'{prefix_value} - {song_name}'
|
||||
|
||||
if ZS_CONFIG["SPLIT_ALBUM_DISCS"]:
|
||||
filename = os.path.join(ZS_CONFIG["ROOT_PATH"], extra_paths, "Disc " + str(
|
||||
disc_number) + '/' + song_name + '.' + ZS_CONFIG["MUSIC_FORMAT"])
|
||||
else:
|
||||
filename = os.path.join(ZS_CONFIG["ROOT_PATH"], extra_paths,
|
||||
song_name + '.' + ZS_CONFIG["MUSIC_FORMAT"])
|
||||
except Exception as e:
|
||||
@ -635,7 +643,12 @@ def download_track(track_id_str: str, extra_paths="", prefix=False, prefix_value
|
||||
track_id, VorbisOnlyAudioQuality(QUALITY), False, None)
|
||||
# print("### DOWNLOADING RAW AUDIO ###")
|
||||
|
||||
os.makedirs(ZS_CONFIG["ROOT_PATH"] + extra_paths, exist_ok=True)
|
||||
if ZS_CONFIG["SPLIT_ALBUM_DISCS"]:
|
||||
os.makedirs(
|
||||
ZS_CONFIG["ROOT_PATH"] + extra_paths + "/Disc " + str(disc_number) + '/', exist_ok=True)
|
||||
else:
|
||||
os.makedirs(ZS_CONFIG["ROOT_PATH"] +
|
||||
extra_paths, exist_ok=True)
|
||||
|
||||
total_size = stream.input_stream.size
|
||||
with open(filename, 'wb') as file, tqdm(
|
||||
|
Loading…
Reference in New Issue
Block a user