Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Sorry there are so many changes in this one PR, but they sort of build on each other.
Commits fix #41 and #26. Provides a solution for #34 but via command line option rather than the requested config option
Although I didn't directly address the root cause, these changes were motivated by #45. Something happens in the feed such that long-downloaded enclosures suddenly attempt to be downloaded. Because the file already exists I end up with "Enclosure file FOO already exists". Because I'm running it in cron, I get alerted about this issue I don't really care about every morning until I manually intervene.
My thinking for a solution to this is "Why am I scanning the entire feed? To the best of my knowledge all old episodes were successfully downloaded, don't even consider them for processing". I thought that --first-only would solve this, but as pointed out in #26, that option runs until it finds at least one item eligible for processing, so it doesn't actually work for "only consider the first item in the channel".
To address this and add additional flexibility, I've done the following:
After all that, I can now change my cronjob from
/usr/local/bin/castget -q -first-only
to/usr/local/bin/castget -q --stop-after=3 --count-disregards-eligibility
. That allows me to consider only the first three items in each feed, regardless of whether they were eligible for processing or not. This means I can disregard old episodes while also being reasonably sure I am seeing all episodes, even if they post multiple at once.I still have a small risk of experiencing the issue in #45, but in my experience it tends to happen with older files so the risk is small.
I don't do day to day programming in C, so if I've made obvious mistakes please let me know.
I looked at the tests a little and didn't really understand them. If you want to accept this PR and lack of tests is holding you up, let me know and I'll look at adding them.
Thanks for castget, it's a great tool.