Skip to content

Commit

Permalink
Merge pull request #2 from sirstudly/watchlist_loop_param
Browse files Browse the repository at this point in the history
Parameterized watchlist loop interval rather than hardcoded 30 minutes
  • Loading branch information
funkypenguin authored Jul 23, 2024
2 parents 01704ea + 86c912a commit d59a66f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
10 changes: 6 additions & 4 deletions content/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -926,17 +926,19 @@ def watch(self):
retries = int(float(trigger[2]))
if retries == 0:
return

message = 'retrying download in ' + str(
round(int(ui_settings.loop_interval_seconds) / 60)) + 'min for item: ' + self.query() + ' - version/s [' + '],['.join(
names) + ']'
if not self in media.ignore_queue:
self.ignored_count = 1
media.ignore_queue += [self]
ui_print('retrying download in 30min for item: ' + self.query() + ' - version/s [' + '],['.join(
names) + '] - attempt ' + str(self.ignored_count) + '/' + str(retries))
ui_print(message + ' - attempt ' + str(self.ignored_count) + '/' + str(retries))
else:
match = next((x for x in media.ignore_queue if self == x), None)
if match.ignored_count < retries:
match.ignored_count += 1
ui_print('retrying download in 30min for item: ' + self.query() + ' - version/s [' + '],['.join(
names) + '] - attempt ' + str(match.ignored_count) + '/' + str(retries))
ui_print(message + ' - attempt ' + str(match.ignored_count) + '/' + str(retries))
else:
media.ignore_queue.remove(match)
ignore.add(self)
Expand Down
1 change: 1 addition & 0 deletions settings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ def get(self):
setting('Show Menu on Startup', 'Please enter "true" or "false": ', ui_settings, 'run_directly'),
setting('Debug printing', 'Please enter "true" or "false": ', ui_settings, 'debug'),
setting('Log to file', 'Please enter "true" or "false": ', ui_settings, 'log'),
setting('Watchlist loop interval (sec)', 'Please enter an integer value in seconds: ', ui_settings, 'loop_interval_seconds'),
setting('version', 'No snooping around! :D This is for compatability reasons.', ui_settings, 'version',
hidden=True),
]
Expand Down
2 changes: 1 addition & 1 deletion ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ def threaded(stop):
else:
print("Type 'exit' to return to the main menu.")
timeout = 5
regular_check = 1800
regular_check = int(ui_settings.loop_interval_seconds)
timeout_counter = 0
library = content.classes.library()[0]()
# get entire plex_watchlist
Expand Down
1 change: 1 addition & 0 deletions ui/ui_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
run_directly = "true"
debug = "false"
log = "false"
loop_interval_seconds = 1800

0 comments on commit d59a66f

Please sign in to comment.