mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 04:53:01 +00:00
use setters to manipulate artist and playlist objects
This commit is contained in:
+12
-5
@@ -1,5 +1,5 @@
|
||||
import dataclasses
|
||||
import json
|
||||
import dataclasses
|
||||
from dataclasses import dataclass
|
||||
|
||||
from app.utils.hashing import create_hash
|
||||
@@ -33,11 +33,18 @@ class Artist(ArtistMinimal):
|
||||
colors: list[str] = dataclasses.field(default_factory=list)
|
||||
is_favorite: bool = False
|
||||
|
||||
def __post_init__(self):
|
||||
super(Artist, self).__init__(self.name)
|
||||
def __init__(self, name: str):
|
||||
super(Artist, self).__init__(name)
|
||||
self.colors = json.loads(str(self.colors))
|
||||
|
||||
def set_trackcount(self, count: int):
|
||||
self.trackcount = count
|
||||
|
||||
def set_albumcount(self, count: int):
|
||||
self.albumcount = count
|
||||
|
||||
def set_duration(self, duration: int):
|
||||
self.duration = duration
|
||||
|
||||
def set_colors(self, colors: list[str]):
|
||||
self.colors = colors
|
||||
|
||||
# TODO: Use inheritance to create the classes in this file.
|
||||
|
||||
Reference in New Issue
Block a user