Merge pull request #12 from horjulf/run_sleep

Add docker build by branch
pull/54/head
James 7 years ago committed by desimaniac
commit ebb8b44eed

@ -493,21 +493,32 @@ def automatic_movies(add_delay=2.5, no_search=False, notifications=False):
def run(add_delay=2.5, no_search=False, no_notifications=False): def run(add_delay=2.5, no_search=False, no_notifications=False):
# add tasks to repeat # add tasks to repeat
if cfg.automatic.movies.interval: if cfg.automatic.movies.interval:
schedule.every(cfg.automatic.movies.interval).hours.do(automatic_movies, add_delay, no_search, schedule.every(cfg.automatic.movies.interval).hours.do(
not no_notifications) automatic_movies,
add_delay,
no_search,
not no_notifications
)
if cfg.automatic.shows.interval: if cfg.automatic.shows.interval:
schedule.every(cfg.automatic.shows.interval).hours.do(automatic_shows, add_delay, no_search, schedule.every(cfg.automatic.shows.interval).hours.do(
not no_notifications) automatic_shows,
add_delay,
no_search,
not no_notifications
)
# run schedule # run schedule
log.info("Automatic mode is now running...") log.info("Automatic mode is now running...")
while True: while True:
try: try:
# Sleep until next run
time.sleep(schedule.idle_seconds())
# Check jobs to run
schedule.run_pending() schedule.run_pending()
except Exception:
log.exception("Unhandled exception occurred while processing scheduled tasks: ") except Exception as e:
else: log.exception("Unhandled exception occurred while processing scheduled tasks: %s", e)
time.sleep(1)
############################################################ ############################################################

Loading…
Cancel
Save