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'}])
    )
Exemple #2
0
def test_alternative():
    result = caper.parse(
        '[123456]-[FULL]-[#abc.123]-[ Show.Name.S03E05.720p.WEB-DL.DD5.1.H.264-GROUP ]-[1/1] - "Show.Name.S03E05.WEB-DL.DD5.1.H.264-GROUP.nzb" yEnc',
        'usenet'
    )

    assert_that(result, has_info('detail', {'file_name': 'Show.Name.S03E05.WEB-DL.DD5.1.H.264-GROUP.nzb', 'extra': 'yEnc'}))

    assert_that(result, has_info('part', {'current': '1', 'total': '1'}))

    assert_that(result, has_info('release_name', [
        (None, '', ' '),
        (' ', 'Show', '.'),
        ('.', 'Name', '.'),
        ('.', 'S03E05', '.'),
        ('.', '720p', '.'),
        ('.', 'WEB', '-'),
        ('-', 'DL', '.'),
        ('.', 'DD5', '.'),
        ('.', '1', '.'),
        ('.', 'H', '.'),
        ('.', '264', '-'),
        ('-', 'GROUP', ' ')
    ]))

    assert_that(result, has_info('usenet', {'group': '#abc.123'}))
    assert_that(result, has_info('usenet', {'code': '123456'}))
def test_roman_numerals():
    assert_that(caper.parse('Show.Name.Part.III.DVDrip.x264'),
                has_info('identifier', {'part': 3}))

    assert_that(caper.parse('Show.Name.Part.IV.DVDrip.x264'),
                has_info('identifier', {'part': 4}))

    assert_that(caper.parse('Show.Name.Part.XI.DVDrip.x264'),
                has_info('identifier', {'part': 11}))
def test_source():
    assert_that(caper.parse('Show Name (2011) S01E01 720p WEBDL x264-GROUP'),
                has_info('video', {'source': 'WEBDL'}))

    assert_that(caper.parse('Show Name (2011) S01E01 720p WEB DL x264-GROUP'),
                has_info('video', {'source': ['WEB', 'DL']}))

    assert_that(caper.parse('Show Name (2011) S01E01 720p WEB-DL x264-GROUP'),
                has_info('video', {'source': ['WEB', 'DL']}))
Exemple #5
0
def test_resolution():
    assert_that(caper.parse('Show Name.S01E05.720p-GROUP'),
                has_info('video', {'resolution': '720p'}))

    assert_that(caper.parse('Show Name.S01E05.1080p'),
                has_info('video', {'resolution': '1080p'}))

    assert_that(caper.parse('Show Name.S01E05.480p.HDTV-GROUP'),
                has_info('video', {'resolution': '480p'}))
Exemple #6
0
def test_dvd_encoding():
    assert_that(
        caper.parse('Show Name (2011) S01 R1 NTSC'),
        has_info('dvd', {'encoding': 'NTSC'})
    )

    assert_that(
        caper.parse('Show Name (2011) S01 R4 PAL'),
        has_info('dvd', {'encoding': 'PAL'})
    )
Exemple #7
0
def test_dvd_region():
    assert_that(
        caper.parse('Show Name (2011) S01 R1 NTSC'),
        has_info('dvd', {'region': '1'})
    )

    assert_that(
        caper.parse('Show Name (2011) S01 R4 PAL'),
        has_info('dvd', {'region': '4'})
    )
Exemple #8
0
def test_codec():
    assert_that(
        caper.parse('Show Name 2013 S01E01 720p WEB-DL H264 GROUP'),
        has_info('video', {'codec': 'H264'})
    )

    assert_that(
        caper.parse('Show Name 2013 S01E01 720p WEB-DL H 264 GROUP'),
        has_info('video', {'codec': ['H', '264']})
    )
Exemple #9
0
def test_dvd_disc():
    assert_that(
        caper.parse('Show Name (2011) S01 R1 NTSC DISC3'),
        has_info('dvd', {'disc': '3'})
    )

    assert_that(
        caper.parse('Show Name (2011) S01 R4 PAL D2'),
        has_info('dvd', {'disc': '2'})
    )
