From 3d6200a3e8c24f913cc50aa3117e9841da8631e5 Mon Sep 17 00:00:00 2001 From: desimaniac <5501908+desimaniac@users.noreply.github.com> Date: Fri, 12 Jul 2019 12:46:35 -0500 Subject: [PATCH] Movies: Revert to default min avail if invalid entry is given in config --- traktarr.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/traktarr.py b/traktarr.py index bfcd944..d266a01 100755 --- a/traktarr.py +++ b/traktarr.py @@ -445,10 +445,14 @@ def movie(movie_id, folder=None, minimum_availability=None, no_search=False): log.debug('Set root folder to: \'%s\'', cfg['radarr']['root_folder']) # replace radarr.minimum_availability if minimum_availability is supplied - if cfg['radarr']['minimum_availability'].strip() == '': + valid_min_avail = ['announced', 'in_cinemas', 'released', 'predb'] + + if cfg['radarr']['minimum_availability'] not in valid_min_avail: cfg['radarr']['minimum_availability'] = 'released' + if minimum_availability: cfg['radarr']['minimum_availability'] = minimum_availability + log.debug('Set minimum availability to: \'%s\'', cfg['radarr']['minimum_availability']) # validate trakt api_key @@ -571,10 +575,14 @@ def movies(list_type, add_limit=0, add_delay=2.5, sort='votes', rating=None, gen log.debug('Set root folder to: \'%s\'', cfg['radarr']['root_folder']) # replace radarr.minimum_availability if minimum_availability is supplied - if cfg['radarr']['minimum_availability'].strip() == '': + valid_min_avail = ['announced', 'in_cinemas', 'released', 'predb'] + + if cfg['radarr']['minimum_availability'] not in valid_min_avail: cfg['radarr']['minimum_availability'] = 'released' + if minimum_availability: cfg['radarr']['minimum_availability'] = minimum_availability + log.debug('Set minimum availability to: \'%s\'', cfg['radarr']['minimum_availability']) # validate trakt api_key