Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc improvements #61

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Misc improvements #61

wants to merge 6 commits into from

Conversation

jetmore
Copy link

@jetmore jetmore commented Jan 22, 2023

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:

  • implement --stop-after and reimplement such that --first-only is just a convenience for --stop-after=1. By default this behaves as it did before - the count of "seen" items only increments for items that are eligible for processing.
  • implement --count-disregards-eligibility. This changes it so that the count of "seen" items increments for all items, regardless of eligibility
  • implement --first-only-disregard-eligibility. This is equivalent to "--stop-after=1 --count-disregards-eligibility"

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.

before:
`  --without-taglib        disable taglib support]`
after:
`  --without-taglib        disable taglib support`
missing by default on macos
- simplify the interface to channel_update() to make adding new options easier
- change as many Options variables as possible from global to main()
preserves --first-only, but reimplements it in terms of --stop-after=1

This satisfies the underlying desire in mlj#34 but via a channel-agnostic command line option instead of the suggested configuration option
…ligibility

with this change, `--first-only --count-disregards-eligibility` will now cease channel processing after it sees the first item in the channel, regardless of whether that item was actually eligible for processing

--first-only-disregard-eligibility is just a convenience for `--first-only --count-disregards-eligibility`

fixes mlj#26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

option to reverse download order
1 participant