fix: remove favorite tracks whose values are None when getting favs

+ sync is_fav state when populating
This commit is contained in:
geoffrey45
2023-01-24 02:10:58 +03:00
parent 22fa3eef40
commit 29e61b31c3
6 changed files with 46 additions and 23 deletions
+8 -6
View File
@@ -57,18 +57,19 @@ def add_root_dirs():
# ---
db_dirs = sdb.get_root_dirs()
_h = "$home"
if db_dirs[0] == "$home" and new_dirs[0] == "$home".strip():
if db_dirs[0] == _h and new_dirs[0] == _h.strip():
return {"msg": "Not changed!"}
if db_dirs[0] == "$home":
if db_dirs[0] == _h:
sdb.remove_root_dirs(db_dirs)
try:
if new_dirs[0] == "$home":
finalize(["$home"], db_dirs, [settings.USER_HOME_DIR])
if new_dirs[0] == _h:
finalize([_h], db_dirs, [settings.USER_HOME_DIR])
return {"msg": "Updated!"}
return {"root_dirs": [_h]}
except IndexError:
pass
@@ -84,10 +85,11 @@ def add_root_dirs():
pass
db_dirs.extend(new_dirs)
db_dirs = [dir for dir in db_dirs if dir != _h]
finalize(new_dirs, removed_dirs, db_dirs)
return {"msg": "Updated!"}
return {"root_dirs": db_dirs}
@api.route("/settings/get-root-dirs", methods=["GET"])