refactor most things to use the database directly

This commit is contained in:
geoffrey45
2022-06-13 14:45:18 +03:00
parent f1ec6309ba
commit 030ab8a379
18 changed files with 237 additions and 365 deletions
+6 -15
View File
@@ -95,18 +95,9 @@ def search():
return {
"data": [
{
"tracks": tracks[:5],
"more": len(tracks) > 5
},
{
"albums": albums[:6],
"more": len(albums) > 6
},
{
"artists": artists_dicts[:6],
"more": len(artists_dicts) > 6
},
{"tracks": tracks[:5], "more": len(tracks) > 5},
{"albums": albums[:6], "more": len(albums) > 6},
{"artists": artists_dicts[:6], "more": len(artists_dicts) > 6},
]
}
@@ -121,18 +112,18 @@ def search_load_more():
if type == "tracks":
return {
"tracks": SEARCH_RESULTS["tracks"][index:index + 5],
"tracks": SEARCH_RESULTS["tracks"][index : index + 5],
"more": len(SEARCH_RESULTS["tracks"]) > index + 5,
}
elif type == "albums":
return {
"albums": SEARCH_RESULTS["albums"][index:index + 6],
"albums": SEARCH_RESULTS["albums"][index : index + 6],
"more": len(SEARCH_RESULTS["albums"]) > index + 6,
}
elif type == "artists":
return {
"artists": SEARCH_RESULTS["artists"][index:index + 6],
"artists": SEARCH_RESULTS["artists"][index : index + 6],
"more": len(SEARCH_RESULTS["artists"]) > index + 6,
}