mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-03 20:13:02 +00:00
add item counts
This commit is contained in:
+3
-3
@@ -123,15 +123,13 @@ def get_folder_tree(body: FolderTree):
|
|||||||
reverse=True,
|
reverse=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
for playlist in playlists:
|
|
||||||
playlist.clear_lists()
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"path": req_dir,
|
"path": req_dir,
|
||||||
"folders": [
|
"folders": [
|
||||||
{
|
{
|
||||||
"name": p.name,
|
"name": p.name,
|
||||||
"path": f"$playlist/{p.id}",
|
"path": f"$playlist/{p.id}",
|
||||||
|
"trackcount": p.count,
|
||||||
}
|
}
|
||||||
for p in playlists
|
for p in playlists
|
||||||
],
|
],
|
||||||
@@ -172,11 +170,13 @@ def get_folder_tree(body: FolderTree):
|
|||||||
playlists_item = {
|
playlists_item = {
|
||||||
"name": "Playlists",
|
"name": "Playlists",
|
||||||
"path": "$playlists",
|
"path": "$playlists",
|
||||||
|
"trackcount": sum(p.count for p in PlaylistTable.get_all()),
|
||||||
}
|
}
|
||||||
|
|
||||||
favorites_item = {
|
favorites_item = {
|
||||||
"name": "Favorites",
|
"name": "Favorites",
|
||||||
"path": "$favorites",
|
"path": "$favorites",
|
||||||
|
"trackcount": FavoritesTable.get_fav_tracks(0, -1)[1],
|
||||||
}
|
}
|
||||||
|
|
||||||
results["folders"].insert(0, playlists_item)
|
results["folders"].insert(0, playlists_item)
|
||||||
|
|||||||
Reference in New Issue
Block a user