Added changeCase to mainArtist, mainArtistsString and featArtistsString

This commit is contained in:
RemixDev 2020-08-24 13:07:38 +02:00
parent a1e7840123
commit bafdb84ce7
4 changed files with 21 additions and 14 deletions

View File

@ -1,3 +1,3 @@
#!/usr/bin/env python3
__version__ = "1.2.9"
__version__ = "1.2.10"

View File

@ -302,6 +302,18 @@ class DownloadJob:
if "Album Version" in track.title:
track.title = re.sub(r' ?\(Album Version\)', "", track.title).strip()
# Change Title and Artists casing if needed
if self.settings['titleCasing'] != "nothing":
track.title = changeCase(track.title, self.settings['titleCasing'])
if self.settings['artistCasing'] != "nothing":
track.mainArtist['name'] = changeCase(track.mainArtist['name'], self.settings['artistCasing'])
for i, artist in enumerate(track.artists):
track.artists[i] = changeCase(artist, self.settings['artistCasing'])
for type in track.artist:
for i, artist in enumerate(track.artist[type]):
track.artist[type][i] = changeCase(artist, self.settings['artistCasing'])
track.generateMainFeatStrings()
# Generate artist tag if needed
if self.settings['tags']['multiArtistSeparator'] != "default":
if self.settings['tags']['multiArtistSeparator'] == "andFeat":
@ -313,14 +325,6 @@ class DownloadJob:
else:
track.artistsString = ", ".join(track.artists)
# Change Title and Artists casing if needed
if self.settings['titleCasing'] != "nothing":
track.title = changeCase(track.title, self.settings['titleCasing'])
if self.settings['artistCasing'] != "nothing":
track.artistsString = changeCase(track.artistsString, self.settings['artistCasing'])
for i, artist in enumerate(track.artists):
track.artists[i] = changeCase(artist, self.settings['artistCasing'])
# Generate filename and filepath from metadata
filename = generateFilename(track, trackAPI_gw, self.settings)
(filepath, artistPath, coverPath, extrasPath) = generateFilepath(track, trackAPI_gw, self.settings)

View File

@ -75,10 +75,7 @@ class Track:
}
self.playlist['discTotal'] = "1"
self.mainArtistsString = andCommaConcat(self.artist['Main'])
self.featArtistsString = None
if 'Featured' in self.artist:
self.featArtistsString = "feat. "+andCommaConcat(self.artist['Featured'])
self.generateMainFeatStrings()
# Bits useful for later
self.searched = False
@ -331,3 +328,9 @@ class Track:
if self.featArtistsString and not "(feat." in self.title.lower():
return self.title + " ({})".format(self.featArtistsString)
return self.title
def generateMainFeatStrings(self):
self.mainArtistsString = andCommaConcat(self.artist['Main'])
self.featArtistsString = None
if 'Featured' in self.artist:
self.featArtistsString = "feat. "+andCommaConcat(self.artist['Featured'])

View File

@ -7,7 +7,7 @@ README = (HERE / "README.md").read_text()
setup(
name="deemix",
version="1.2.9",
version="1.2.10",
description="A barebone deezer downloader library",
long_description=README,
long_description_content_type="text/markdown",