Skip to main content

Puca (Radio and TV Recorder)

Puca is a Raspberry Pi in the lab that records Irish-language radio and TV around the clock for the speech corpus. Everything is copied to the lab NAS.

Address10.7.160.28 on the lab network (DHCP)
HardwareRaspberry Pi running Debian 13 (arm64); USB Hauppauge dualHD DVB-T tuner; external USB drive (about 2 TB) at /mnt/tv_storage
Playbookansible/puca/setup-puca.yml
Further notes in the repoansible/puca/README.md, manual-setup.md
Make targetssetup-puca PUCA_PAT=<github token>, or setup-puca-john (uses Github Puca PAT)

Access​

Puca is only reachable from inside the TCD network. SSH is key-only, as ansible-control, and UFW only allows SSH from a short list of source IPs.

Ansible normally runs from the lab machine setanta, which uses the key ~/.ssh/id_ed25519_ansible. The inventory (ansible/puca/inventory.ini) connects directly, without a jump host.

The allowed addresses are 134.226.24.37 (an admin workstation) and setanta, 134.226.72.202. Both use DHCP. If either address changes, update the "UFW — allow SSH from permitted control nodes only" task in setup-puca.yml, or that machine will be locked out.

What's recorded​

Radio. Five stations, each as its own systemd service (rte_recorder@<station>), running rte_recorder.py from the private phonlab-tcd/Radio-Archivist repo:

StationInstanceFormat
RTÉ Raidió na Gaeltachtarnag.m4a
RTÉ Radio 1radio1.m4a
RTÉ 2FM2fm.m4a
Raidió na Lifernal.mp3
Newstalknewstalk.mp3

Files go to /mnt/tv_storage/radio_storage/.

TV. tvheadend records TG4, RTÉ One and Cúla4 from Saorview. It keeps only the audio and subtitles, dropping the video to save space. Recordings go to /mnt/tv_storage/raw_recordings/. The tvheadend configuration (channels, muxes, recording rules) is in the repo under ansible/puca/files/tvheadend/.

Storage and the NAS​

  1. Recordings are written to the local USB drive first. A live TV capture can't cope with a network storage hiccup.
  2. Every hour, puca-nas-sync copies finished files (untouched for 15 minutes) to the lab NAS (134.226.90.69:/volume1/abair_NAS, mounted over NFS at /mnt/abair_NAS). It never deletes anything on the NAS.
  3. Every day at 04:30, puca-nas-prune trims the local drive to the newest 300 GB. It only deletes a file when a copy of the same size is confirmed on the NAS.

Clock​

The Pi has no real-time clock, and the lab network blocks NTP. htpdate sets the time over HTTPS from a few public sites, at boot and then once a day. tvheadend is set to start after this, because a wrong clock makes recordings line up with the wrong programmes.

Monitoring​

Puca checks recordings by file size. Radio and audio-only TV have a near-constant bitrate, so size is a good stand-in for duration. Every 15 minutes, puca-recording-check (radio) and puca-tv-recording-check (TV) compare the files against the schedule. They label each recording OK, PARTIAL, SHORT or EMPTY. An hourly puca-archive-totals job reports the archive size.

These results are written to the system journal. Grafana Alloy ships the whole journal to Loki, and host metrics to Prometheus, both on Secops at corais.abair.ie, using the shared Webserver htpasswd admin credential. The Grafana dashboards are "Púca - Radio Archiver" and "Púca - TV Archiver".

Things Ansible doesn't do​

  • Flashing the SD card, with hostname puca, user ansible-control and setanta's SSH key.
  • Setting up passwordless sudo before the first run.
  • Plugging in the drive, and finding the Pi's current DHCP address.
  • Adding the Pi's IP to the NAS's allow list.
  • Attaching the Saorview network to a tuner in tvheadend's web UI, if a tuner comes up without it.

The tvheadend admin password (user abair) has a default value in the playbook. Override it with -e target_tvheadend_password=....