Exception traceback in GENERAL DOWNLOAD ERROR

This commit is contained in:
Mike Schwörer 2021-11-22 14:45:20 +01:00
parent 45f276013f
commit c5886e3401
No known key found for this signature in database
GPG Key ID: D3C7172E0A70F8CF

View File

@ -14,7 +14,7 @@ from termoutput import Printer, PrintChannel
from utils import fix_filename, set_audio_tags, set_music_thumbnail, create_download_directory, \
get_directory_song_ids, add_to_directory_song_ids, get_previously_downloaded, add_to_archive
from zspotify import ZSpotify
import traceback
def get_saved_tracks() -> list:
""" Returns user's saved tracks """
@ -131,7 +131,7 @@ def download_track(mode: str, track_id: str, extra_keys={}, disable_progressbar=
stream = ZSpotify.get_content_stream(
track_id, ZSpotify.DOWNLOAD_QUALITY)
create_download_directory(filedir)
total_size = stream.input_stream.size
total_size = stream.input_stream.size / ""
with open(filename, 'wb') as file, Printer.progress(
desc=song_name,
@ -166,6 +166,7 @@ def download_track(mode: str, track_id: str, extra_keys={}, disable_progressbar=
except Exception as e:
Printer.print(PrintChannel.ERRORS, '### SKIPPING: ' + song_name + ' (GENERAL DOWNLOAD ERROR) ###')
Printer.print(PrintChannel.ERRORS, str(e) + "\n")
Printer.print(PrintChannel.ERRORS, "".join(traceback.TracebackException.from_exception(e).format()) + "\n")
if os.path.exists(filename):
os.remove(filename)