fix: errors raised by Pycharm

This commit is contained in:
geoffrey45
2023-02-01 14:00:21 +03:00
parent 95c1524b68
commit 838e19cf0f
14 changed files with 20 additions and 49 deletions
+2 -3
View File
@@ -48,9 +48,9 @@ class ArtistsCache:
"""
for (index, albums) in enumerate(cls.artists):
if albums.artisthash == artisthash:
return (albums.albums, index)
return albums.albums, index
return ([], -1)
return [], -1
@classmethod
def albums_cached(cls, artisthash: str) -> bool:
@@ -214,7 +214,6 @@ def get_artist_albums(artisthash: str):
limit = int(limit)
all_albums = []
is_cached = ArtistsCache.albums_cached(artisthash)
if not is_cached:
+1 -7
View File
@@ -22,6 +22,7 @@ def get_folder_tree():
Returns a list of all the folders and tracks in the given folder.
"""
data = request.get_json()
req_dir = "$home"
if data is not None:
try:
@@ -60,7 +61,6 @@ def get_folder_tree():
else:
req_dir = "/" + req_dir + "/" if not req_dir.startswith("/") else req_dir + "/"
print(req_dir)
tracks, folders = GetFilesAndDirs(req_dir)()
return {
@@ -127,9 +127,3 @@ def list_folders():
return {
"folders": sorted(dirs, key=lambda i: i["name"]),
}
# todo:
# - handle showing windows disks in root_dir configuration
# - handle the above, but for all partitions mounted in linux.
# - handle the "\" in client's folder page breadcrumb
+1 -1
View File
@@ -97,7 +97,7 @@ def add_track_to_playlist(playlist_id: str):
return {"error": "Track already exists in playlist"}, 409
add_artist_to_playlist(int(playlist_id), trackhash)
PL.update_last_updated(playlist_id)
PL.update_last_updated(int(playlist_id))
return {"msg": "Done"}, 200
+3 -3
View File
@@ -199,20 +199,20 @@ def search_load_more():
if s_type == "tracks":
t = SearchResults.tracks
return {
"tracks": t[index : index + SEARCH_COUNT],
"tracks": t[index: index + SEARCH_COUNT],
"more": len(t) > index + SEARCH_COUNT,
}
elif s_type == "albums":
a = SearchResults.albums
return {
"albums": a[index : index + SEARCH_COUNT],
"albums": a[index: index + SEARCH_COUNT],
"more": len(a) > index + SEARCH_COUNT,
}
elif s_type == "artists":
a = SearchResults.artists
return {
"artists": a[index : index + SEARCH_COUNT],
"artists": a[index: index + SEARCH_COUNT],
"more": len(a) > index + SEARCH_COUNT,
}