Exemple #10
0
def test_season_range():
    assert_that(
        caper.parse('Show.Name.S01-S03.DVDrip.x264'),
        has_info('identifier', {'season_from': '01', 'season_to': '03'})
    )

    assert_that(
        caper.parse('Show Name S01 (E01 - E08) WEB-DL'),
        has_info('identifier', {'season': '01'}),
        has_info('identifier', {'episode_from': '01', 'episode_to': '08'})
    )
Exemple #11
0
def test_season_range():
    assert_that(
        caper.parse('Show.Name.S01-S03.DVDrip.x264'),
        has_info('identifier', {
            'season_from': '01',
            'season_to': '03'
        }))

    assert_that(
        caper.parse('Show Name S01 (E01 - E08) WEB-DL'),
        has_info('identifier', {'season': '01'}),
        has_info('identifier', {
            'episode_from': '01',
            'episode_to': '08'
        }))
Exemple #12
0
def test_source():
    assert_that(
        caper.parse('Show Name (2011) S01E01 720p WEBDL x264-GROUP'),
        has_info('video', {'source': 'WEBDL'})
    )

    assert_that(
        caper.parse('Show Name (2011) S01E01 720p WEB DL x264-GROUP'),
        has_info('video', {'source': ['WEB', 'DL']})
    )

    assert_that(
        caper.parse('Show Name (2011) S01E01 720p WEB-DL x264-GROUP'),
        has_info('video', {'source': ['WEB', 'DL']})
    )
Exemple #13
0
def test_roman_numerals():
    assert_that(
        caper.parse('Show.Name.Part.III.DVDrip.x264'),
        has_info('identifier', {'part': 3})
    )

    assert_that(
        caper.parse('Show.Name.Part.IV.DVDrip.x264'),
        has_info('identifier', {'part': 4})
    )

    assert_that(
        caper.parse('Show.Name.Part.XI.DVDrip.x264'),
        has_info('identifier', {'part': 11})
    )
Exemple #14
0
def test_resolution():
    assert_that(
        caper.parse('Show Name.S01E05.720p-GROUP'),
        has_info('video', {'resolution': '720p'})
    )

    assert_that(
        caper.parse('Show Name.S01E05.1080p'),
        has_info('video', {'resolution': '1080p'})
    )

    assert_that(
        caper.parse('Show Name.S01E05.480p.HDTV-GROUP'),
        has_info('video', {'resolution': '480p'})
    )
Exemple #15
0
def test_episode_range():
    assert_that(
        caper.parse('Show.Name.S01.E01.to.E06.DVDrip.x264'),
        has_info('identifier', {
            'season': '01',
            'episode_from': '01',
            'episode_to': '06'
        }))
Exemple #16
0
def test_ugly():
    result = caper.parse(
        '< Show.Name.S01E01.GERMAN.ABCD.WS.XViD-GROUP > >example.org< - - "grp-showname-s01e01-xvid-sample.avi" yEnc',
        'usenet'
    )

    assert_that(result, has_info('release_name', [
        (None, 'Show', '.'),
        ('.', 'Name', '.'),
        ('.', 'S01E01', '.'),
        ('.', 'GERMAN', '.'),
        ('.', 'ABCD', '.'),
        ('.', 'WS', '.'),
        ('.', 'XViD', '-'),
        ('-', 'GROUP', 'P')
    ]))

    assert_that(result, has_info('usenet', {'site': 'example.org'}))

    assert_that(result, has_info('detail', {'file_name': 'grp-showname-s01e01-xvid-sample.avi', 'extra': 'yEnc'}))
Exemple #17
0
def test_basic():
    result = caper.parse(
        '[#abc.123@network][12345] Show.Name.S03E03.WEBRip.x264-GROUP [1/33] - "show.name.303.x264-group.r05" yEnc',
        'usenet'
    )

    assert_that(result, has_info('detail', {'file_name': 'show.name.303.x264-group.r05', 'extra': 'yEnc'}))

    assert_that(result, has_info('part', {'current': '1', 'total': '33'}))

    assert_that(result, has_info('release_name', [
        (None, 'Show', '.'),
        ('.', 'Name', '.'),
        ('.', 'S03E03', '.'),
        ('.', 'WEBRip', '.'),
        ('.', 'x264', '-'),
        ('-', 'GROUP', 'P')
    ]))

    assert_that(result, has_info('usenet', {'group': '#abc.123@network'}))
    assert_that(result, has_info('usenet', {'code': '12345'}))
