handle favorites on recently played

+ use client side timestamp on track logger
This commit is contained in:
mungai-njoroge
2023-12-10 13:27:54 +03:00
parent 312df06fc3
commit 4412902312
6 changed files with 44 additions and 22 deletions
+23 -13
View File
@@ -3,6 +3,7 @@ from app.models.logger import Track as TrackLog
from app.db.sqlite.logger.tracks import SQLiteTrackLogger as db
from app.db.sqlite.playlists import SQLitePlaylistMethods as pdb
from app.db.sqlite.favorite import SQLiteFavoriteMethods as fdb
from app.serializers.track import serialize_track
from app.serializers.album import album_serializer
@@ -66,19 +67,6 @@ def get_recently_played(limit=7):
continue
if entry.type == "track":
try:
track = TrackStore.get_tracks_by_trackhashes([entry.trackhash])[0]
except IndexError:
continue
track = serialize_track(track)
track["help_text"] = "track"
items.append({"type": "track", "item": track})
continue
if entry.type == "folder":
folder = entry.type_src
if not folder:
@@ -141,4 +129,26 @@ def get_recently_played(limit=7):
}
)
if entry.type == "favorite":
items.append(
{
"type": "favorite_tracks",
"item": {
"help_text": "playlist",
"count": fdb.get_track_count(),
},
}
)
continue
try:
track = TrackStore.get_tracks_by_trackhashes([entry.trackhash])[0]
except IndexError:
continue
track = serialize_track(track)
track["help_text"] = "track"
items.append({"type": "track", "item": track})
return items