|
|
@ -491,14 +491,18 @@ def automatic_movies(add_delay=2.5, no_search=False, notifications=False):
|
|
|
|
@click.option('--no-search', is_flag=True, help='Disable search when adding to Sonarr / Radarr.')
|
|
|
|
@click.option('--no-search', is_flag=True, help='Disable search when adding to Sonarr / Radarr.')
|
|
|
|
@click.option('--no-notifications', is_flag=True, help="Disable notifications.")
|
|
|
|
@click.option('--no-notifications', is_flag=True, help="Disable notifications.")
|
|
|
|
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
|
|
|
|
log.info("Automatic mode is now running...")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Add tasks to schedule and do first run
|
|
|
|
if cfg.automatic.movies.interval:
|
|
|
|
if cfg.automatic.movies.interval:
|
|
|
|
schedule.every(cfg.automatic.movies.interval).hours.do(
|
|
|
|
schedule.every(cfg.automatic.movies.interval).hours.do(
|
|
|
|
automatic_movies,
|
|
|
|
automatic_movies,
|
|
|
|
add_delay,
|
|
|
|
add_delay,
|
|
|
|
no_search,
|
|
|
|
no_search,
|
|
|
|
not no_notifications
|
|
|
|
not no_notifications
|
|
|
|
)
|
|
|
|
).run()
|
|
|
|
|
|
|
|
# Sleep between tasks
|
|
|
|
|
|
|
|
time.sleep(add_delay)
|
|
|
|
|
|
|
|
|
|
|
|
if cfg.automatic.shows.interval:
|
|
|
|
if cfg.automatic.shows.interval:
|
|
|
|
schedule.every(cfg.automatic.shows.interval).hours.do(
|
|
|
|
schedule.every(cfg.automatic.shows.interval).hours.do(
|
|
|
@ -506,13 +510,13 @@ def run(add_delay=2.5, no_search=False, no_notifications=False):
|
|
|
|
add_delay,
|
|
|
|
add_delay,
|
|
|
|
no_search,
|
|
|
|
no_search,
|
|
|
|
not no_notifications
|
|
|
|
not no_notifications
|
|
|
|
)
|
|
|
|
).run()
|
|
|
|
|
|
|
|
|
|
|
|
# run schedule
|
|
|
|
# Enter running schedule
|
|
|
|
log.info("Automatic mode is now running...")
|
|
|
|
|
|
|
|
while True:
|
|
|
|
while True:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
# Sleep until next run
|
|
|
|
# Sleep until next run
|
|
|
|
|
|
|
|
log.info("Next job at %s", schedule.next_run())
|
|
|
|
time.sleep(schedule.idle_seconds())
|
|
|
|
time.sleep(schedule.idle_seconds())
|
|
|
|
# Check jobs to run
|
|
|
|
# Check jobs to run
|
|
|
|
schedule.run_pending()
|
|
|
|
schedule.run_pending()
|
|
|
|