diff --git a/deemix/__init__.py b/deemix/__init__.py index 5444f12..c27354f 100644 --- a/deemix/__init__.py +++ b/deemix/__init__.py @@ -10,7 +10,7 @@ from deemix.itemgen import generateTrackItem, \ generateArtistTopItem from deemix.errors import LinkNotRecognized, LinkNotSupported -__version__ = "3.6.3" +__version__ = "3.6.4" # Returns the Resolved URL, the Type and the ID def parseLink(link): diff --git a/deemix/types/Album.py b/deemix/types/Album.py index e95dae4..9fee6f1 100644 --- a/deemix/types/Album.py +++ b/deemix/types/Album.py @@ -94,7 +94,7 @@ class Album: self.discTotal = albumAPI.get('nb_disk', "1") self.copyright = albumAPI.get('copyright', "") - if self.pic.md5 == "": + if not self.pic.md5 or self.pic.md5 == "": if albumAPI.get('md5_image'): self.pic.md5 = albumAPI['md5_image'] elif albumAPI.get('cover_small'): diff --git a/deemix/utils/__init__.py b/deemix/utils/__init__.py index cfb4e64..ff46ce6 100644 --- a/deemix/utils/__init__.py +++ b/deemix/utils/__init__.py @@ -35,9 +35,9 @@ def changeCase(txt, case_type): if case_type == "upper": return txt.upper() if case_type == "start": - txt = txt.split(" ") + txt = txt.strip().split(" ") for i, word in enumerate(txt): - if word[0] in ['(', '{', '[']: + if word[0] in ['(', '{', '[', "'", '"']: txt[i] = word[0] + word[1:].capitalize() else: txt[i] = word.capitalize() @@ -50,17 +50,20 @@ def removeFeatures(title): clean = title found = False pos = -1 - if re.search(r"[\s(]?feat\.?\s", clean): - pos = re.search(r"[\s(]?feat\.?\s", clean).start(0) + if re.search(r"[\s(]\(?\s?feat\.?\s", clean): + pos = re.search(r"[\s(]\(?\s?feat\.?\s", clean).start(0) found = True - if re.search(r"[\s(]?ft\.?\s", clean): - pos = re.search(r"[\s(]?ft\.?\s", clean).start(0) + if re.search(r"[\s(]\(?\s?ft\.?\s", clean): + pos = re.search(r"[\s(]\(?\s?ft\.?\s", clean).start(0) found = True - openBracket = clean[pos] == '(' + openBracket = clean[pos] == '(' or clean[pos+1] == '(' + otherBracket = clean.find('(', pos+2) if found: tempTrack = clean[:pos] if ")" in clean and openBracket: - tempTrack += clean[clean.find(")", pos + 1) + 1:] + tempTrack += clean[clean.find(")", pos+2) + 1:] + if not openBracket and otherBracket != -1: + tempTrack += f" {clean[otherBracket:]}" clean = tempTrack.strip() clean = ' '.join(clean.split()) return clean diff --git a/setup.py b/setup.py index 49400f4..87af2dc 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ README = (HERE / "README.md").read_text() setup( name="deemix", - version="3.6.3", + version="3.6.4", description="A barebone deezer downloader library", long_description=README, long_description_content_type="text/markdown",