endkb / SoundsDownloadScript

Download programs from BBC Sounds and publish them to a podcast feed
2 stars 0 forks source link

Should SDS clean up media files even if it doesn't download a new one? #45

Closed endkb closed 2 weeks ago

endkb commented 4 weeks ago

Right now SoundsDownloadScript only runs the cleanup routine if it successfully downloads a new audio file. That's fine if it's keeping the last X new episodes, but doesn't make sense if -Days parameter is set.

Could move the cleanup routine to it's own function called Invoke-MediaCleanupRoutine and call it before the script exits.

I don't know if it makes sense to do that.

endkb commented 3 weeks ago

Things would get complicated because you'd want rclone to sync if it cleaned up even if it didn't download anything. Sync would be easy. If rclone is just copying, like with Internet Archive, that would be harder.

Need a way to detect whether rclone is syncing or copying.

The problem will be detecting whether rclone needs to copy AND that there's something to copy. If it didn't successfully download the file, then it shouldn't try to copy.

endkb commented 3 weeks ago

The rclone --check-first command might be good to look in to.

Can't really test it until Internet Archive comes back online.

endkb commented 3 weeks ago

Made and tested a whole bunch of changes to the way it detects whether rclone needs to run and the way script blocks run.