Initial commit: Radio Susan scripts, configs, and SFX

This commit is contained in:
Caine
2026-03-07 12:52:55 +00:00
commit 01682c62c2
30 changed files with 2856 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
#!/usr/bin/env python3
"""One-off: generate playlist for remaining hours tonight.
Unlike the full generator, this resets start_time to 0 so Liquidsoap
plays from the top immediately instead of seeking to a time offset."""
import sys, time, json, os
sys.path.insert(0, os.path.dirname(__file__))
from generate_daily_playlist import build_playlist, write_outputs
playlist = build_playlist()
if not playlist:
sys.exit(1)
now_secs = time.localtime().tm_hour * 3600 + time.localtime().tm_min * 60
entries = [e for e in playlist["entries"] if e["start_time"] >= now_secs]
# Rebase start times to 0 so the playlist plays sequentially from the top
offset = entries[0]["start_time"] if entries else 0
for e in entries:
e["start_time"] = round(e["start_time"] - offset, 1)
h = int(e["start_time"] // 3600)
m = int((e["start_time"] % 3600) // 60)
s = int(e["start_time"] % 60)
e["start_formatted"] = f"{h:02d}:{m:02d}:{s:02d}"
playlist["entries"] = entries
playlist["total_tracks"] = sum(1 for e in entries if e["type"] == "track")
playlist["total_entries"] = len(entries)
write_outputs(playlist)
ann_count = sum(1 for e in entries if e["type"] == "announcement")
jingle_count = sum(1 for e in entries if e["type"] == "jingle")
print(f"Tonight: {playlist['total_tracks']} tracks, {ann_count} announcements, {jingle_count} jingles from {now_secs/3600:.1f}h onwards")