def set_up_anidb_connection():
 if (not sickbeard.USE_ANIDB):
  logger.log(u'Usage of anidb disabled. Skiping', logger.DEBUG)
  return False
 if ((not sickbeard.ANIDB_USERNAME) and (not sickbeard.ANIDB_PASSWORD)):
  logger.log(u'anidb username and/or password are not set. Aborting anidb lookup.', logger.DEBUG)
  return False
 if (not sickbeard.ADBA_CONNECTION):
  def anidb_logger(msg):
   return logger.log(u'anidb: {0} '.format(msg), logger.DEBUG)
  try:
   sickbeard.ADBA_CONNECTION = adba.Connection(keepAlive=True, log=anidb_logger)
  except Exception as error:
   logger.log(u'anidb exception msg: {0} '.format(error), logger.WARNING)
   return False
 try:
  if (not sickbeard.ADBA_CONNECTION.authed()):
   sickbeard.ADBA_CONNECTION.auth(sickbeard.ANIDB_USERNAME, sickbeard.ANIDB_PASSWORD)
  else:
   return True
 except Exception as error:
  logger.log(u'anidb exception msg: {0} '.format(error), logger.WARNING)
  return False
 return sickbeard.ADBA_CONNECTION.authed()

def set_up_anidb_connection ( ) : if ( not sickbeard . USE_ANIDB ) : logger . log ( u'Usage of anidb disabled. Skiping' , logger . DEBUG ) return False if ( ( not sickbeard . ANIDB_USERNAME ) and ( not sickbeard . ANIDB_PASSWORD ) ) : logger . log ( u'anidb username and/or password are not set. Aborting anidb lookup.' , logger . DEBUG ) return False if ( not sickbeard . ADBA_CONNECTION ) : def anidb_logger ( msg ) : return logger . log ( u'anidb: {0} ' . format ( msg ) , logger . DEBUG ) try : sickbeard . ADBA_CONNECTION = adba . Connection ( keepAlive = True , log = anidb_logger ) except Exception as error : logger . log ( u'anidb exception msg: {0} ' . format ( error ) , logger . WARNING ) return False try : if ( not sickbeard . ADBA_CONNECTION . authed ( ) ) : sickbeard . ADBA_CONNECTION . auth ( sickbeard . ANIDB_USERNAME , sickbeard . ANIDB_PASSWORD ) else : return True except Exception as error : logger . log ( u'anidb exception msg: {0} ' . format ( error ) , logger . WARNING ) return False return sickbeard . ADBA_CONNECTION . authed ( )
connect to anidb .