|
|
@ -183,8 +183,9 @@ def show(show_id, folder=None, no_search=False):
|
|
|
|
@click.option('--notifications', is_flag=True, help='Send notifications.')
|
|
|
|
@click.option('--notifications', is_flag=True, help='Send notifications.')
|
|
|
|
@click.option('--authenticate-user',
|
|
|
|
@click.option('--authenticate-user',
|
|
|
|
help='Specify which user to authenticate with to retrieve Trakt lists. Default: first user in the config')
|
|
|
|
help='Specify which user to authenticate with to retrieve Trakt lists. Default: first user in the config')
|
|
|
|
|
|
|
|
@click.option('--ignore-blacklist', is_flag=True, help='Ignores the blacklist when running the command.')
|
|
|
|
def shows(list_type, add_limit=0, add_delay=2.5, sort='votes', genre=None, folder=None, no_search=False,
|
|
|
|
def shows(list_type, add_limit=0, add_delay=2.5, sort='votes', genre=None, folder=None, no_search=False,
|
|
|
|
notifications=False, authenticate_user=None):
|
|
|
|
notifications=False, authenticate_user=None, ignore_blacklist=False):
|
|
|
|
from media.sonarr import Sonarr
|
|
|
|
from media.sonarr import Sonarr
|
|
|
|
from media.trakt import Trakt
|
|
|
|
from media.trakt import Trakt
|
|
|
|
from helpers import misc as misc_helper
|
|
|
|
from helpers import misc as misc_helper
|
|
|
@ -269,7 +270,7 @@ def shows(list_type, add_limit=0, add_delay=2.5, sort='votes', genre=None, folde
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
|
|
# check if series passes out blacklist criteria inspection
|
|
|
|
# check if series passes out blacklist criteria inspection
|
|
|
|
if not trakt_helper.is_show_blacklisted(series, cfg.filters.shows):
|
|
|
|
if not trakt_helper.is_show_blacklisted(series, cfg.filters.shows, ignore_blacklist):
|
|
|
|
log.info("Adding: %s | Genres: %s | Network: %s | Country: %s", series['show']['title'],
|
|
|
|
log.info("Adding: %s | Genres: %s | Network: %s | Country: %s", series['show']['title'],
|
|
|
|
', '.join(series['show']['genres']), series['show']['network'],
|
|
|
|
', '.join(series['show']['genres']), series['show']['network'],
|
|
|
|
series['show']['country'].upper())
|
|
|
|
series['show']['country'].upper())
|
|
|
@ -369,8 +370,9 @@ def movie(movie_id, folder=None, no_search=False):
|
|
|
|
@click.option('--notifications', is_flag=True, help='Send notifications.')
|
|
|
|
@click.option('--notifications', is_flag=True, help='Send notifications.')
|
|
|
|
@click.option('--authenticate-user',
|
|
|
|
@click.option('--authenticate-user',
|
|
|
|
help='Specify which user to authenticate with to retrieve Trakt lists. Default: first user in the config.')
|
|
|
|
help='Specify which user to authenticate with to retrieve Trakt lists. Default: first user in the config.')
|
|
|
|
|
|
|
|
@click.option('--ignore-blacklist', is_flag=True, help='Ignores the blacklist when running the command.')
|
|
|
|
def movies(list_type, add_limit=0, add_delay=2.5, sort='votes', genre=None, folder=None, no_search=False,
|
|
|
|
def movies(list_type, add_limit=0, add_delay=2.5, sort='votes', genre=None, folder=None, no_search=False,
|
|
|
|
notifications=False, authenticate_user=None):
|
|
|
|
notifications=False, authenticate_user=None, ignore_blacklist=False):
|
|
|
|
from media.radarr import Radarr
|
|
|
|
from media.radarr import Radarr
|
|
|
|
from media.trakt import Trakt
|
|
|
|
from media.trakt import Trakt
|
|
|
|
from helpers import misc as misc_helper
|
|
|
|
from helpers import misc as misc_helper
|
|
|
@ -456,7 +458,7 @@ def movies(list_type, add_limit=0, add_delay=2.5, sort='votes', genre=None, fold
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
|
|
# check if movie passes out blacklist criteria inspection
|
|
|
|
# check if movie passes out blacklist criteria inspection
|
|
|
|
if not trakt_helper.is_movie_blacklisted(movie, cfg.filters.movies):
|
|
|
|
if not trakt_helper.is_movie_blacklisted(movie, cfg.filters.movies, ignore_blacklist):
|
|
|
|
log.info("Adding: %s (%d) | Genres: %s | Country: %s", movie['movie']['title'], movie['movie']['year'],
|
|
|
|
log.info("Adding: %s (%d) | Genres: %s | Country: %s", movie['movie']['title'], movie['movie']['year'],
|
|
|
|
', '.join(movie['movie']['genres']), movie['movie']['country'].upper())
|
|
|
|
', '.join(movie['movie']['genres']), movie['movie']['country'].upper())
|
|
|
|
# add movie to radarr
|
|
|
|
# add movie to radarr
|
|
|
@ -517,7 +519,7 @@ def callback_notify(data):
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def automatic_shows(add_delay=2.5, sort='votes', no_search=False, notifications=False):
|
|
|
|
def automatic_shows(add_delay=2.5, sort='votes', no_search=False, notifications=False, ignore_blacklist=False):
|
|
|
|
from media.trakt import Trakt
|
|
|
|
from media.trakt import Trakt
|
|
|
|
|
|
|
|
|
|
|
|
total_shows_added = 0
|
|
|
|
total_shows_added = 0
|
|
|
@ -539,10 +541,15 @@ def automatic_shows(add_delay=2.5, sort='votes', no_search=False, notifications=
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
log.info("Adding %d shows from Trakt's %s list", limit, list_type)
|
|
|
|
log.info("Adding %d shows from Trakt's %s list", limit, list_type)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local_ignore_blacklist = ignore_blacklist
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if list_type.lower() in cfg.filters.shows.disabled_for:
|
|
|
|
|
|
|
|
local_ignore_blacklist = True
|
|
|
|
|
|
|
|
|
|
|
|
# run shows
|
|
|
|
# run shows
|
|
|
|
added_shows = shows.callback(list_type=list_type, add_limit=limit,
|
|
|
|
added_shows = shows.callback(list_type=list_type, add_limit=limit,
|
|
|
|
add_delay=add_delay, sort=sort, no_search=no_search,
|
|
|
|
add_delay=add_delay, sort=sort, no_search=no_search,
|
|
|
|
notifications=notifications)
|
|
|
|
notifications=notifications, ignore_blacklist=local_ignore_blacklist)
|
|
|
|
elif list_type.lower() == 'watchlist':
|
|
|
|
elif list_type.lower() == 'watchlist':
|
|
|
|
for authenticate_user, limit in value.items():
|
|
|
|
for authenticate_user, limit in value.items():
|
|
|
|
if limit <= 0:
|
|
|
|
if limit <= 0:
|
|
|
@ -551,10 +558,16 @@ def automatic_shows(add_delay=2.5, sort='votes', no_search=False, notifications=
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
log.info("Adding %d shows from the %s from %s", limit, list_type, authenticate_user)
|
|
|
|
log.info("Adding %d shows from the %s from %s", limit, list_type, authenticate_user)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local_ignore_blacklist = ignore_blacklist
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if "watchlist:%s".format(authenticate_user) in cfg.filters.shows.disabled_for:
|
|
|
|
|
|
|
|
local_ignore_blacklist = True
|
|
|
|
|
|
|
|
|
|
|
|
# run shows
|
|
|
|
# run shows
|
|
|
|
added_shows = shows.callback(list_type=list_type, add_limit=limit,
|
|
|
|
added_shows = shows.callback(list_type=list_type, add_limit=limit,
|
|
|
|
add_delay=add_delay, sort=sort, no_search=no_search,
|
|
|
|
add_delay=add_delay, sort=sort, no_search=no_search,
|
|
|
|
notifications=notifications, authenticate_user=authenticate_user)
|
|
|
|
notifications=notifications, authenticate_user=authenticate_user,
|
|
|
|
|
|
|
|
ignore_blacklist=local_ignore_blacklist)
|
|
|
|
elif list_type.lower() == 'lists':
|
|
|
|
elif list_type.lower() == 'lists':
|
|
|
|
for list, v in value.items():
|
|
|
|
for list, v in value.items():
|
|
|
|
if isinstance(v, dict):
|
|
|
|
if isinstance(v, dict):
|
|
|
@ -564,10 +577,16 @@ def automatic_shows(add_delay=2.5, sort='votes', no_search=False, notifications=
|
|
|
|
authenticate_user = None
|
|
|
|
authenticate_user = None
|
|
|
|
limit = v
|
|
|
|
limit = v
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local_ignore_blacklist = ignore_blacklist
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if "list:%s".format(list) in cfg.filters.shows.disabled_for:
|
|
|
|
|
|
|
|
local_ignore_blacklist = True
|
|
|
|
|
|
|
|
|
|
|
|
# run shows
|
|
|
|
# run shows
|
|
|
|
added_shows = shows.callback(list_type=list, add_limit=limit,
|
|
|
|
added_shows = shows.callback(list_type=list, add_limit=limit,
|
|
|
|
add_delay=add_delay, sort=sort, no_search=no_search,
|
|
|
|
add_delay=add_delay, sort=sort, no_search=no_search,
|
|
|
|
notifications=notifications, authenticate_user=authenticate_user)
|
|
|
|
notifications=notifications, authenticate_user=authenticate_user,
|
|
|
|
|
|
|
|
ignore_blacklist=local_ignore_blacklist)
|
|
|
|
|
|
|
|
|
|
|
|
if added_shows is None:
|
|
|
|
if added_shows is None:
|
|
|
|
log.error("Failed adding shows from Trakt's %s list", list_type)
|
|
|
|
log.error("Failed adding shows from Trakt's %s list", list_type)
|
|
|
@ -588,7 +607,7 @@ def automatic_shows(add_delay=2.5, sort='votes', no_search=False, notifications=
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def automatic_movies(add_delay=2.5, sort='votes', no_search=False, notifications=False):
|
|
|
|
def automatic_movies(add_delay=2.5, sort='votes', no_search=False, notifications=False, ignore_blacklist=False):
|
|
|
|
from media.trakt import Trakt
|
|
|
|
from media.trakt import Trakt
|
|
|
|
|
|
|
|
|
|
|
|
total_movies_added = 0
|
|
|
|
total_movies_added = 0
|
|
|
@ -610,6 +629,11 @@ def automatic_movies(add_delay=2.5, sort='votes', no_search=False, notifications
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
log.info("Adding %d movies from Trakt's %s list", limit, list_type)
|
|
|
|
log.info("Adding %d movies from Trakt's %s list", limit, list_type)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local_ignore_blacklist = ignore_blacklist
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if list_type.lower() in cfg.filters.movies.disabled_for:
|
|
|
|
|
|
|
|
local_ignore_blacklist = True
|
|
|
|
|
|
|
|
|
|
|
|
# run movies
|
|
|
|
# run movies
|
|
|
|
added_movies = movies.callback(list_type=list_type, add_limit=limit,
|
|
|
|
added_movies = movies.callback(list_type=list_type, add_limit=limit,
|
|
|
|
add_delay=add_delay, sort=sort, no_search=no_search,
|
|
|
|
add_delay=add_delay, sort=sort, no_search=no_search,
|
|
|
@ -622,10 +646,16 @@ def automatic_movies(add_delay=2.5, sort='votes', no_search=False, notifications
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
log.info("Adding %d movies from the %s from %s", limit, list_type, authenticate_user)
|
|
|
|
log.info("Adding %d movies from the %s from %s", limit, list_type, authenticate_user)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local_ignore_blacklist = ignore_blacklist
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if "watchlist:%s".format(authenticate_user) in cfg.filters.movies.disabled_for:
|
|
|
|
|
|
|
|
local_ignore_blacklist = True
|
|
|
|
|
|
|
|
|
|
|
|
# run movies
|
|
|
|
# run movies
|
|
|
|
added_movies = movies.callback(list_type=list_type, add_limit=limit,
|
|
|
|
added_movies = movies.callback(list_type=list_type, add_limit=limit,
|
|
|
|
add_delay=add_delay, sort=sort, no_search=no_search,
|
|
|
|
add_delay=add_delay, sort=sort, no_search=no_search,
|
|
|
|
notifications=notifications, authenticate_user=authenticate_user)
|
|
|
|
notifications=notifications, authenticate_user=authenticate_user,
|
|
|
|
|
|
|
|
ignore_blacklist=local_ignore_blacklist)
|
|
|
|
elif list_type.lower() == 'lists':
|
|
|
|
elif list_type.lower() == 'lists':
|
|
|
|
for list, v in value.items():
|
|
|
|
for list, v in value.items():
|
|
|
|
if isinstance(v, dict):
|
|
|
|
if isinstance(v, dict):
|
|
|
@ -635,10 +665,16 @@ def automatic_movies(add_delay=2.5, sort='votes', no_search=False, notifications
|
|
|
|
authenticate_user = None
|
|
|
|
authenticate_user = None
|
|
|
|
limit = v
|
|
|
|
limit = v
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local_ignore_blacklist = ignore_blacklist
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if "list:%s".format(list) in cfg.filters.movies.disabled_for:
|
|
|
|
|
|
|
|
local_ignore_blacklist = True
|
|
|
|
|
|
|
|
|
|
|
|
# run shows
|
|
|
|
# run shows
|
|
|
|
added_movies = movies.callback(list_type=list, add_limit=limit,
|
|
|
|
added_movies = movies.callback(list_type=list, add_limit=limit,
|
|
|
|
add_delay=add_delay, sort=sort, no_search=no_search,
|
|
|
|
add_delay=add_delay, sort=sort, no_search=no_search,
|
|
|
|
notifications=notifications, authenticate_user=authenticate_user)
|
|
|
|
notifications=notifications, authenticate_user=authenticate_user,
|
|
|
|
|
|
|
|
ignore_blacklist=local_ignore_blacklist)
|
|
|
|
|
|
|
|
|
|
|
|
if added_movies is None:
|
|
|
|
if added_movies is None:
|
|
|
|
log.error("Failed adding movies from Trakt's %s list", list_type)
|
|
|
|
log.error("Failed adding movies from Trakt's %s list", list_type)
|
|
|
@ -667,7 +703,8 @@ def automatic_movies(add_delay=2.5, sort='votes', no_search=False, notifications
|
|
|
|
@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('--run-now', is_flag=True, help="Do a first run immediately without waiting.")
|
|
|
|
@click.option('--run-now', is_flag=True, help="Do a first run immediately without waiting.")
|
|
|
|
@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, sort='votes', no_search=False, run_now=False, no_notifications=False):
|
|
|
|
@click.option('--ignore-blacklist', is_flag=True, help='Ignores the blacklist when running the command.')
|
|
|
|
|
|
|
|
def run(add_delay=2.5, sort='votes', no_search=False, run_now=False, no_notifications=False, ignore_blacklist=False):
|
|
|
|
log.info("Automatic mode is now running...")
|
|
|
|
log.info("Automatic mode is now running...")
|
|
|
|
|
|
|
|
|
|
|
|
# Add tasks to schedule and do first run if enabled
|
|
|
|
# Add tasks to schedule and do first run if enabled
|
|
|
@ -677,7 +714,8 @@ def run(add_delay=2.5, sort='votes', no_search=False, run_now=False, no_notifica
|
|
|
|
add_delay,
|
|
|
|
add_delay,
|
|
|
|
sort,
|
|
|
|
sort,
|
|
|
|
no_search,
|
|
|
|
no_search,
|
|
|
|
not no_notifications
|
|
|
|
not no_notifications,
|
|
|
|
|
|
|
|
ignore_blacklist
|
|
|
|
)
|
|
|
|
)
|
|
|
|
if run_now:
|
|
|
|
if run_now:
|
|
|
|
movie_schedule.run()
|
|
|
|
movie_schedule.run()
|
|
|
@ -691,7 +729,8 @@ def run(add_delay=2.5, sort='votes', no_search=False, run_now=False, no_notifica
|
|
|
|
add_delay,
|
|
|
|
add_delay,
|
|
|
|
sort,
|
|
|
|
sort,
|
|
|
|
no_search,
|
|
|
|
no_search,
|
|
|
|
not no_notifications
|
|
|
|
not no_notifications,
|
|
|
|
|
|
|
|
ignore_blacklist
|
|
|
|
)
|
|
|
|
)
|
|
|
|
if run_now:
|
|
|
|
if run_now:
|
|
|
|
shows_schedule.run()
|
|
|
|
shows_schedule.run()
|
|
|
|