mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 20:43:04 +00:00
write path hash on image property
This commit is contained in:
+1
-1
@@ -54,7 +54,7 @@ class Album:
|
||||
self.fav_userids.append(userid)
|
||||
|
||||
def __post_init__(self):
|
||||
self.image = self.albumhash + ".webp"
|
||||
self.image = self.albumhash + ".webp" + "?pathhash=" + self.pathhash
|
||||
self.populate_versions()
|
||||
self.weakhash = create_hash(
|
||||
self.og_title, ",".join(a["name"] for a in self.albumartists)
|
||||
|
||||
+5
-3
@@ -52,12 +52,15 @@ class Track:
|
||||
image: str = ""
|
||||
explicit: bool = False
|
||||
fav_userids: list[int] = field(default_factory=list)
|
||||
pathhash: str = ""
|
||||
|
||||
@property
|
||||
def is_favorite(self):
|
||||
return get_current_userid() in self.fav_userids
|
||||
|
||||
@property
|
||||
def pathhash(self):
|
||||
return create_hash(self.folder)
|
||||
|
||||
def toggle_favorite_user(self, userid: int):
|
||||
"""
|
||||
Toggles the favorite status of the track for a given user.
|
||||
@@ -82,9 +85,8 @@ class Track:
|
||||
self.weakhash = create_hash(self.title, self.artists)
|
||||
explicit_tag = self.extra.get("explicit", ["0"])
|
||||
self.explicit = int(explicit_tag[0]) == 1
|
||||
self.pathhash = create_hash(self.folder)
|
||||
|
||||
self.image = self.albumhash + ".webp"
|
||||
self.image = self.albumhash + ".webp" + "?pathhash=" + self.pathhash
|
||||
self.extra = {
|
||||
"disc_total": self.extra.get("disc_total", 0),
|
||||
"track_total": self.extra.get("track_total", 0),
|
||||
|
||||
Reference in New Issue
Block a user