Fix IndexError due to closest song
This commit is contained in:
parent
71901718ce
commit
eb420eb7a8
@ -168,9 +168,12 @@ def main(queue_length):
|
|||||||
if ("file: %s" % (row["filename"],)) not in client.playlist()]
|
if ("file: %s" % (row["filename"],)) not in client.playlist()]
|
||||||
cached_distances_songs = [i["filename"] for i in cached_distances]
|
cached_distances_songs = [i["filename"] for i in cached_distances]
|
||||||
# Keep track of closest song
|
# Keep track of closest song
|
||||||
closest_song = (cached_distances[0],
|
if cached_distances:
|
||||||
cached_distances[0]["distance"],
|
closest_song = (cached_distances[0],
|
||||||
cached_distances[1]["similarity"])
|
cached_distances[0]["distance"],
|
||||||
|
cached_distances[1]["similarity"])
|
||||||
|
else:
|
||||||
|
closest_song = None
|
||||||
|
|
||||||
# Get the songs close enough
|
# Get the songs close enough
|
||||||
cached_distances_close_enough = [
|
cached_distances_close_enough = [
|
||||||
|
Loading…
Reference in New Issue
Block a user