fix get playlist tracks order

+ fix utils.get_home_res_path
This commit is contained in:
geoffrey45
2023-03-15 10:01:12 +03:00
parent 64bb4f75df
commit d21a834a00
7 changed files with 62 additions and 15 deletions
+10 -1
View File
@@ -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