From 1c490656b55266669b5bdd2b5eae1d0aed9cf37e Mon Sep 17 00:00:00 2001 From: RemixDev Date: Wed, 13 May 2020 23:30:35 +0200 Subject: [PATCH] Added %explicit% for albums --- deemix/app/downloader.py | 2 ++ deemix/utils/pathtemplates.py | 1 + 2 files changed, 3 insertions(+) diff --git a/deemix/app/downloader.py b/deemix/app/downloader.py index 88e97d0..6e521ac 100644 --- a/deemix/app/downloader.py +++ b/deemix/app/downloader.py @@ -251,6 +251,7 @@ def getTrackData(dz, trackAPI_gw, trackAPI=None, albumAPI_gw=None, albumAPI=None track['album']['recordType'] = albumAPI['record_type'] track['album']['barcode'] = albumAPI['upc'] if 'upc' in albumAPI else "Unknown" track['album']['label'] = albumAPI['label'] if 'label' in albumAPI else "Unknown" + track['album']['explicit'] = albumAPI['explicit_lyrics'] if 'explicit_lyrics' in albumAPI else False if not 'pic' in track['album']: track['album']['pic'] = albumAPI['cover_small'][albumAPI['cover_small'].find('cover/') + 6:-24] if 'release_date' in albumAPI: @@ -283,6 +284,7 @@ def getTrackData(dz, trackAPI_gw, trackAPI=None, albumAPI_gw=None, albumAPI=None track['album']['recordType'] = "Album" track['album']['barcode'] = "Unknown" track['album']['label'] = albumAPI_gw['LABEL_NAME'] if 'LABEL_NAME' in albumAPI_gw else "Unknown" + track['album']['explicit'] = albumAPI_gw['EXPLICIT_ALBUM_CONTENT']['EXPLICIT_LYRICS_STATUS'] == 1 if 'EXPLICIT_ALBUM_CONTENT' in albumAPI_gw and 'EXPLICIT_LYRICS_STATUS' in albumAPI_gw['EXPLICIT_ALBUM_CONTENT'] else False if not 'pic' in track['album']: track['album']['pic'] = albumAPI_gw['ALB_PICTURE'] if 'PHYSICAL_RELEASE_DATE' in albumAPI_gw: diff --git a/deemix/utils/pathtemplates.py b/deemix/utils/pathtemplates.py index 61edb12..a4f545c 100644 --- a/deemix/utils/pathtemplates.py +++ b/deemix/utils/pathtemplates.py @@ -166,6 +166,7 @@ def settingsRegexAlbum(foldername, album, settings, trackAPI): foldername = foldername.replace("%type%", fixName(album['recordType'][0].upper() + album['recordType'][1:].lower(), settings['illegalCharacterReplacer'])) foldername = foldername.replace("%upc%", album['barcode']) + foldername = foldername.replace("%explicit%", "(Explicit)" if album['explicit'] else "") foldername = foldername.replace("%label%", fixName(album['label'], settings['illegalCharacterReplacer'])) if len(album['genre']) > 0: foldername = foldername.replace("%genre%", fixName(album['genre'][0], settings['illegalCharacterReplacer']))