-
Notifications
You must be signed in to change notification settings - Fork 276
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
Feature/delay downloads #3360
Feature/delay downloads #3360
Changes from 1 commit
c378a59
56c39f9
9181784
9abaf8b
9a71f89
507a469
2974a61
8b8f271
e2e5f90
dc63d47
8d261b5
c55a976
0853deb
51776e8
8028e87
d199991
2fd4648
45d1cd6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -473,6 +473,8 @@ def search_for_needed_episodes(force=False): | |
# fail_over_delay time (hours) skipp it. For this we need to check if the result has already been | ||
# stored in the provider cache db, and if it's still younger then the providers attribute fail_over_delay. | ||
if cur_provider.fail_over_enabled and cur_provider.fail_over_hours: | ||
log.debug('DELAY: Provider {provider} delay enabled, with an expiration of {delay}', | ||
{'provider': cur_provider.name, 'delay': cur_provider.fail_over_hours}) | ||
from medusa.search.manual import get_provider_cache_results | ||
results = get_provider_cache_results( | ||
cur_ep.series.indexer, show_all_results=False, perform_search=False, show=cur_ep.series.indexerid, | ||
|
@@ -485,13 +487,23 @@ def search_for_needed_episodes(force=False): | |
if first_result['date_added'] + cur_provider.fail_over_hours * 3600 > int(time.time()): | ||
# The provider's fail over cooldown time hasn't expired yet. We're holding back the snatch. | ||
log.debug( | ||
u'Holding back best result {name} for provider {provider}. The provider is waiting' | ||
u'DELAY: Holding back best result {name} for provider {provider}. The provider is waiting' | ||
u' {fail_over_hours} hours, before accepting the release.', {'name': first_result['name'], | ||
'provider': cur_provider.name, | ||
'fail_over_hours': cur_provider.fail_over_hours | ||
} | ||
) | ||
continue | ||
else: | ||
log.debug( | ||
u'DELAY: Provider {provider}, found a result in cache, but the delay has not yet expired. ' | ||
u'Timestamp of first result: {first_result}. Time left: {left} hours', | ||
{'provider': cur_provider.name, 'first_result': first_result['date_added'], | ||
'left': int((int(time.time()) + (first_result['date_added'] - cur_provider.fail_over_hours * 3600)) / 3600)} | ||
) | ||
else: | ||
log.debug(u'DELAY: Provider {provider}, searched cache but could not get any results for: {season}x{episode}', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you use the episode_num instead of this? from medusa.helper.common import episode_num There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also add show name |
||
{'provider': cur_provider.name, 'season': cur_ep.season, 'episode': cur_ep.episode}) | ||
|
||
found_results[cur_ep] = best_result | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe add
hours
here? or the correct unit?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ooh yeah sure.