Added multiartist for albumartist
This commit is contained in:
parent
be13b3f0cb
commit
47456727f7
|
@ -155,11 +155,19 @@ def getTrackData(dz, trackAPI_gw, trackAPI = None, albumAPI_gw = None, albumAPI
|
|||
try:
|
||||
if not albumAPI:
|
||||
albumAPI = dz.get_album(track['album']['id'])
|
||||
track['album']['artist'] = {
|
||||
track['album']['mainArtist'] = {
|
||||
'id': albumAPI['artist']['id'],
|
||||
'name': albumAPI['artist']['name'],
|
||||
'pic': albumAPI['artist']['picture_small'][albumAPI['artist']['picture_small'].find('artist/')+7:-24]
|
||||
}
|
||||
track['album']['artist'] = {}
|
||||
track['album']['artists'] = []
|
||||
for artist in albumAPI['contributors']:
|
||||
if artist['id'] != 5080:
|
||||
track['album']['artists'].append(artist['name'])
|
||||
if not artist['role'] in track['album']['artist']:
|
||||
track['album']['artist'][artist['role']] = []
|
||||
track['album']['artist'][artist['role']].append(artist['name'])
|
||||
track['album']['trackTotal'] = albumAPI['nb_tracks']
|
||||
track['album']['recordType'] = albumAPI['record_type']
|
||||
track['album']['barcode'] = albumAPI['upc'] if 'upc' in albumAPI else "Unknown"
|
||||
|
|
|
@ -69,9 +69,9 @@ def generateFilepath(track, trackAPI, settings):
|
|||
(settings['createArtistFolder'] and '_EXTRA_PLAYLIST' in trackAPI and settings['savePlaylistAsCompilation']) or
|
||||
(settings['createArtistFolder'] and '_EXTRA_PLAYLIST' in trackAPI and settings['createStructurePlaylist'])
|
||||
):
|
||||
if (int(track['id'])<0 and not 'artist' in track['album']):
|
||||
track['album']['artist'] = track['mainArtist']
|
||||
filepath += antiDot(settingsRegexArtist(settings['artistNameTemplate'], track['album']['artist'], settings)) + pathSep
|
||||
if (int(track['id'])<0 and not 'mainArtist' in track['album']):
|
||||
track['album']['mainArtist'] = track['mainArtist']
|
||||
filepath += antiDot(settingsRegexArtist(settings['artistNameTemplate'], track['album']['mainArtist'], settings)) + pathSep
|
||||
artistPath = filepath
|
||||
|
||||
if (settings['createAlbumFolder'] and
|
||||
|
@ -98,7 +98,7 @@ def settingsRegex(filename, track, settings, playlist=None):
|
|||
filename = filename.replace("%title%", fixName(track['title'], settings['illegalCharacterReplacer']))
|
||||
filename = filename.replace("%artist%", fixName(track['mainArtist']['name'], settings['illegalCharacterReplacer']))
|
||||
filename = filename.replace("%album%", fixName(track['album']['title'], settings['illegalCharacterReplacer']))
|
||||
filename = filename.replace("%albumartist%", fixName(track['album']['artist']['name'], settings['illegalCharacterReplacer']))
|
||||
filename = filename.replace("%albumartist%", fixName(track['album']['mainArtist']['name'], settings['illegalCharacterReplacer']))
|
||||
filename = filename.replace("%tracknumber%", pad(track['trackNumber'], track['album']['trackTotal'] if int(settings['paddingSize']) == 0 else 10 ** (int(settings['paddingSize'])-1), settings['padTracks']))
|
||||
filename = filename.replace("%tracktotal%", str(track['album']['trackTotal']))
|
||||
filename = filename.replace("%discnumber%", str(track['discNumber']))
|
||||
|
@ -129,8 +129,8 @@ def settingsRegex(filename, track, settings, playlist=None):
|
|||
def settingsRegexAlbum(foldername, album, settings):
|
||||
foldername = foldername.replace("%album_id%", str(album['id']))
|
||||
foldername = foldername.replace("%album%", fixName(album['title'], settings['illegalCharacterReplacer']))
|
||||
foldername = foldername.replace("%artist%", fixName(album['artist']['name'], settings['illegalCharacterReplacer']))
|
||||
foldername = foldername.replace("%artist_id%", str(album['artist']['id']))
|
||||
foldername = foldername.replace("%artist%", fixName(album['mainArtist']['name'], settings['illegalCharacterReplacer']))
|
||||
foldername = foldername.replace("%artist_id%", str(album['mainArtist']['id']))
|
||||
foldername = foldername.replace("%tracktotal%", str(album['trackTotal']))
|
||||
foldername = foldername.replace("%disctotal%", str(album['discTotal']))
|
||||
foldername = foldername.replace("%type%", fixName(album['recordType'], settings['illegalCharacterReplacer']))
|
||||
|
|
|
@ -17,7 +17,7 @@ def tagID3(stream, track, save, id3v1=False, nullSeparator=True):
|
|||
if save['album']:
|
||||
tag.add(TALB(text=track['album']['title']))
|
||||
if save['albumArtist']:
|
||||
tag.add(TPE2(text=track['album']['artist']['name']))
|
||||
tag.add(TPE2(text=track['album']['artists']))
|
||||
if save['trackNumber']:
|
||||
tag.add(TRCK(text=str(track['trackNumber'])+("/"+str(track['album']['trackTotal']) if save['trackTotal'] else "")))
|
||||
if save['discNumber']:
|
||||
|
@ -71,7 +71,7 @@ def tagFLAC(stream, track, save):
|
|||
if save['album']:
|
||||
tag["ALBUM"] = track['album']['title']
|
||||
if save['albumArtist']:
|
||||
tag["ALBUMARTIST"] = track['album']['artist']['name']
|
||||
tag["ALBUMARTIST"] = track['album']['artists']
|
||||
if save['trackNumber']:
|
||||
tag["TRACKNUMBER"] = str(track['trackNumber'])
|
||||
if save['trackTotal']:
|
||||
|
|
Loading…
Reference in New Issue