def get_scene_exception_by_name(show_name):
 myDB = db.DBConnection('cache.db')
 exception_result = myDB.select('SELECT tvdb_id FROM scene_exceptions WHERE LOWER(show_name) = ?', [show_name.lower()])
 if exception_result:
  return int(exception_result[0]['tvdb_id'])
 all_exception_results = myDB.select('SELECT DISTINCT show_name, tvdb_id FROM scene_exceptions')
 for cur_exception in all_exception_results:
  cur_exception_name = cur_exception['show_name']
  cur_tvdb_id = int(cur_exception['tvdb_id'])
  if (show_name.lower() in (cur_exception_name.lower(), helpers.sanitizeSceneName(cur_exception_name).lower().replace('.', ' '))):
   logger.log(((u'Scene exception lookup got tvdb id ' + str(cur_tvdb_id)) + u', using that'), logger.DEBUG)
   return cur_tvdb_id
 return None

def get_scene_exception_by_name ( show_name ) : myDB = db . DBConnection ( 'cache.db' ) exception_result = myDB . select ( 'SELECT tvdb_id FROM scene_exceptions WHERE LOWER(show_name) = ?' , [ show_name . lower ( ) ] ) if exception_result : return int ( exception_result [ 0 ] [ 'tvdb_id' ] ) all_exception_results = myDB . select ( 'SELECT DISTINCT show_name, tvdb_id FROM scene_exceptions' ) for cur_exception in all_exception_results : cur_exception_name = cur_exception [ 'show_name' ] cur_tvdb_id = int ( cur_exception [ 'tvdb_id' ] ) if ( show_name . lower ( ) in ( cur_exception_name . lower ( ) , helpers . sanitizeSceneName ( cur_exception_name ) . lower ( ) . replace ( '.' , ' ' ) ) ) : logger . log ( ( ( u'Scene exception lookup got tvdb id ' + str ( cur_tvdb_id ) ) + u', using that' ) , logger . DEBUG ) return cur_tvdb_id return None
given a show name .