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"
+4 -2
View File
@@ -27,6 +27,7 @@ $gray5: rgb(44, 44, 46);
$red: #FF453A;
$blue: #0A84FF;
$darkblue: #055ee2;
$green: rgb(20, 160, 55);
$yellow: rgb(255, 214, 10);
$orange: rgb(255, 159, 10);
@@ -36,9 +37,10 @@ $brown: rgb(172, 142, 104);
$indigo: #5E5CE6;
$teal: rgb(64, 200, 224);
// 60 30 10
$primary: $gray4;
$accent: $indigo;
$accent: $darkblue;
$secondary: $gray5;
$cta: $blue;
$danger: $red;
$track-hover: $gray4;
+2
View File
@@ -131,10 +131,12 @@ a {
#acontent {
grid-area: content;
width: 100%;
max-width: 1504px;
padding: $small;
padding-left: 0;
overflow: auto;
margin: 0 auto;
.nav {
margin: $small;
+4 -4
View File
@@ -10,13 +10,13 @@
</div>
<div class="songlist">
<SongItem
v-for="(song, index) in tracks"
:key="song.trackid"
:song="song"
v-for="(track, index) in tracks"
:key="track.trackid"
:song="track"
:index="index + 1"
@updateQueue="updateQueue"
:isPlaying="queue.playing"
:isCurrent="queue.current.trackid == song.trackid"
:isCurrent="queue.current.trackid == track.trackid"
/>
</div>
</div>