Movies: Revert to default min avail if invalid entry is given in config

pull/93/head
desimaniac 5 years ago
parent a4a6807bed
commit 3d6200a3e8

@ -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']) log.debug('Set root folder to: \'%s\'', cfg['radarr']['root_folder'])
# replace radarr.minimum_availability if minimum_availability is supplied # 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' cfg['radarr']['minimum_availability'] = 'released'
if minimum_availability: if minimum_availability:
cfg['radarr']['minimum_availability'] = minimum_availability cfg['radarr']['minimum_availability'] = minimum_availability
log.debug('Set minimum availability to: \'%s\'', cfg['radarr']['minimum_availability']) log.debug('Set minimum availability to: \'%s\'', cfg['radarr']['minimum_availability'])
# validate trakt api_key # 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']) log.debug('Set root folder to: \'%s\'', cfg['radarr']['root_folder'])
# replace radarr.minimum_availability if minimum_availability is supplied # 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' cfg['radarr']['minimum_availability'] = 'released'
if minimum_availability: if minimum_availability:
cfg['radarr']['minimum_availability'] = minimum_availability cfg['radarr']['minimum_availability'] = minimum_availability
log.debug('Set minimum availability to: \'%s\'', cfg['radarr']['minimum_availability']) log.debug('Set minimum availability to: \'%s\'', cfg['radarr']['minimum_availability'])
# validate trakt api_key # validate trakt api_key

Loading…
Cancel
Save