Handle exceptions in a differnt place
This commit is contained in:
parent
ace92991b3
commit
82b247d1c0
2 changed files with 13 additions and 17 deletions
|
@ -29,20 +29,20 @@ class INIParser(object):
|
||||||
self.ciscoasa_enabled = False
|
self.ciscoasa_enabled = False
|
||||||
self.ciscoasa_firewalls = []
|
self.ciscoasa_firewalls = []
|
||||||
|
|
||||||
try:
|
self.parse_opts()
|
||||||
self.parse_opts()
|
|
||||||
except configparser.NoOptionError as e:
|
|
||||||
logger.error(e)
|
|
||||||
|
|
||||||
def enable_check(self, server_type=None):
|
def enable_check(self, server_type=None):
|
||||||
t = server_type
|
t = server_type
|
||||||
global_server_ids = self.config.get('global', t)
|
try:
|
||||||
if global_server_ids.lower() in ['false', 'no', '0']:
|
global_server_ids = self.config.get('global', t)
|
||||||
logger.info('%s disabled.', t.upper())
|
if global_server_ids.lower() in ['false', 'no', '0']:
|
||||||
return False
|
logger.info('%s disabled.', t.upper())
|
||||||
else:
|
return False
|
||||||
sids = self.clean_check(global_server_ids, t)
|
else:
|
||||||
return sids
|
sids = self.clean_check(global_server_ids, t)
|
||||||
|
return sids
|
||||||
|
except configparser.NoOptionError as e:
|
||||||
|
logger.error(e)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def clean_check(server_id_list, server_type=None):
|
def clean_check(server_id_list, server_type=None):
|
||||||
|
|
|
@ -46,9 +46,7 @@ class RadarrAPI(object):
|
||||||
|
|
||||||
movie_name = '{} ({})'.format(movie.title, movie.year)
|
movie_name = '{} ({})'.format(movie.title, movie.year)
|
||||||
|
|
||||||
title_slug = movie.titleSlug
|
missing.append((movie_name, ma, movie.tmdbId, movie.titleSlug))
|
||||||
|
|
||||||
missing.append((movie_name, ma, movie.tmdbId, title_slug))
|
|
||||||
|
|
||||||
|
|
||||||
for title, ma, mid, title_slug in missing:
|
for title, ma, mid, title_slug in missing:
|
||||||
|
@ -103,15 +101,13 @@ class RadarrAPI(object):
|
||||||
|
|
||||||
name = '{} ({})'.format(movie.title, movie.year)
|
name = '{} ({})'.format(movie.title, movie.year)
|
||||||
|
|
||||||
title_slug = movie.titleSlug
|
|
||||||
|
|
||||||
if queue_item.protocol.upper() == 'USENET':
|
if queue_item.protocol.upper() == 'USENET':
|
||||||
protocol_id = 1
|
protocol_id = 1
|
||||||
else:
|
else:
|
||||||
protocol_id = 0
|
protocol_id = 0
|
||||||
|
|
||||||
queue.append((name, queue_item.quality['quality']['name'], queue_item.protocol.upper(),
|
queue.append((name, queue_item.quality['quality']['name'], queue_item.protocol.upper(),
|
||||||
protocol_id, queue_item.id, title_slug))
|
protocol_id, queue_item.id, movie.titleSlug))
|
||||||
|
|
||||||
for name, quality, protocol, protocol_id, qid, title_slug in queue:
|
for name, quality, protocol, protocol_id, qid, title_slug in queue:
|
||||||
hash_id = hashit('{}{}{}'.format(self.server.id, name, quality))
|
hash_id = hashit('{}{}{}'.format(self.server.id, name, quality))
|
||||||
|
|
Loading…
Reference in a new issue