mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-03 20:13:02 +00:00
add routes to get all albums and artists with sort
+ rewrite load all albums + artist logic with itertools.groupby + add a function to convert seconds to string
This commit is contained in:
@@ -27,6 +27,7 @@ class Album:
|
||||
colors: list[str] = dataclasses.field(default_factory=list)
|
||||
date: str = ""
|
||||
|
||||
created_date: int = 0
|
||||
og_title: str = ""
|
||||
base_title: str = ""
|
||||
is_soundtrack: bool = False
|
||||
@@ -40,6 +41,7 @@ class Album:
|
||||
versions: list[str] = dataclasses.field(default_factory=list)
|
||||
|
||||
def __post_init__(self):
|
||||
self.title = self.title.strip()
|
||||
self.og_title = self.title
|
||||
self.image = self.albumhash + ".webp"
|
||||
|
||||
@@ -202,3 +204,12 @@ class Album:
|
||||
|
||||
dates = (int(t.date) for t in tracks if t.date)
|
||||
self.date = datetime.datetime.fromtimestamp(min(dates)).year
|
||||
|
||||
def set_count(self, count: int):
|
||||
self.count = count
|
||||
|
||||
def set_duration(self, duration: int):
|
||||
self.duration = duration
|
||||
|
||||
def set_created_date(self, created_date: int):
|
||||
self.created_date = created_date
|
||||
|
||||
@@ -36,6 +36,7 @@ class Artist(ArtistMinimal):
|
||||
duration: int = 0
|
||||
colors: list[str] = dataclasses.field(default_factory=list)
|
||||
is_favorite: bool = False
|
||||
created_date: float = 0.0
|
||||
|
||||
def __post_init__(self):
|
||||
super(Artist, self).__init__(self.name)
|
||||
@@ -51,3 +52,6 @@ class Artist(ArtistMinimal):
|
||||
|
||||
def set_colors(self, colors: list[str]):
|
||||
self.colors = colors
|
||||
|
||||
def set_created_date(self, created_date: float):
|
||||
self.created_date = created_date
|
||||
|
||||
Reference in New Issue
Block a user