mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 04:23:01 +00:00
fix get playlist tracks order
+ fix utils.get_home_res_path
This commit is contained in:
+10
-1
@@ -1,5 +1,9 @@
|
||||
import dataclasses
|
||||
import json
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
from app import settings
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
@@ -18,13 +22,18 @@ class Playlist:
|
||||
thumb: str = ""
|
||||
count: int = 0
|
||||
duration: int = 0
|
||||
has_image: bool = False
|
||||
images: list[str] = dataclasses.field(default_factory=list)
|
||||
|
||||
def __post_init__(self):
|
||||
self.trackhashes = json.loads(str(self.trackhashes))
|
||||
self.artisthashes = json.loads(str(self.artisthashes))
|
||||
# self.artisthashes = json.loads(str(self.artisthashes))
|
||||
# commentted until we need it 👆
|
||||
self.artisthashes = []
|
||||
|
||||
self.count = len(self.trackhashes)
|
||||
self.has_gif = bool(int(self.has_gif))
|
||||
self.has_image = (Path(settings.PLAYLIST_IMG_PATH) / str(self.image)).exists()
|
||||
|
||||
if self.image is not None:
|
||||
self.thumb = "thumb_" + self.image
|
||||
|
||||
Reference in New Issue
Block a user