From 1f5b67813976a9e0cde1c664cb874195b2bae5f7 Mon Sep 17 00:00:00 2001 From: Polish Hammer Date: Sun, 4 May 2025 21:15:28 +0200 Subject: [PATCH] small fixes --- conjurer_musician/conjurer_musician.py | 6 +++--- conjurer_musician/radio_conjurer.liq | 27 ++++++++++++++++++++------ 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/conjurer_musician/conjurer_musician.py b/conjurer_musician/conjurer_musician.py index 12bcf5d..548e90e 100644 --- a/conjurer_musician/conjurer_musician.py +++ b/conjurer_musician/conjurer_musician.py @@ -50,10 +50,10 @@ if platform in ("linux", "linux2"): else: LOGFILE = "/home/pi/Conjurer/discord_mus_service.log" NETRC_FILE = "/home/pi/.netrc" - LOGSTORE = "/home/pi/MediaShare/logs/" + LOGSTORE = "/home/pi/MediaFolder/logs/" ENCODING = "utf-8" - MUSIC_FOLDER = "/home/pi/MediaShare/mp3/" - PRIORITY_FOLDER = "/home/pi/MediaShare/mp3/Magiczne i chuj/" + MUSIC_FOLDER = "/home/pi/MediaFolder/mp3/" + PRIORITY_FOLDER = "/home/pi/MediaFoldermp3/Magiczne i chuj/" RADIOLOG_PATH = "/home/pi/Conjurer/radio_log.log" PERSISTENCE_PATH = "/home/pi/Conjurer/persistence.log" diff --git a/conjurer_musician/radio_conjurer.liq b/conjurer_musician/radio_conjurer.liq index d536607..b28c947 100644 --- a/conjurer_musician/radio_conjurer.liq +++ b/conjurer_musician/radio_conjurer.liq @@ -43,6 +43,22 @@ def queue_processing() end end +# Configure output formats and destinations +def now_playing(m) + # raw lookup ("" if missing) + raw_title = m["title"] + raw_artist = m["artist"] + + # default if empty + title = if raw_title == "" then "Unknown" else raw_title end + artist = if raw_artist == "" then "Unknown" else raw_artist end + log.critical("Now playing #{artist} - #{title}") + # write it out + system("echo '#{artist} - #{title}' > /tmp/now_playing.txt") + m +end + + # Randomly select a playlist with weights s4 = random(id="randomizer", weights=[2, 3, 5], [s1, s2, s3]) @@ -52,7 +68,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=[10, 1], [s4, jingles]) -s = crossfade(fade_out=2., fade_in=2., duration=4., fallback(id="switcher", track_sensitive=false, [requests_queue, s])) +s = crossfade(fade_out=2., fade_in=2., duration=4., fallback(id="switcher", track_sensitive=true, [requests_queue, s])) +s = metadata.map(now_playing, s) # Set up an interactive harbor for controlling the stream interactive.harbor(port = 9999) @@ -87,7 +104,7 @@ s = blank.skip(max_blank=10., s) live_enabled = interactive.bool("Going Live!", true) s = add([mic,s]) -s=switch(track_sensitive=false, +s=switch(track_sensitive=true, [(live_enabled, mic), ({true}, s)]) @@ -102,9 +119,8 @@ set("log.level", loglevel) # Enable logging to file 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") +emergency = single("/home/pi/MediaFolder/mp3/Youtube/Dr. Peacock - Trip to Ireland [GvrvQTUbUcA].mp3") radio = fallback(id="switcher2", track_sensitive=false, [s, emergency]) # Set up an interactive control for skipping tracks @@ -138,8 +154,7 @@ interactive.persistent("script.params") # Configure output formats and destinations - -output.icecast(%mp3, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="mp3-stream", radio) +output.icecast(%mp3, host="radio", port=8000, password=credentials.password, icy_metadata="true", mount="mp3-stream", radio) output.pulseaudio(radio) #output.file.hls("/tmp/hls", [("mp3-low", %mp3(bitrate=96)), ("mp3-hi", %mp3(bitrate=160))], radio) # Uncomment the following lines to enable additional output formats