From 7305d5fd646e8f9e1ad2af5f6d2d2531b89e667e Mon Sep 17 00:00:00 2001 From: RemixDev Date: Wed, 6 May 2020 12:56:44 +0200 Subject: [PATCH] added traceback for singles and fixed utf8 chars --- deemix/app/downloader.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/deemix/app/downloader.py b/deemix/app/downloader.py index ee25797..67e58cc 100644 --- a/deemix/app/downloader.py +++ b/deemix/app/downloader.py @@ -575,7 +575,7 @@ def downloadTrackObj(dz, trackAPI, settings, bitrate, queueItem, extraTrack=None # Save lyrics in lrc file if settings['syncedLyrics'] and 'sync' in track['lyrics']: - with open(os.path.join(filepath, filename + '.lrc'), 'w') as f: + with open(os.path.join(filepath, filename + '.lrc'), 'w', "utf-8-sig") as f: f.write(track['lyrics']['sync']) # Save local album art @@ -695,6 +695,7 @@ def download(dz, queueItem, interface=None): try: result = downloadTrackObj(dz, queueItem['single'], settings, bitrate, queueItem, interface=interface) except Exception as e: + traceback.print_exc() result = {'error': { 'message': str(e), 'data': { @@ -760,13 +761,13 @@ def after_download(tracks, settings, queueItem): if not extrasPath: extrasPath = settings['downloadLocation'] if settings['logErrors'] and errors != "": - with open(os.path.join(extrasPath, 'errors.txt'), 'w') as f: + with open(os.path.join(extrasPath, 'errors.txt'), 'w', "utf-8-sig") as f: f.write(errors) if settings['logSearched'] and searched != "": - with open(os.path.join(extrasPath, 'searched.txt'), 'w') as f: + with open(os.path.join(extrasPath, 'searched.txt'), 'w', "utf-8-sig") as f: f.write(searched) if settings['createM3U8File']: - with open(os.path.join(extrasPath, 'playlist.m3u8'), 'w') as f: + with open(os.path.join(extrasPath, 'playlist.m3u8'), 'w', "utf-8-sig") as f: for line in playlist: f.write(line + "\n") if settings['executeCommand'] != "": @@ -780,7 +781,7 @@ def after_download_single(track, settings, queueItem): if 'extrasPath' not in track: track['extrasPath'] = settings['downloadLocation'] if settings['logSearched'] and 'searched' in track: - with open(os.path.join(track['extrasPath'], 'searched.txt'), 'w+') as f: + with open(os.path.join(track['extrasPath'], 'searched.txt'), 'w+', "utf-8-sig") as f: orig = f.read() if not track['searched'] in orig: if orig != "":