•
Listen to America's original comment section - Record C-Span's Washington Journal call-in show via ffmpeg
2 minutes read •
Over the last 3-6 months or so, I have listened to the radio more frequently as I multi-task or unwind, but I've listened since I was little. There's something especially great about online-radio and being to listen-in from hundreds of miles away. It sounds washed but I've started listening to C-Span occasionally as of late. Maybe it's the unfiltered perspectives or opinions seem realer when it's a person saying them aloud? C-Span's call-in show is broadcasted on TV, but it's like 6am in the morning, and TV doesn't allow multi-tasking anyways.
Here's my config. It took a bit of tweaking over a week or two, but now it is at set-it-and-forget-it status.
cspan.service
[Unit]
Description=Script to record C-Span show daily
[Service]
ExecStart=/bin/bash -c 'TMPFILE="/tmp/cspan_$(date +%%Y-%%m-%%d).opus" && OUTFILE="path/to/dir/_$(date +%%Y-%%m-%%d).opus" && ffmpeg -i https://playerservices.streamtheworld.c
om/api/livestream-redirect/CSPANRADIO.mp3 -t 12600 -c:a libopus -b:a 64k "$TMPFILE" && mv "$TMPFILE" "$OUTFILE"'- I use opus because it seems to be the best audio codec, while being open-source and solid even at smaller bitrates.
- Originally, I saved the file directly to the folder that I planned on storing the file, but ran into issues when playing the file... Things like fast-forwarding/rewinding in Audiobookshelf would break and restart the episode. I think it's related to Audiobookshelf reading the file's metadata before it finished being created or something? Now, the file is saved in
/tmp/initially and then moved to the proper folder - Sometimes the show goes late and they take extra calls, so I record 3.5 hours status.
- Each recording is approximately 115M.
cspan.timer
[Unit]
Description=Record C-SPAN daily
[Timer]
OnCalendar=*-*-* 06:00:00
Persistent=true
[Install]
WantedBy=timers.target- Run the app daily @ 6am (CDT)
Persistent=truemeans that if the server got rebooted and turned on after 6am, the timer would still trigger
cspanCleanup (Service @ top, Timer @ bottom)
Since the show is covering the political topic-du-jour, the episodes become stale quickly. I delete episodes older than 5 days (and usually skip episodes older than 3 days old)
# Service File
[Unit]
Description=Create backups daily & delete backups older than 5 days
[Service]
Type=oneshot
ExecStart=/bin/bash -c '/usr/bin/fdfind -d1 CSPAN --changed-before 5d /path/to/cSpan/ -x /home/username/.local/bin/trash-cli/trash {}'
--------------------------------------------------------------------------------
# Timer File
[Unit]
Description=Daily run of the service file @ 6pm
[Timer]
OnCalendar= *-*-* 18:00:00
Persistent=true
[Install]
WantedBy=timers.target