fix removing duplicate tracks

- add uniq_hash prop to Track class
This commit is contained in:
geoffrey45
2022-06-26 18:46:17 +03:00
parent abbca285f0
commit 92ef22596b
6 changed files with 57 additions and 98 deletions
+12
View File
@@ -29,6 +29,7 @@ class Track:
albumhash: str
date: str
image: str
uniq_hash: str
def __init__(self, tags):
self.trackid = tags["_id"]["$oid"]
@@ -47,6 +48,17 @@ class Track:
self.image = tags["albumhash"] + ".webp"
self.tracknumber = int(tags["tracknumber"])
self.uniq_hash = self.create_unique_hash(
"".join(self.artists), self.album, self.title
)
@staticmethod
def create_unique_hash(*args):
ill_chars = '/\\:*?"<>|#&'
string = "".join(str(a) for a in args).replace(" ", "")
return "".join(string).strip(ill_chars).lower()
@dataclass(slots=True)
class Artist: