small fixes

This commit is contained in:
2025-05-04 21:15:28 +02:00
parent b778a1c3f9
commit 1f5b678139
2 changed files with 24 additions and 9 deletions
+3 -3
View File
@@ -50,10 +50,10 @@ if platform in ("linux", "linux2"):
else: else:
LOGFILE = "/home/pi/Conjurer/discord_mus_service.log" LOGFILE = "/home/pi/Conjurer/discord_mus_service.log"
NETRC_FILE = "/home/pi/.netrc" NETRC_FILE = "/home/pi/.netrc"
LOGSTORE = "/home/pi/MediaShare/logs/" LOGSTORE = "/home/pi/MediaFolder/logs/"
ENCODING = "utf-8" ENCODING = "utf-8"
MUSIC_FOLDER = "/home/pi/MediaShare/mp3/" MUSIC_FOLDER = "/home/pi/MediaFolder/mp3/"
PRIORITY_FOLDER = "/home/pi/MediaShare/mp3/Magiczne i chuj/" PRIORITY_FOLDER = "/home/pi/MediaFoldermp3/Magiczne i chuj/"
RADIOLOG_PATH = "/home/pi/Conjurer/radio_log.log" RADIOLOG_PATH = "/home/pi/Conjurer/radio_log.log"
PERSISTENCE_PATH = "/home/pi/Conjurer/persistence.log" PERSISTENCE_PATH = "/home/pi/Conjurer/persistence.log"
+21 -6
View File
@@ -43,6 +43,22 @@ def queue_processing()
end end
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 # Randomly select a playlist with weights
s4 = random(id="randomizer", weights=[2, 3, 5], [s1, s2, s3]) 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 # Create the main stream with random playlist and jingles
s = rotate(id="randomizer", weights=[10, 1], [s4, 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 # Set up an interactive harbor for controlling the stream
interactive.harbor(port = 9999) interactive.harbor(port = 9999)
@@ -87,7 +104,7 @@ s = blank.skip(max_blank=10., s)
live_enabled = interactive.bool("Going Live!", true) live_enabled = interactive.bool("Going Live!", true)
s = add([mic,s]) s = add([mic,s])
s=switch(track_sensitive=false, s=switch(track_sensitive=true,
[(live_enabled, mic), [(live_enabled, mic),
({true}, s)]) ({true}, s)])
@@ -102,9 +119,8 @@ set("log.level", loglevel)
# Enable logging to file # Enable logging to file
set("log.file", log_to_file) set("log.file", log_to_file)
set("log.file.path", logpath) set("log.file.path", logpath)
# Set up emergency fallback track # 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]) radio = fallback(id="switcher2", track_sensitive=false, [s, emergency])
# Set up an interactive control for skipping tracks # Set up an interactive control for skipping tracks
@@ -138,8 +154,7 @@ interactive.persistent("script.params")
# Configure output formats and destinations # Configure output formats and destinations
output.icecast(%mp3, host="radio", port=8000, password=credentials.password, icy_metadata="true", mount="mp3-stream", radio)
output.icecast(%mp3, host="retropie", port=8000, password=credentials.password, icy_metadata="true", mount="mp3-stream", radio)
output.pulseaudio(radio) output.pulseaudio(radio)
#output.file.hls("/tmp/hls", [("mp3-low", %mp3(bitrate=96)), ("mp3-hi", %mp3(bitrate=160))], 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 # Uncomment the following lines to enable additional output formats