Add --dry-run flag to report what would happen in a multiple show/movie run

pull/152/head
chazlarson 4 years ago committed by salty
parent 0a49f0566e
commit 5c5ab0f4af

@ -344,6 +344,10 @@ def show(
'--remove-rejected-from-recommended', '--remove-rejected-from-recommended',
is_flag=True, is_flag=True,
help='Removes rejected/existing shows from recommended.') help='Removes rejected/existing shows from recommended.')
@click.option(
'--dry-run',
is_flag=True,
help='Shows the list of shows remaining after processing, takes no action on them.')
def shows( def shows(
list_type, list_type,
add_limit=0, add_limit=0,
@ -359,6 +363,7 @@ def shows(
authenticate_user=None, authenticate_user=None,
ignore_blacklist=False, ignore_blacklist=False,
remove_rejected_from_recommended=False, remove_rejected_from_recommended=False,
dry_run=False,
): ):
from media.sonarr import Sonarr from media.sonarr import Sonarr
@ -641,6 +646,9 @@ def shows(
(series['show']['network'] or 'N/A').upper(), (series['show']['network'] or 'N/A').upper(),
) )
if dry_run:
log.info("dry-run: SKIPPING")
else:
# add show to sonarr # add show to sonarr
if sonarr.add_series( if sonarr.add_series(
series['show']['ids']['tvdb'], series['show']['ids']['tvdb'],
@ -855,6 +863,10 @@ def movie(
'--remove-rejected-from-recommended', '--remove-rejected-from-recommended',
is_flag=True, is_flag=True,
help='Removes rejected/existing movies from recommended.') help='Removes rejected/existing movies from recommended.')
@click.option(
'--dry-run',
is_flag=True,
help='Shows the list of movies remaining after processing, takes no action on them.')
def movies( def movies(
list_type, list_type,
add_limit=0, add_limit=0,
@ -872,6 +884,7 @@ def movies(
authenticate_user=None, authenticate_user=None,
ignore_blacklist=False, ignore_blacklist=False,
remove_rejected_from_recommended=False, remove_rejected_from_recommended=False,
dry_run=False,
): ):
from media.radarr import Radarr from media.radarr import Radarr
@ -1160,6 +1173,9 @@ def movies(
movie_genres, movie_genres,
) )
if dry_run:
log.info("dry-run: SKIPPING")
else:
# add movie to radarr # add movie to radarr
if radarr.add_movie( if radarr.add_movie(
sorted_movie['movie']['ids']['tmdb'], sorted_movie['movie']['ids']['tmdb'],

Loading…
Cancel
Save