Small improvements

This commit is contained in:
2024-04-25 14:29:30 +02:00
parent 7c0de660fd
commit 3b232ac3d7
+11 -10
View File
@@ -40,9 +40,7 @@ def queue_processing()
file.remove("/home/pi/Conjurer/request.playlist")
f = file.open("/home/pi/Conjurer/request.playlist", create=true)
f.close()
log.info("done")
else
log.info("no requests")
log.info("Request queued")
end
end
@@ -55,6 +53,8 @@ jingles = (playlist(reload_mode="watch", "/home/pi/Conjurer/jingles.playlist"))
# Create the main stream with random playlist and jingles
s = rotate(id="randomizer", weights=[20, 1], [s4, jingles])
s = crossfade(fade_out=3., fade_in=3., duration=5., fallback(id="switcher", track_sensitive=false, [requests_queue, s]))
# Set up an interactive harbor for controlling the stream
interactive.harbor(port = 9999)
@@ -66,7 +66,7 @@ s = add([s, b])
# Set up interactive control for main volume
a = interactive.float("main_volume", min=0., max=20., 1.)
s = compress.multiband.interactive(bands=3, s)
s = compress.multiband.interactive(bands=7, s)
# Apply audio processing effects
s = nrj(normalize(s))
@@ -87,14 +87,15 @@ set("log.level", loglevel)
set("log.file", log_to_file)
set("log.file.path", logpath)
# Set up emergency fallback track
emergency = single("/home/pi/RetroPie/mp3/Youtube/Dr. Peacock - Trip to Ireland [GvrvQTUbUcA].mp3")
# Create a fallback stream with the main stream and emergency track
cross_s = crossfade(fade_out=3., fade_in=3., duration=5., fallback(id="switcher", track_sensitive=false, [requests_queue, s]))
radio = fallback(id="switcher2", track_sensitive=false, [cross_s, emergency])
radio = fallback(id="switcher2", track_sensitive=false, [s, emergency])
# Set up an interactive control for skipping tracks
p = interactive.bool("r1", false)
p = interactive.bool("Skip track", false)
# Function to process the request queue and skip the current track if requested
def check_skip()
@@ -106,7 +107,7 @@ def check_skip()
end
# Run the queue processing function every 60 seconds
thread.run(every=60., queue_processing)
thread.run(every=5., queue_processing)
# Run the check_skip function every 5 seconds