|
|
@ -394,6 +394,7 @@ def movie(movie_id, folder=None, no_search=False):
|
|
|
|
@click.option('--add-delay', '-d', default=2.5, help='Seconds between each add request to Radarr.', show_default=True)
|
|
|
|
@click.option('--add-delay', '-d', default=2.5, help='Seconds between each add request to Radarr.', show_default=True)
|
|
|
|
@click.option('--sort', '-s', default='votes', type=click.Choice(['votes', 'rating', 'release']),
|
|
|
|
@click.option('--sort', '-s', default='votes', type=click.Choice(['votes', 'rating', 'release']),
|
|
|
|
help='Sort list to process.')
|
|
|
|
help='Sort list to process.')
|
|
|
|
|
|
|
|
@click.option('--rating','-r',default=0,help='Set a minimum rating threshold (according to Rotten Tomatoes)')
|
|
|
|
@click.option('--genre', '-g', default=None, help='Only add movies from this genre to Radarr.')
|
|
|
|
@click.option('--genre', '-g', default=None, help='Only add movies from this genre to Radarr.')
|
|
|
|
@click.option('--folder', '-f', default=None, help='Add movies with this root folder to Radarr.')
|
|
|
|
@click.option('--folder', '-f', default=None, help='Add movies with this root folder to Radarr.')
|
|
|
|
@click.option('--actor', '-a', default=None, help='Only add movies from this actor to Radarr.')
|
|
|
|
@click.option('--actor', '-a', default=None, help='Only add movies from this actor to Radarr.')
|
|
|
@ -404,13 +405,14 @@ def movie(movie_id, folder=None, no_search=False):
|
|
|
|
@click.option('--ignore-blacklist', is_flag=True, help='Ignores the blacklist when running the command.')
|
|
|
|
@click.option('--ignore-blacklist', is_flag=True, help='Ignores the blacklist when running the command.')
|
|
|
|
@click.option('--remove-rejected-from-recommended', is_flag=True,
|
|
|
|
@click.option('--remove-rejected-from-recommended', is_flag=True,
|
|
|
|
help='Removes rejected/existing movies from recommended.')
|
|
|
|
help='Removes rejected/existing movies from recommended.')
|
|
|
|
def movies(list_type, add_limit=0, add_delay=2.5, sort='votes', genre=None, folder=None, actor=None, no_search=False,
|
|
|
|
def movies(list_type, add_limit=0, add_delay=2.5, sort='votes', rating=0, genre=None, folder=None, actor=None, no_search=False,
|
|
|
|
notifications=False, authenticate_user=None, ignore_blacklist=False, remove_rejected_from_recommended=False):
|
|
|
|
notifications=False, authenticate_user=None, ignore_blacklist=False, remove_rejected_from_recommended=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
|
|
|
|
from helpers import radarr as radarr_helper
|
|
|
|
from helpers import radarr as radarr_helper
|
|
|
|
from helpers import trakt as trakt_helper
|
|
|
|
from helpers import trakt as trakt_helper
|
|
|
|
|
|
|
|
from helpers import rating as rating_helper
|
|
|
|
|
|
|
|
|
|
|
|
added_movies = 0
|
|
|
|
added_movies = 0
|
|
|
|
|
|
|
|
|
|
|
@ -518,18 +520,30 @@ def movies(list_type, add_limit=0, add_delay=2.5, sort='votes', genre=None, fold
|
|
|
|
if not trakt_helper.is_movie_blacklisted(movie, cfg.filters.movies, ignore_blacklist,
|
|
|
|
if not trakt_helper.is_movie_blacklisted(movie, cfg.filters.movies, ignore_blacklist,
|
|
|
|
callback_remove_recommended if remove_rejected_from_recommended
|
|
|
|
callback_remove_recommended if remove_rejected_from_recommended
|
|
|
|
else None):
|
|
|
|
else None):
|
|
|
|
log.info("Adding: %s (%d) | Genres: %s | Country: %s", movie['movie']['title'], movie['movie']['year'],
|
|
|
|
# Assuming the movie is not blacklisted, proceed to pull RT score if the user wishes to restrict
|
|
|
|
', '.join(movie['movie']['genres']), movie['movie']['country'].upper())
|
|
|
|
movieRating = None
|
|
|
|
# add movie to radarr
|
|
|
|
if (rating and cfg['omdb']['api_key'] != ''):
|
|
|
|
if radarr.add_movie(movie['movie']['ids']['tmdb'], movie['movie']['title'], movie['movie']['year'],
|
|
|
|
movieRating = rating_helper.get_rating(cfg['omdb']['api_key'], movie['movie']['ids']['imdb'])
|
|
|
|
movie['movie']['ids']['slug'], profile_id, cfg.radarr.root_folder, not no_search):
|
|
|
|
if (movieRating == -1):
|
|
|
|
log.info("ADDED %s (%d)", movie['movie']['title'], movie['movie']['year'])
|
|
|
|
log.debug("Skipping: %s because it did not have a rating/lacked imdbID",
|
|
|
|
if notifications:
|
|
|
|
movie['movie']['title'])
|
|
|
|
callback_notify({'event': 'add_movie', 'list_type': list_type, 'movie': movie['movie']})
|
|
|
|
continue
|
|
|
|
added_movies += 1
|
|
|
|
if (not movieRating or movieRating >= rating):
|
|
|
|
|
|
|
|
log.info("Adding: %s (%d) | Genres: %s | Country: %s", movie['movie']['title'], movie['movie']['year'],
|
|
|
|
|
|
|
|
', '.join(movie['movie']['genres']), movie['movie']['country'].upper())
|
|
|
|
|
|
|
|
# add movie to radarr
|
|
|
|
|
|
|
|
if radarr.add_movie(movie['movie']['ids']['tmdb'], movie['movie']['title'], movie['movie']['year'],
|
|
|
|
|
|
|
|
movie['movie']['ids']['slug'], profile_id, cfg.radarr.root_folder, not no_search):
|
|
|
|
|
|
|
|
log.info("ADDED %s (%d)", movie['movie']['title'], movie['movie']['year'])
|
|
|
|
|
|
|
|
if notifications:
|
|
|
|
|
|
|
|
callback_notify({'event': 'add_movie', 'list_type': list_type, 'movie': movie['movie']})
|
|
|
|
|
|
|
|
added_movies += 1
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
log.error("FAILED adding %s (%d)", movie['movie']['title'], movie['movie']['year'])
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
log.error("FAILED adding %s (%d)", movie['movie']['title'], movie['movie']['year'])
|
|
|
|
log.info("SKIPPING: %s (%d) | Genres: %s | Country: %s", movie['movie']['title'],
|
|
|
|
|
|
|
|
movie['movie']['year'],
|
|
|
|
|
|
|
|
', '.join(movie['movie']['genres']), movie['movie']['country'].upper())
|
|
|
|
# stop adding movies, if added_movies >= add_limit
|
|
|
|
# stop adding movies, if added_movies >= add_limit
|
|
|
|
if add_limit and added_movies >= add_limit:
|
|
|
|
if add_limit and added_movies >= add_limit:
|
|
|
|
break
|
|
|
|
break
|
|
|
|