Ejemplo 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
Ejemplo n.º 2
0
def test_checkExcludePath_Path_Disabled():
    assert utilities.checkExcludePath('C:/excludes/', False,
                                      'C:/excludes/video.mkv', 2) == False
Ejemplo n.º 3
0
def test_checkExcludePath_Path_NotExcluded():
    assert utilities.checkExcludePath('C:/excludes/', True,
                                      'C:/notexcluded/video.mkv', 2) == False
Ejemplo n.º 4
0
def test_checkExcludePath_Path_Excluded_Special_Chars():
    assert utilities.checkExcludePath('C:/öäüß%6/', True,
                                      'C:/öäüß%6/video.mkv', 2)
Ejemplo n.º 5
0
def test_checkExcludePath_Path_Excluded():
    assert utilities.checkExcludePath('C:/excludes/', True,
                                      'C:/excludes/video.mkv', 2)
Ejemplo n.º 6
0
def test_checkExcludePath_Path_Disabled():
    assert utilities.checkExcludePath('C:/excludes/', False, 'C:/excludes/video.mkv', 2) == False
Ejemplo n.º 7
0
def test_checkExcludePath_Path_NotExcluded():
    assert utilities.checkExcludePath('C:/excludes/', True, 'C:/notexcluded/video.mkv', 2) == False
Ejemplo n.º 8
0
def test_checkExcludePath_Path_Excluded_Special_Chars():
    assert utilities.checkExcludePath('C:/öäüß%6/', True, 'C:/öäüß%6/video.mkv', 2)
Ejemplo n.º 9
0
def test_checkExcludePath_Path_Excluded():
    assert utilities.checkExcludePath('C:/excludes/', True, 'C:/excludes/video.mkv', 2)