mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 20:43:04 +00:00
fix removing duplicate tracks
- add uniq_hash prop to Track class
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user