Keep It Local
My media library grew up on cloud storage behind an encrypted mount. That works. But some things I want to keep for good, like the full back catalog of a favorite podcast. For those, I want the bytes in my house. Farosh has a 1 TB disk with plenty of free space, and it already serves a NAS for the realm. So the new rule is simple: podcasts and archived video live on the NAS, not in the cloud.
Plumbing a New Share
These are the parts:
- a dedicated media share on the NAS, with its own service account,
- a network mount on Din, where the audiobook and media servers run,
- bind mounts into each of those containers, so the apps see a normal local folder.
One lesson from an earlier reboot drill applied at once: network mounts must exist before the containers that use them start. A small boot-order unit waits for the NAS. It now waits for both shares before the hypervisor starts any guests. Without it, a container starts on top of an empty directory and writes into it. You find out weeks later.
Don’t Download 600 Episodes at Once
The audiobook server can subscribe to a podcast feed and download the episodes. I added the show and asked for the full back catalog. That was about 600 episodes and tens of gigabytes. The server did what I asked and started to download all of them, back to back.
That is rude to the podcast’s host and hard on the disk. It also competes with everything else on the network. So I cleared the queue and wrote a small helper with a --batch option:
- It reads the feed and compares it with the episodes I already have. Then it queues only the N newest missing episodes.
- A cron job runs it with a batch of 40 every six hours. That is about 160 episodes a day, done in about four days.
- New episodes still arrive on their own every hour, and the server keeps every episode.
Slow is smooth, and smooth finishes on schedule.
A Library in the Wrong Folder
While I set this up, another library looked empty, but the files were clearly there. The library pointed at ebooks, but the files lived in Ebooks. On a case-sensitive filesystem, those are two different folders. The server had quietly made the empty one. I pointed the library at the right path, and that fixed it. The import hook now starts a library scan itself, so new books appear at once.
The Metadata Race
The most interesting bug came from the media server. A script downloads video episodes. It writes a sidecar .nfo file next to each video (title, description, air date) and asks the server to refresh. The server showed every episode with its file name as the title. It ignored the .nfo files completely. A forced full refresh with “replace all metadata” did not help either.
The cause was the order of events:
- The script wrote the video file.
- The server’s file watcher saw it at once and made the episode. No metadata was there yet.
- A few seconds later, the script wrote the
.nfo. - From then on, the server knew the episode and never went back to read the sidecar.
These are the fixes, the most important first:
- Stage, then move. The script downloads into a staging folder outside the library. It writes the
.nfoand the thumbnail there. Then it moves the sidecars into the library first and the video last. The watcher can never see a video without its metadata. - Belt and braces. After each run, the script compares each episode’s title and air date in the server with its
.nfo. Where they differ, it sets them through the server’s API. The step is idempotent, so a run every time costs nothing.
The Result
The podcast archive now lands on local disk at a polite pace. New episodes arrive on their own. The video episodes show up as a proper TV series with real titles, descriptions and air dates.
Takeaways:
- Decide where data lives by how long you want to keep it.
- Order your boot: storage first, then the containers that need it.
- Pace bulk downloads. Your network, your disks and the people who serve the files will thank you.
- A watcher may index files the moment they appear. If so, have everything it needs in place before the main file lands.