Sort randomly directly in SQLite
This commit is contained in:
parent
220c68f38b
commit
14c2ea65db
@ -181,9 +181,8 @@ def main(queue_length):
|
|||||||
|
|
||||||
# Get all other songs coordinates and iterate randomly on them
|
# Get all other songs coordinates and iterate randomly on them
|
||||||
closest_song = None
|
closest_song = None
|
||||||
cur.execute("SELECT id, tempo1, tempo2, tempo3, amplitude, frequency, attack, filename FROM songs")
|
cur.execute("SELECT id, tempo1, tempo2, tempo3, amplitude, frequency, attack, filename FROM songs ORDER BY RANDOM()")
|
||||||
songs = random.shuffle([song for song in cur.fetchall()])
|
for tmp_song_data in cur.fetchall():
|
||||||
for tmp_song_data in songs:
|
|
||||||
if(tmp_song_data["filename"] == current_song_coords["filename"] or
|
if(tmp_song_data["filename"] == current_song_coords["filename"] or
|
||||||
tmp_song_data["filename"] in cached_distances_songs or
|
tmp_song_data["filename"] in cached_distances_songs or
|
||||||
("file: %s" % (tmp_song_data["filename"],)) in client.playlist()):
|
("file: %s" % (tmp_song_data["filename"],)) in client.playlist()):
|
||||||
|
Loading…
Reference in New Issue
Block a user