Skip to content
This repository has been archived by the owner on Jul 18, 2022. It is now read-only.

Commit

Permalink
Album art patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Marekkon5 committed Feb 19, 2021
1 parent 973768e commit 2071f80
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion beatport.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,13 @@ def __init__(self, data: dict):
self.publish_date = datetime.datetime.strptime(data['date']['published'], '%Y-%m-%d')

def art(self, resolution: int):
return self._art.replace('{x}', str(resolution)).replace('{y}', str(resolution)).replace('{w}', str(resolution)).replace('{h}', str(resolution))
if '{x}' in self._art or '{w}' in self._art:
return self._art.replace('{x}', str(resolution)).replace('{y}', str(resolution)).replace('{w}', str(resolution)).replace('{h}', str(resolution))
if '/image_size/' not in self._art:
return self._art

#Parse non-dynamic dynamic image
return re.sub(r'\/image_size\/\d+x\d+\/', f'/image_size/{resolution}x{resolution}/', self._art)

#Convert Beatport key to ID3
def id3key(self):
Expand Down

0 comments on commit 2071f80

Please sign in to comment.