Keep only the newest 50 episodes of each podcast
A show that has published for years is unbounded: GEOlino Spezial alone is 358 episodes and 5.8 GB, and the device it syncs onto is a 30 GB SD card that also holds the rest of the library. Nothing stopped the 6-hourly poll from eventually filling it. Cap each show's folder at general.podcast_episode_limit (default 50, null to keep everything), pruning the oldest past that after each sync pass. The same limit caps what is downloaded, and it has to be one number for both. Prune to the newest N but keep fetching everything the feed offers, and every poll would re-download exactly the episodes the previous one deleted - forever, at full size, since missing_episodes() decides purely from what is on disk. There is a test for that specific loop. Pruning only touches files named the way this module names them (YYYYMMDD - Title.ext), so feed.txt, folder.jpg, the failed-download record and anything placed by hand are all left alone; a parse that fails means "not ours", not "delete it". An episode's sidecar cover goes with it. A pass that only deleted still reports a change, because the library needs the rescan just as much as it does after a download. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -206,6 +206,9 @@ if [[ $COPY_CACHE -eq 1 ]]; then
|
||||
for part in covers analysis; do
|
||||
[[ -d "${CACHE}/${part}" ]] || continue
|
||||
echo "--- ${part}"
|
||||
# rsync creates the last path component but not a missing one above it, and on a
|
||||
# fresh device neither .musicmouse-cache nor its subdirectory exists yet.
|
||||
[[ $DRY_RUN -eq 1 ]] || ssh "$SSH_TARGET" "mkdir -p '${DEST}/.musicmouse-cache/${part}'"
|
||||
# No --delete: the device may have analysed tracks this machine never saw.
|
||||
rsync "${RSYNC_OPTS[@]}" \
|
||||
"${CACHE}/${part}/" "${SSH_TARGET}:${DEST}/.musicmouse-cache/${part}/"
|
||||
|
||||
Reference in New Issue
Block a user