Finished implementing "Create folder structure for singles"

Now the app saves the cover in the folder and uses the album track 
template for naming
This commit is contained in:
RemixDev 2020-05-13 20:40:08 +02:00
parent 3c120251c1
commit 0be0e8370e
2 changed files with 8 additions and 1 deletions

View File

@ -789,6 +789,10 @@ def after_download_single(track, settings, queueItem):
return None return None
if 'extrasPath' not in track: if 'extrasPath' not in track:
track['extrasPath'] = settings['downloadLocation'] track['extrasPath'] = settings['downloadLocation']
if settings['saveArtwork'] and 'albumPath' in track:
downloadImage(track['albumURL'], track['albumPath'])
if settings['saveArtworkArtist'] and 'artistPath' in track:
downloadImage(track['artistURL'], track['artistPath'])
if settings['logSearched'] and 'searched' in track: if settings['logSearched'] and 'searched' in track:
with open(os.path.join(track['extrasPath'], 'searched.txt'), 'wb+') as f: with open(os.path.join(track['extrasPath'], 'searched.txt'), 'wb+') as f:
orig = f.read().decode('utf-8') orig = f.read().decode('utf-8')

View File

@ -51,6 +51,9 @@ def generateQueueItem(dz, sp, url, settings, bitrate=None, albumAPI=None, interf
trackAPI = dz.get_track_gw(id) trackAPI = dz.get_track_gw(id)
if albumAPI: if albumAPI:
trackAPI['_EXTRA_ALBUM'] = albumAPI trackAPI['_EXTRA_ALBUM'] = albumAPI
if settings['createSingleFolder']:
trackAPI['FILENAME_TEMPLATE'] = settings['albumTracknameTemplate']
else:
trackAPI['FILENAME_TEMPLATE'] = settings['tracknameTemplate'] trackAPI['FILENAME_TEMPLATE'] = settings['tracknameTemplate']
trackAPI['SINGLE_TRACK'] = True trackAPI['SINGLE_TRACK'] = True