Browse Source

don't freak out when the queue is totally empty, as can happen when the music path is invalid or empty

Daniel Peter Chokola 3 weeks ago
parent
commit
c0d664a9e4
  1. 4
      music-api.py

4
music-api.py

@ -668,7 +668,7 @@ def worker():
# Repeat_one: loop the first track # Repeat_one: loop the first track
if repeat_mode == "repeat_one": if repeat_mode == "repeat_one":
with queue_lock: with queue_lock:
current_track = queue[0] current_track = queue[0] if queue else None
path_current = os.path.join(MUSIC_DIR, current_track) path_current = os.path.join(MUSIC_DIR, current_track)
set_rds(f"RT {current_track}") set_rds(f"RT {current_track}")
played_ok = stream_file(path_current) played_ok = stream_file(path_current)
@ -680,7 +680,7 @@ def worker():
# Normal / repeat_all # Normal / repeat_all
with queue_lock: with queue_lock:
current_track = queue[0] current_track = queue[0] if queue else None
path_current = os.path.join(MUSIC_DIR, current_track) path_current = os.path.join(MUSIC_DIR, current_track)
set_rds(f"RT {current_track}") set_rds(f"RT {current_track}")

Loading…
Cancel
Save