Radarr: Tweaked min availability code

pull/105/head
desimaniac 5 years ago
parent 5694839734
commit d7554c403d

@ -13,15 +13,15 @@ class Radarr(PVR):
@backoff.on_predicate(backoff.expo, lambda x: x is None, max_tries=4, on_backoff=backoff_handler) @backoff.on_predicate(backoff.expo, lambda x: x is None, max_tries=4, on_backoff=backoff_handler)
def add_movie(self, movie_tmdbid, movie_title, movie_year, movie_title_slug, profile_id, root_folder, def add_movie(self, movie_tmdbid, movie_title, movie_year, movie_title_slug, profile_id, root_folder,
min_avail, search_missing=False): min_availability_temp, search_missing=False):
payload = self._prepare_add_object_payload(movie_title, movie_title_slug, profile_id, root_folder) payload = self._prepare_add_object_payload(movie_title, movie_title_slug, profile_id, root_folder)
# replace radarr minimum_availability if supplied # replace radarr minimum_availability if supplied
if min_avail == 'announced': if min_availability_temp == 'announced':
minimum_availability = 'announced' minimum_availability = 'announced'
elif min_avail == 'in_cinemas': elif min_availability_temp == 'in_cinemas':
minimum_availability = 'inCinemas' minimum_availability = 'inCinemas'
elif min_avail == 'predb': elif min_availability_temp == 'predb':
minimum_availability = 'preDB' minimum_availability = 'preDB'
else: else:
minimum_availability = 'released' minimum_availability = 'released'

@ -455,11 +455,10 @@ def movie(movie_id, folder=None, minimum_availability=None, no_search=False):
# replace radarr.minimum_availability if minimum_availability is supplied # replace radarr.minimum_availability if minimum_availability is supplied
valid_min_avail = ['announced', 'in_cinemas', 'released', 'predb'] 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: if minimum_availability:
cfg['radarr']['minimum_availability'] = minimum_availability cfg['radarr']['minimum_availability'] = minimum_availability
elif cfg['radarr']['minimum_availability'] not in valid_min_avail:
cfg['radarr']['minimum_availability'] = 'released'
log.debug('Set minimum availability to: \'%s\'', cfg['radarr']['minimum_availability']) log.debug('Set minimum availability to: \'%s\'', cfg['radarr']['minimum_availability'])
@ -585,11 +584,10 @@ def movies(list_type, add_limit=0, add_delay=2.5, sort='votes', rating=None, gen
# replace radarr.minimum_availability if minimum_availability is supplied # replace radarr.minimum_availability if minimum_availability is supplied
valid_min_avail = ['announced', 'in_cinemas', 'released', 'predb'] 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: if minimum_availability:
cfg['radarr']['minimum_availability'] = minimum_availability cfg['radarr']['minimum_availability'] = minimum_availability
elif cfg['radarr']['minimum_availability'] not in valid_min_avail:
cfg['radarr']['minimum_availability'] = 'released'
log.debug('Set minimum availability to: \'%s\'', cfg['radarr']['minimum_availability']) log.debug('Set minimum availability to: \'%s\'', cfg['radarr']['minimum_availability'])

Loading…
Cancel
Save