Exemplo n.º 1
0
def checkExclusion(fullpath):

    if not fullpath:
        return True

    # Live TV exclusion
    if fullpath.startswith("pvr://") and getSettingAsBool('ExcludeLiveTV'):
        logger.debug("checkExclusion(): Video is playing via Live TV, which is currently set as excluded location.")
        return True

    # HTTP exclusion
    if fullpath.startswith(("http://", "https://")) and getSettingAsBool('ExcludeHTTP'):
        logger.debug("checkExclusion(): Video is playing via HTTP source, which is currently set as excluded location.")
        return True

    # Path exclusions
    ExcludePath = getSetting('ExcludePath').encode('utf-8') # Encode this as fullpath is already encoded
    if ExcludePath != "" and getSettingAsBool('ExcludePathOption'):
        if fullpath.startswith(ExcludePath):
            logger.debug("checkExclusion(): Video is from location, which is currently set as excluded path 1.")
            return True

    found = False
    for x in xrange(2,13):
        found |= utilities.checkExcludePath(getSetting('ExcludePath%i' % x).encode('utf-8'), getSettingAsBool('ExcludePathOption%i' % x), fullpath, x)

    return found
Exemplo n.º 2
0
def checkExclusion(fullpath):

    if not fullpath:
        return True

    # Live TV exclusion
    if fullpath.startswith("pvr://") and getSettingAsBool('ExcludeLiveTV'):
        logger.debug(
            "checkExclusion(): Video is playing via Live TV, which is currently set as excluded location."
        )
        return True

    # HTTP exclusion
    if fullpath.startswith(
        ("http://", "https://")) and getSettingAsBool('ExcludeHTTP'):
        logger.debug(
            "checkExclusion(): Video is playing via HTTP source, which is currently set as excluded location."
        )
        return True

    # Plugin exclusion
    if fullpath.startswith("plugin://") and getSettingAsBool('ExcludePlugin'):
        logger.debug(
            "checkExclusion(): Video is playing via Plugin source, which is currently set as excluded location."
        )
        return True

    # Script exclusion
    if xbmcgui.Window(10000).getProperty(
            'script.trakt.paused') == 'true' and getSettingAsBool(
                'ExcludeScript'):
        logger.debug(
            "checkExclusion(): Video is playing via Script source, which is currently set as excluded location."
        )
        return True

    # Path exclusions
    ExcludePath = getSetting('ExcludePath').encode(
        'utf-8')  # Encode this as fullpath is already encoded
    if ExcludePath != "" and getSettingAsBool('ExcludePathOption'):
        if fullpath.startswith(ExcludePath):
            logger.debug(
                "checkExclusion(): Video is from location, which is currently set as excluded path 1."
            )
            return True

    found = False
    for x in range(2, 13):
        found |= utilities.checkExcludePath(
            getSetting('ExcludePath%i' % x).encode('utf-8'),
            getSettingAsBool('ExcludePathOption%i' % x), fullpath, x)

    return found
Exemplo n.º 3
0
def checkExclusion(fullpath):

    if not fullpath:
        return True

    # Live TV exclusion
    if fullpath.startswith("pvr://") and getSettingAsBool('ExcludeLiveTV'):
        logger.debug("checkExclusion(): Video is playing via Live TV, which is currently set as excluded location.")
        return True

    # HTTP exclusion
    if fullpath.startswith(("http://", "https://")) and getSettingAsBool('ExcludeHTTP'):
        logger.debug("checkExclusion(): Video is playing via HTTP source, which is currently set as excluded location.")
        return True

    # Plugin exclusion
    if fullpath.startswith("plugin://") and getSettingAsBool('ExcludePlugin'):
        logger.debug("checkExclusion(): Video is playing via Plugin source, which is currently set as excluded location.")
        return True

    # Script exclusion
    if xbmcgui.Window(10000).getProperty('script.trakt.paused') == 'true' and getSettingAsBool('ExcludeScript'):
        logger.debug("checkExclusion(): Video is playing via Script source, which is currently set as excluded location.")
        return True

    # Path exclusions
    ExcludePath = getSetting('ExcludePath').encode('utf-8') # Encode this as fullpath is already encoded
    if ExcludePath != "" and getSettingAsBool('ExcludePathOption'):
        if fullpath.startswith(ExcludePath):
            logger.debug("checkExclusion(): Video is from location, which is currently set as excluded path 1.")
            return True

    found = False
    for x in range(2,13):
        found |= utilities.checkExcludePath(getSetting('ExcludePath%i' % x).encode('utf-8'), getSettingAsBool('ExcludePathOption%i' % x), fullpath, x)

    return found
Exemplo n.º 4
0
def test_checkExcludePath_Path_Disabled():
    assert utilities.checkExcludePath('C:/excludes/', False,
                                      'C:/excludes/video.mkv', 2) == False
Exemplo n.º 5
0
def test_checkExcludePath_Path_NotExcluded():
    assert utilities.checkExcludePath('C:/excludes/', True,
                                      'C:/notexcluded/video.mkv', 2) == False
Exemplo n.º 6
0
def test_checkExcludePath_Path_Excluded_Special_Chars():
    assert utilities.checkExcludePath('C:/öäüß%6/', True,
                                      'C:/öäüß%6/video.mkv', 2)
Exemplo n.º 7
0
def test_checkExcludePath_Path_Excluded():
    assert utilities.checkExcludePath('C:/excludes/', True,
                                      'C:/excludes/video.mkv', 2)
Exemplo n.º 8
0
def test_checkExcludePath_Path_Disabled():
    assert utilities.checkExcludePath('C:/excludes/', False, 'C:/excludes/video.mkv', 2) == False
Exemplo n.º 9
0
def test_checkExcludePath_Path_NotExcluded():
    assert utilities.checkExcludePath('C:/excludes/', True, 'C:/notexcluded/video.mkv', 2) == False
Exemplo n.º 10
0
def test_checkExcludePath_Path_Excluded_Special_Chars():
    assert utilities.checkExcludePath('C:/öäüß%6/', True, 'C:/öäüß%6/video.mkv', 2)
Exemplo n.º 11
0
def test_checkExcludePath_Path_Excluded():
    assert utilities.checkExcludePath('C:/excludes/', True, 'C:/excludes/video.mkv', 2)