Exemple #18
0
def test_bare():
    result = caper.parse(
        '[01/18] - "Show.Name.S03E05.HDTV.x264-GROUP.par2" yEnc',
        'usenet'
    )

    assert_that(result, has_info('detail', {'file_name': 'Show.Name.S03E05.HDTV.x264-GROUP.par2', 'extra': 'yEnc'}))
    assert_that(result, has_info('part', {'current': '01', 'total': '18'}))

    result = caper.parse(
        'Show.Name.S03E05.HDTV.x264-GROUP - "Show.Name.S03E05.HDTV.x264-GROUP.par2" yEnc',
        'usenet'
    )

    assert_that(result, has_info('release_name', [
        (None, 'Show', '.'),
        ('.', 'Name', '.'),
        ('.', 'S03E05', '.'),
        ('.', 'HDTV', '.'),
        ('.', 'x264', '-'),
        ('-', 'GROUP', 'P')
    ]))
    assert_that(result, has_info('detail', {'file_name': 'Show.Name.S03E05.HDTV.x264-GROUP.par2', 'extra': 'yEnc'}))
Exemple #19
0
def test_town_style():
    result = caper.parse(
        '[ TOWN ]-[ www.example.org ]-[ partner of www.example.com ] [01/18] - "Show.Name.S03E05.HDTV.x264-GROUP.par2" - 321,23 MB yEnc',
        'usenet'
    )

    assert_that(result, has_info('detail', {'file_name': 'Show.Name.S03E05.HDTV.x264-GROUP.par2'}))
    assert_that(result, has_info('detail', {'extra': 'yEnc', 'size': '321,23 MB'}))

    assert_that(result, has_info('part', {'current': '01', 'total': '18'}))

    assert_that(result, has_info('usenet', {'group': 'TOWN'}))
    assert_that(result, has_info('usenet', {'site': 'www.example.org'}))
    assert_that(result, has_info('usenet', {'site': 'www.example.com'}))
Exemple #20
0
def test_codec():
    assert_that(caper.parse('Show Name 2013 S01E01 720p WEB-DL H264 GROUP'),
                has_info('video', {'codec': 'H264'}))

    assert_that(caper.parse('Show Name 2013 S01E01 720p WEB-DL H 264 GROUP'),
                has_info('video', {'codec': ['H', '264']}))
Exemple #21
0
def test_episode_range():
    assert_that(
        caper.parse('Show.Name.S01.E01.to.E06.DVDrip.x264'),
        has_info('identifier', {'season': '01', 'episode_from': '01', 'episode_to': '06'})
    )
Exemple #22
0
def test_dvd_disc():
    assert_that(caper.parse('Show Name (2011) S01 R1 NTSC DISC3'),
                has_info('dvd', {'disc': '3'}))

    assert_that(caper.parse('Show Name (2011) S01 R4 PAL D2'),
                has_info('dvd', {'disc': '2'}))
Exemple #23
0
def test_dvd_encoding():
    assert_that(caper.parse('Show Name (2011) S01 R1 NTSC'),
                has_info('dvd', {'encoding': 'NTSC'}))

    assert_that(caper.parse('Show Name (2011) S01 R4 PAL'),
                has_info('dvd', {'encoding': 'PAL'}))
Exemple #24
0
def test_closures():
    r = caper.parse('Show Name.S01E05.[720p]-GROUP')
    assert_that(r, has_info('video', {'resolution': '720p'}))
    assert_that(r, has_info('group', 'GROUP'))
Exemple #25
0
def test_dvd_region():
    assert_that(caper.parse('Show Name (2011) S01 R1 NTSC'),
                has_info('dvd', {'region': '1'}))

    assert_that(caper.parse('Show Name (2011) S01 R4 PAL'),
                has_info('dvd', {'region': '4'}))
def test_closures():
    r = caper.parse('Show Name.S01E05.[720p]-GROUP')
    assert_that(r, has_info('video', {'resolution': '720p'}))
    assert_that(r, has_info('group', 'GROUP'))