|
|
@ -33,26 +33,30 @@ class SonarrSignalrClient:
|
|
|
|
self.connection = None
|
|
|
|
self.connection = None
|
|
|
|
|
|
|
|
|
|
|
|
def start(self):
|
|
|
|
def start(self):
|
|
|
|
if get_sonarr_version().startswith('2.'):
|
|
|
|
sonarr_version = get_sonarr_version()
|
|
|
|
|
|
|
|
if sonarr_version.startswith('2.'):
|
|
|
|
logging.warning('BAZARR can only sync from Sonarr v3 SignalR feed to get real-time update. You should '
|
|
|
|
logging.warning('BAZARR can only sync from Sonarr v3 SignalR feed to get real-time update. You should '
|
|
|
|
'consider upgrading.')
|
|
|
|
'consider upgrading your version({}).'.format(sonarr_version))
|
|
|
|
return
|
|
|
|
raise gevent.GreenletExit
|
|
|
|
|
|
|
|
else:
|
|
|
|
logging.info('BAZARR trying to connect to Sonarr SignalR feed...')
|
|
|
|
logging.info('BAZARR trying to connect to Sonarr SignalR feed...')
|
|
|
|
self.configure()
|
|
|
|
self.configure()
|
|
|
|
while not self.connection.started:
|
|
|
|
while not self.connection.started:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
self.connection.start()
|
|
|
|
self.connection.start()
|
|
|
|
except ConnectionError:
|
|
|
|
except ConnectionError:
|
|
|
|
gevent.sleep(5)
|
|
|
|
gevent.sleep(5)
|
|
|
|
except json.decoder.JSONDecodeError:
|
|
|
|
except json.decoder.JSONDecodeError:
|
|
|
|
logging.error("BAZARR cannot parse JSON returned by SignalR feed. This is a known issue when Sonarr "
|
|
|
|
logging.error("BAZARR cannot parse JSON returned by SignalR feed. This is a known issue when "
|
|
|
|
"doesn't have write permission to it's /config/xdg directory.")
|
|
|
|
"Sonarr have issue accessing it's /config/xdg directory. You should delete that "
|
|
|
|
self.stop()
|
|
|
|
"directory and restart Sonarr.")
|
|
|
|
logging.info('BAZARR SignalR client for Sonarr is connected and waiting for events.')
|
|
|
|
raise gevent.GreenletExit
|
|
|
|
if not args.dev:
|
|
|
|
else:
|
|
|
|
scheduler.add_job(update_series, kwargs={'send_event': True}, max_instances=1)
|
|
|
|
logging.info('BAZARR SignalR client for Sonarr is connected and waiting for events.')
|
|
|
|
scheduler.add_job(sync_episodes, kwargs={'send_event': True}, max_instances=1)
|
|
|
|
finally:
|
|
|
|
|
|
|
|
if not args.dev:
|
|
|
|
|
|
|
|
scheduler.add_job(update_series, kwargs={'send_event': True}, max_instances=1)
|
|
|
|
|
|
|
|
scheduler.add_job(sync_episodes, kwargs={'send_event': True}, max_instances=1)
|
|
|
|
|
|
|
|
|
|
|
|
def stop(self, log=True):
|
|
|
|
def stop(self, log=True):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|