fix folder tracks being None

This commit is contained in:
geoffrey45
2022-06-08 14:24:26 +03:00
parent 7b41d91b83
commit 84bf467d9f
7 changed files with 16 additions and 17 deletions
-3
View File
@@ -119,9 +119,6 @@ def search_load_more():
type = request.args.get("type")
index = int(request.args.get("index"))
print(type, index)
print(len(SEARCH_RESULTS["tracks"]))
if type == "tracks":
return {
"tracks": SEARCH_RESULTS["tracks"][index:index + 5],
+2 -5
View File
@@ -62,11 +62,8 @@ def find_album(albums: List[models.Album], hash: str) -> int | None:
while left <= right:
mid = (left + right) // 2
try:
if albums[mid].hash == hash:
return mid
except AttributeError:
print(albums)
if albums[mid].hash == hash:
return mid
if albums[mid].hash < hash:
left = mid + 1
+4 -2
View File
@@ -104,7 +104,9 @@ class getFnF:
"""
Returns a list of Track objects for each file in the given list.
"""
return helpers.UseBisection(api.TRACKS, "filepath", files)()
tracks = helpers.UseBisection(api.TRACKS, "filepath", files)()
tracks = filter(lambda t: t is not None, tracks)
return list(tracks)
def __call__(self) -> Tuple[Track, Folder]:
try:
@@ -128,4 +130,4 @@ class getFnF:
folders = [create_folder(dir) for dir in dirs]
folders = filter(lambda f: f.trackcount > 0, folders)
return (tracks, folders)
return tracks, folders
-1
View File
@@ -14,7 +14,6 @@ def date_string_to_time_passed(prev_date: str) -> str:
diff = now - then
days = diff.days
print(days)
if days < 0:
return "in the future"