Beispiel #1
0
def test_episode_repeat():
    assert_result(caper.parse('Show.Name.S01E01.S01E02.DVDrip.x264'), (1.0, {
        'identifier': [
            {'season': '01', 'episode': '01'},
            {'season': '01', 'episode': '02'}
        ],
        'show_name': ['Show', 'Name'],
        'video': [
            {'source': 'DVDrip'},
            {'codec': 'x264'}
        ]
    }))

    assert_that(
        caper.parse('Show.Name.S01E01E02.DVDrip.x264'),
        has_info('identifier', {'season': '01', 'episode': ['01', '02']})
    )

    assert_that(
        caper.parse('Show.Name.S01E01&E02.DVDrip.x264'),
        has_info('identifier', {'season': '01', 'episode': ['01', '02']})
    )

    assert_that(
        caper.parse('Show.Name.S01 E01 & E02.DVDrip.x264'),
        has_info('identifier', [{'season': '01', 'episode': '01'}, {'episode': '02'}])
    )
Beispiel #2
0
def test_season_verbose():
    assert_result(caper.parse('Show.Name.Season.1.DVDrip.x264'), (1.0, {
        'identifier': [{'season': '1'}],
        'show_name': ['Show', 'Name'],
        'video': [
            {'source': 'DVDrip'},
            {'codec': 'x264'}
        ]
    }))
Beispiel #3
0
def test_episode_S00E00():
    assert_result(caper.parse('Show.Name.S01E05.DVDrip.x264'), (1.0, {
        'identifier': [{'season': '01', 'episode': '05'}],
        'show_name': ['Show', 'Name'],
        'video': [
            {'source': 'DVDrip'},
            {'codec': 'x264'}
        ]
    }))
Beispiel #4
0
def test_episode_extend():
    assert_result(caper.parse('Show.Name.S01E01-E02.DVDrip.x264'), (1.0, {
        'identifier': [
            {'season': '01', 'episode_from': '01', 'episode_to': '02'},
        ],
        'show_name': ['Show', 'Name'],
        'video': [
            {'source': 'DVDrip'},
            {'codec': 'x264'}
        ]
    }))
Beispiel #5
0
def test_episode_bare():
    assert_result(caper.parse('Show Name.102.x264'), (0.96, {
        'identifier': [
            {'episode': '02', 'season': '1'}
        ],
        'show_name': ['Show', 'Name'],
        'video': [{'codec': 'x264'}]
    }), (0.94, {
        'show_name': ['Show', 'Name'],
        'video': [{'codec': 'x264'}]
    }))
Beispiel #6
0
def test_episode_date():
    assert_result(caper.parse('Show.Name.2010.11.23.DVDrip.x264'), (1.0, {
        'identifier': [
            {'year': '2010', 'month': '11', 'day': '23'}
        ],
        'show_name': ['Show', 'Name'],
        'video': [
            {'source': 'DVDrip'},
            {'codec': 'x264'}
        ]
    }))
Beispiel #7
0
def test_season_verbose():
    assert_result(caper.parse('Show.Name.Season.1.DVDrip.x264'), (1.0, {
        'identifier': [{
            'season': '1'
        }],
        'show_name': ['Show', 'Name'],
        'video': [{
            'source': 'DVDrip'
        }, {
            'codec': 'x264'
        }]
    }))
Beispiel #8
0
def test_episode_verbose():
    assert_result(caper.parse('Show Name Season 3 Episode 14'), (1.0, {
        'identifier': [
            {'season': '3', 'episode': '14'}
        ],
        'show_name': ['Show', 'Name']
    }))

    assert_result(caper.parse('Show Name Se 3 Ep 14'), (1.0, {
        'identifier': [
            {'season': '3', 'episode': '14'}
        ],
        'show_name': ['Show', 'Name']
    }))
def test_value_constraint():
    parser = build_parser()

    # Capture show name until we hit the identifier
    CaptureGroup(parser, parser.result) \
        .capture_fragment('show_name', single=False) \
        .until_fragment(value__re='identifier') \
        .execute()

    # Build the result from tree
    parser.result.build()

    # Ensure result is valid
    assert_result(parser.result, (1.0, {'show_name': ['Show', 'Name']}))
Beispiel #10
0
def test_episode_part():
    assert_result(caper.parse('Show Name.Part.3'), (1.0, {
        'identifier': [
            {'part': '3'}
        ],
        'show_name': ['Show', 'Name']
    }))

    assert_result(caper.parse('Show Name.Part.1.and.Part.2'), (1.0, {
        'identifier': [
            {'part': '1'},
            {'part': '2'}
        ],
        'show_name': ['Show', 'Name']
    }))
Beispiel #11
0
def test_episode_00x00():
    assert_result(caper.parse('Show.Name.1x5.DVDrip.x264'), (1.0, {
        'identifier': [{'season': '1', 'episode': '5'}],
        'show_name': ['Show', 'Name'],
        'video': [
            {'source': 'DVDrip'},
            {'codec': 'x264'}
        ]
    }))

    assert_result(caper.parse('Show.Name.13x23.DVDrip.x264'), (1.0, {
        'identifier': [{'season': '13', 'episode': '23'}],
        'show_name': ['Show', 'Name'],
        'video': [
            {'source': 'DVDrip'},
            {'codec': 'x264'}
        ]
    }))
def test_fragment_constraint():
    parser = build_parser()

    # Capture show name until we hit the identifier
    group = CaptureGroup(parser, parser.result)\
        .capture_fragment('show_name', single=False)\
        .until_fragment(node__re='identifier')

    # TODO test CaptureStep.__repr__ properly
    repr(group.steps)

    group.execute()

    # Build the result from tree
    parser.result.build()

    # Ensure result is valid
    assert_result(parser.result, (1.0, {'show_name': ['Show', 'Name']}))