Merge pull request 'Rebase with upstream' (#1) from RemixDev/deemix-py:main into main

Reviewed-on: https://git.freezerapp.xyz/omtinez/deemix-py/pulls/1
This commit is contained in:
omtinez 2022-01-04 15:17:01 -05:00
commit 7fe430b77f
4 changed files with 14 additions and 11 deletions

View File

@ -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):

View File

@ -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'):

View File

@ -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

View File

@ -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",