mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 04:53:01 +00:00
rewrite search functions as classes
This commit is contained in:
+20
-1
@@ -32,8 +32,11 @@ class Track:
|
||||
albumhash: str
|
||||
|
||||
def __init__(self, tags):
|
||||
try:
|
||||
self.trackid = tags["_id"]["$oid"]
|
||||
except KeyError:
|
||||
print(tags)
|
||||
|
||||
self.trackid = tags["_id"]["$oid"]
|
||||
self.title = tags["title"]
|
||||
self.artists = tags["artists"].split(", ")
|
||||
self.albumartist = tags["albumartist"]
|
||||
@@ -49,6 +52,22 @@ class Track:
|
||||
self.albumhash = tags["albumhash"]
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
class Artist:
|
||||
"""
|
||||
Artist class
|
||||
"""
|
||||
|
||||
artistid: str
|
||||
name: str
|
||||
image: str
|
||||
|
||||
def __init__(self, tags):
|
||||
self.artistid = tags["_id"]["$oid"]
|
||||
self.name = tags["name"]
|
||||
self.image = tags["image"]
|
||||
|
||||
|
||||
@dataclass
|
||||
class Album:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user