Fixes to partymode and playlist retrival

This commit is contained in:
Kristy Fournier 2025-07-06 13:16:12 -04:00
parent 2d26d0d63a
commit d63847761c

View file

@ -73,9 +73,13 @@ def playQueuedSongs():
songNext = None songNext = None
player.stop() player.stop()
elif len(playlist)<1 and (partyMode == True): elif len(playlist)<1 and (partyMode == True):
fileofDB = sql.connect("songDatabase.db")
songDatabase = fileofDB.cursor()
songDatabase.execute("SELECT * FROM songs ORDER BY RANDOM() LIMIT 1;")
result = songDatabase.fetchall()
# adds the random songs for party mode # adds the random songs for party mode
# the above 2 means this only applies if (a song is playing (or paused)) and the queue is empty # the above 2 means this only applies if (a song is playing (or paused)) and the queue is empty
playlist.append(random.choice(songDatabaseList)["file"]) playlist.append(result[0][0])
# check for new songs every second # check for new songs every second
# I just didn't want to eat too much processing looping # I just didn't want to eat too much processing looping
time.sleep(1) time.sleep(1)
@ -174,7 +178,7 @@ def getPlaylist():
tempPlaylist.append({songNext:temp}) tempPlaylist.append({songNext:temp})
for i in playlist: for i in playlist:
songDatabase.execute("SELECT * FROM songs WHERE filename = ?",[i]) songDatabase.execute("SELECT * FROM songs WHERE filename = ?",[i])
result = songDatabase.fetchall() result = songDatabase.fetchall()[0]
k = { k = {
"title": result[1], "title": result[1],
"artist": result[2], "artist": result[2],