Example #1
0
def get_scene_exceptions(tvdb_id, ignoreCustom=False):
    """
    Given a tvdb_id, return a list of all the scene exceptions.
    """

    myDB = db.DBConnection("cache.db")
    exceptions = myDB.select(
        "SELECT show_name FROM scene_exceptions WHERE tvdb_id = ?", [tvdb_id])
    if ignoreCustom:
        return [cur_exception["show_name"] for cur_exception in exceptions]
    else:
        return list(
            set([cur_exception["show_name"] for cur_exception in exceptions] +
                get_custom_exceptions(tvdb_id)))
def get_scene_exceptions(tvdb_id, ignoreCustom=False):
    """
    Given a tvdb_id, return a list of all the scene exceptions.
    """
    global _dyn_cache
    
    if not tvdb_id:
        return []

    try: 
        scene_exceptions = _dyn_cache[str(tvdb_id)]
    except KeyError:
        myDB = db.DBConnection("cache.db")
        scene_exceptions = [x["show_name"] for x in myDB.select("SELECT show_name FROM scene_exceptions WHERE tvdb_id = ?", [tvdb_id])]
        _dyn_cache[str(tvdb_id)] = scene_exceptions

    if ignoreCustom:
        return scene_exceptions
    else:
        return list(set(scene_exceptions + get_custom_exceptions(tvdb_id)))
def get_scene_exceptions(tvdb_id, ignoreCustom=False):
    """
    Given a tvdb_id, return a list of all the scene exceptions.
    """
    global _dyn_cache

    if not tvdb_id:
        return []

    try:
        scene_exceptions = _dyn_cache[str(tvdb_id)]
    except KeyError:
        myDB = db.DBConnection("cache.db")
        scene_exceptions = [
            x["show_name"] for x in myDB.select(
                "SELECT show_name FROM scene_exceptions WHERE tvdb_id = ?",
                [tvdb_id])
        ]
        _dyn_cache[str(tvdb_id)] = scene_exceptions

    if ignoreCustom:
        return scene_exceptions
    else:
        return list(set(scene_exceptions + get_custom_exceptions(tvdb_id)))
def get_scene_exceptions(tvdb_id, ignoreCustom=False):
    """
    Given a tvdb_id, return a list of all the scene exceptions.
    """

    myDB = db.DBConnection("cache.db")
    exceptions = myDB.select(u"SELECT show_name FROM scene_exceptions WHERE tvdb_id = ?", [tvdb_id])
    if ignoreCustom:
        return [cur_exception["show_name"] for cur_exception in exceptions]
    else:
        return list(set([cur_exception["show_name"] for cur_exception in exceptions] + get_custom_exceptions(tvdb_id)))