mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-03 20:13:02 +00:00
move to xxh3 hashing algorithm
+ port: search
This commit is contained in:
+6
-12
@@ -5,6 +5,7 @@ from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from app import settings
|
||||
from app.utils.auth import get_current_userid
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
@@ -16,10 +17,10 @@ class Playlist:
|
||||
last_updated: str
|
||||
name: str
|
||||
settings: dict
|
||||
userid: int
|
||||
trackhashes: list[str]
|
||||
trackhashes: list[str] = dataclasses.field(default_factory=list)
|
||||
extra: dict[str, Any] = dataclasses.field(default_factory=dict)
|
||||
|
||||
userid: int | None = None
|
||||
thumb: str = ""
|
||||
count: int = 0
|
||||
duration: int = 0
|
||||
@@ -28,11 +29,10 @@ class Playlist:
|
||||
pinned: bool = False
|
||||
|
||||
def __post_init__(self):
|
||||
# self.trackhashes = json.loads(str(self.trackhashes))
|
||||
# self.count = len(self.trackhashes)
|
||||
self.count = len(self.trackhashes)
|
||||
|
||||
# if isinstance(self.settings, str):
|
||||
# self.settings = dict(json.loads(self.settings))
|
||||
if self.userid is None:
|
||||
self.userid = get_current_userid()
|
||||
|
||||
self.pinned = self.settings.get("pinned", False)
|
||||
self.has_image = (
|
||||
@@ -45,12 +45,6 @@ class Playlist:
|
||||
self.image = "None"
|
||||
self.thumb = "None"
|
||||
|
||||
# def set_duration(self, duration: int):
|
||||
# self.duration = duration
|
||||
|
||||
# def set_count(self, count: int):
|
||||
# self.count = count
|
||||
|
||||
def clear_lists(self):
|
||||
"""
|
||||
Removes data from lists to make it lighter for sending
|
||||
|
||||
Reference in New Issue
Block a user