コード例 #1
0
def is_ignored(rating_key, item=None):
    """
    check whether an item, its show/season/section is in the soft or the hard ignore list
    :param rating_key:
    :param item:
    :return:
    """
    # item in soft ignore list
    if rating_key in ignore_list["videos"]:
        Log.Debug("Item %s is in the soft ignore list" % rating_key)
        return True

    item = item or get_item(rating_key)
    kind = get_item_kind(item)

    # show in soft ignore list
    if kind == "Episode" and item.show.rating_key in ignore_list["series"]:
        Log.Debug("Item %s's show is in the soft ignore list" % rating_key)
        return True

    # section in soft ignore list
    if item.section.key in ignore_list["sections"]:
        Log.Debug("Item %s's section is in the soft ignore list" % rating_key)
        return True

    # physical/path ignore
    if config.ignore_sz_files or config.ignore_paths:
        # normally check current item folder and the library
        check_ignore_paths = [".", "../"]
        if kind == "Episode":
            # series/episode, we've got a season folder here, also
            check_ignore_paths.append("../../")

        for part in item.media.parts:
            if config.ignore_paths and config.is_path_ignored(part.file):
                Log.Debug("Item %s's path is manually ignored" % rating_key)
                return True

            if config.ignore_sz_files:
                for sub_path in check_ignore_paths:
                    if config.is_physically_ignored(
                            os.path.abspath(
                                os.path.join(os.path.dirname(part.file),
                                             sub_path))):
                        Log.Debug(
                            "An ignore file exists in either the items or its parent folders"
                        )
                        return True

    return False
コード例 #2
0
def is_physically_ignored(fn, kind):
    if config.ignore_sz_files or config.ignore_paths:
        # normally check current item folder and the library
        check_ignore_paths = [".", "../"]
        if kind == "Episode":
            # series/episode, we've got a season folder here, also
            check_ignore_paths.append("../../")

        if config.ignore_paths and config.is_path_ignored(fn):
            Log.Debug("Item %s's path is manually ignored" % fn)
            return True

        if config.ignore_sz_files:
            for sub_path in check_ignore_paths:
                if config.is_physically_ignored(os.path.normpath(os.path.join(os.path.dirname(fn), sub_path))):
                    Log.Debug("An ignore file exists in either the items or its parent folders")
                    return True
コード例 #3
0
ファイル: items.py プロジェクト: faacunha/Sub-Zero.bundle
def is_ignored(rating_key, item=None):
    """
    check whether an item, its show/season/section is in the soft or the hard ignore list
    :param rating_key:
    :param item:
    :return:
    """
    # item in soft ignore list
    if rating_key in ignore_list["videos"]:
        Log.Debug("Item %s is in the soft ignore list" % rating_key)
        return True

    item = item or get_item(rating_key)
    kind = get_item_kind(item)

    # show in soft ignore list
    if kind == "Episode" and item.show.rating_key in ignore_list["series"]:
        Log.Debug("Item %s's show is in the soft ignore list" % rating_key)
        return True

    # section in soft ignore list
    if item.section.key in ignore_list["sections"]:
        Log.Debug("Item %s's section is in the soft ignore list" % rating_key)
        return True

    # physical/path ignore
    if Prefs["subtitles.ignore_fs"] or config.ignore_paths:
        # normally check current item folder and the library
        check_ignore_paths = [".", "../"]
        if kind == "Episode":
            # series/episode, we've got a season folder here, also
            check_ignore_paths.append("../../")

        for part in item.media.parts:
            if config.ignore_paths and config.is_path_ignored(part.file):
                Log.Debug("Item %s's path is manually ignored" % rating_key)
                return True

            if Prefs["subtitles.ignore_fs"]:
                for sub_path in check_ignore_paths:
                    if config.is_physically_ignored(os.path.abspath(os.path.join(os.path.dirname(part.file), sub_path))):
                        Log.Debug("An ignore file exists in either the items or its parent folders")
                        return True

    return False