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 #!/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: if "Album Version" in track.title:
track.title = re.sub(r' ?\(Album Version\)', "", track.title).strip() 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 # Generate artist tag if needed
if self.settings['tags']['multiArtistSeparator'] != "default": if self.settings['tags']['multiArtistSeparator'] != "default":
if self.settings['tags']['multiArtistSeparator'] == "andFeat": if self.settings['tags']['multiArtistSeparator'] == "andFeat":
@ -313,14 +325,6 @@ class DownloadJob:
else: else:
track.artistsString = ", ".join(track.artists) 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 # Generate filename and filepath from metadata
filename = generateFilename(track, trackAPI_gw, self.settings) filename = generateFilename(track, trackAPI_gw, self.settings)
(filepath, artistPath, coverPath, extrasPath) = generateFilepath(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.playlist['discTotal'] = "1"
self.mainArtistsString = andCommaConcat(self.artist['Main']) self.generateMainFeatStrings()
self.featArtistsString = None
if 'Featured' in self.artist:
self.featArtistsString = "feat. "+andCommaConcat(self.artist['Featured'])
# Bits useful for later # Bits useful for later
self.searched = False self.searched = False
@ -331,3 +328,9 @@ class Track:
if self.featArtistsString and not "(feat." in self.title.lower(): if self.featArtistsString and not "(feat." in self.title.lower():
return self.title + " ({})".format(self.featArtistsString) return self.title + " ({})".format(self.featArtistsString)
return self.title 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( setup(
name="deemix", name="deemix",
version="1.2.9", version="1.2.10",
description="A barebone deezer downloader library", description="A barebone deezer downloader library",
long_description=README, long_description=README,
long_description_content_type="text/markdown", long_description_content_type="text/markdown",