示例#1
0
def test_get_matches_episode_filename(episodes):
    subtitle = OpenSubtitlesSubtitle(Language('por', country='BR'), False, None, '1954453973', 'fulltext', 'episode',
                                     '0', '"Agents of S.H.I.E.L.D." A Fractured House',
                                     'HDTV.x264-KILLERS-mSD-AFG-EVO-KILLERS', 2014, 'tt4078580', 2, 6,
                                     'Marvels.Agents.of.S.H.I.E.L.D.S02E06.720p.HDTV.x264-KILLERS.srt', 'cp1252')
    matches = subtitle.get_matches(episodes['marvels_agents_of_shield_s02e06'])
    assert matches == {'series', 'year', 'season', 'episode', 'release_group', 'format', 'resolution', 'video_codec'}
def test_get_matches_episode_tag(episodes):
    subtitle = OpenSubtitlesSubtitle(Language('por', country='BR'), False, None, '1954453973', 'tag', 'episode',
                                     '0', '"Agents of S.H.I.E.L.D." A Fractured House',
                                     'HDTV.x264-KILLERS-mSD-AFG-EVO-KILLERS', 2014, 'tt4078580', 2, 6,
                                     '', 'cp1252')
    matches = subtitle.get_matches(episodes['marvels_agents_of_shield_s02e06'])
    assert matches == {'series', 'year', 'country', 'season', 'episode', 'source', 'video_codec'}
def test_get_matches_episode(episodes):
    subtitle = OpenSubtitlesSubtitle(Language('ell'), False, None, '1953579014', 'fulltext', 'episode',
                                     '0', '"Game of Thrones" Mhysa',
                                     ' Game.of.Thrones.S03E10.HDTV.XviD-AFG', 2013, 'tt2178796', 3, 10,
                                     'Game.of.Thrones.S03E10.HDTV.XviD-AFG.srt', None)
    matches = subtitle.get_matches(episodes['got_s03e10'])
    assert matches == {'imdb_id', 'series', 'year', 'country', 'episode', 'season', 'title'}
def test_get_matches_episode_year(episodes):
    subtitle = OpenSubtitlesSubtitle(Language('spa'), False, None, '1953369959', 'tag', 'episode',
                                     '0', '"Dallas" The Price You Pay',
                                     ' Dallas.2012.S01E03.HDTV.x264-LOL', 2012, 'tt2205526', 1, 3,
                                     'Dallas.2012.S01E03.HDTV.x264-LOL.srt', 'cp1252')
    matches = subtitle.get_matches(episodes['dallas_2012_s01e03'])
    assert matches == {'imdb_id', 'series', 'year', 'episode', 'season', 'title'}
示例#5
0
def test_get_matches_episode_tag(episodes):
    subtitle = OpenSubtitlesSubtitle(Language('por', country='BR'), False, None, '1954453973', 'tag', 'episode',
                                     '0', '"Agents of S.H.I.E.L.D." A Fractured House',
                                     'HDTV.x264-KILLERS-mSD-AFG-EVO-KILLERS', 2014, 'tt4078580', 2, 6,
                                     '', 'cp1252')
    matches = subtitle.get_matches(episodes['marvels_agents_of_shield_s02e06'])
    assert matches == {'series', 'year', 'season', 'episode', 'format', 'video_codec'}
def test_get_matches_movie_hash(movies):
    subtitle = OpenSubtitlesSubtitle(Language('deu'), False, None, '1953771409', 'moviehash', 'movie',
                                     '5b8f8f4e41ccb21e', 'Man of Steel',
                                     'Man.of.Steel.German.720p.BluRay.x264-EXQUiSiTE', 2013, 'tt0770828', 0, 0,
                                     'Man.of.Steel.German.720p.BluRay.x264-EXQUiSiTE.srt', None)
    matches = subtitle.get_matches(movies['man_of_steel'])
    assert matches == {'title', 'year', 'country', 'video_codec', 'imdb_id', 'hash', 'resolution', 'source'}
示例#7
0
def test_get_matches_episode_year(episodes):
    subtitle = OpenSubtitlesSubtitle(Language('spa'), False, None, '1953369959', 'tag', 'episode',
                                     '0', '"Dallas" The Price You Pay',
                                     ' Dallas.2012.S01E03.HDTV.x264-LOL', 2012, 'tt2205526', 1, 3,
                                     'Dallas.2012.S01E03.HDTV.x264-LOL.srt', 'cp1252')
    matches = subtitle.get_matches(episodes['dallas_2012_s01e03'])
    assert matches == {'imdb_id', 'series', 'year', 'episode', 'season', 'title'}
示例#8
0
def test_get_matches_episode(episodes):
    subtitle = OpenSubtitlesSubtitle(Language('ell'), False, None, '1953579014', 'fulltext', 'episode',
                                     '0', '"Game of Thrones" Mhysa',
                                     ' Game.of.Thrones.S03E10.HDTV.XviD-AFG', 2013, 'tt2178796', 3, 10,
                                     'Game.of.Thrones.S03E10.HDTV.XviD-AFG.srt', None)
    matches = subtitle.get_matches(episodes['got_s03e10'])
    assert matches == {'imdb_id', 'series', 'year', 'episode', 'season', 'title'}
示例#9
0
def test_get_matches_movie_hash(movies):
    subtitle = OpenSubtitlesSubtitle(Language('deu'), False, None, '1953771409', 'moviehash', 'movie',
                                     '5b8f8f4e41ccb21e', 'Man of Steel',
                                     'Man.of.Steel.German.720p.BluRay.x264-EXQUiSiTE', 2013, 'tt0770828', 0, 0,
                                     'Man.of.Steel.German.720p.BluRay.x264-EXQUiSiTE.srt', None)
    matches = subtitle.get_matches(movies['man_of_steel'])
    assert matches == {'title', 'year', 'video_codec', 'imdb_id', 'hash', 'resolution', 'format'}
示例#10
0
def test_get_matches_no_match(episodes):
    subtitle = OpenSubtitlesSubtitle(
        Language('fra'), False, None, '1953767650', 'imdbid', 'movie', 0,
        'Man of Steel', 'man.of.steel.2013.720p.bluray.x264-felony', 2013,
        770828, 0, 0, 'man.of.steel.2013.720p.bluray.x264-felony.srt', None)
    matches = subtitle.get_matches(episodes['got_s03e10'])
    assert matches == set()
示例#11
0
def test_get_matches_episode_filename(episodes):
    subtitle = OpenSubtitlesSubtitle(Language('por', country='BR'), False, None, '1954453973', 'fulltext', 'episode',
                                     '0', '"Agents of S.H.I.E.L.D." A Fractured House',
                                     'HDTV.x264-KILLERS-mSD-AFG-EVO-KILLERS', 2014, 'tt4078580', 2, 6,
                                     'Marvels.Agents.of.S.H.I.E.L.D.S02E06.720p.HDTV.x264-KILLERS.srt', 'cp1252')
    matches = subtitle.get_matches(episodes['marvels_agents_of_shield_s02e06'])
    assert matches == {'series', 'year', 'country', 'season', 'episode', 'release_group', 'source', 'resolution',
                       'video_codec'}
示例#12
0
def test_get_matches_imdb_id(movies):
    subtitle = OpenSubtitlesSubtitle(
        Language('fra'), True, None, '1953767650', 'imdbid', 'movie', 0,
        'Man of Steel', 'man.of.steel.2013.720p.bluray.x264-felony', 2013,
        'tt0770828', 0, 0, 'man.of.steel.2013.720p.bluray.x264-felony.srt',
        None)
    matches = subtitle.get_matches(movies['man_of_steel'])
    assert matches == {
        'title', 'year', 'country', 'video_codec', 'imdb_id', 'resolution',
        'source', 'release_group'
    }
示例#13
0
def test_get_score_cap(movies):
    video = movies['man_of_steel']
    subtitle = OpenSubtitlesSubtitle(
        Language('eng'), True, None, 1, 'hash', 'movie', '5b8f8f4e41ccb21e',
        'Man of Steel', 'man.of.steel.2013.720p.bluray.x264-felony.mkv', 2013,
        770828, None, None, '', 'utf-8')
    assert compute_score(subtitle, video) == movie_scores['hash']
示例#14
0
def test_compute_score_episode_imdb_id(movies):
    video = movies['man_of_steel']
    subtitle = OpenSubtitlesSubtitle(
        Language('eng'), True, None, 1, 'hash', 'movie', None, 'Man of Steel',
        'man.of.steel.2013.720p.bluray.x264-felony.mkv', 2013, 770828, None,
        None, '', 'utf-8')
    assert compute_score(subtitle, video) == sum(
        movie_scores.get(m, 0)
        for m in ('imdb_id', 'title', 'year', 'release_group', 'format',
                  'resolution', 'video_codec'))
示例#15
0
def test_get_matches_no_match(episodes):
    subtitle = OpenSubtitlesSubtitle(Language('fra'), False, None, '1953767650', 'imdbid', 'movie', 0, 'Man of Steel',
                                     'man.of.steel.2013.720p.bluray.x264-felony', 2013, 770828, 0, 0,
                                     'man.of.steel.2013.720p.bluray.x264-felony.srt', None)
    matches = subtitle.get_matches(episodes['got_s03e10'])
    assert matches == set()
示例#16
0
def test_get_matches_imdb_id(movies):
    subtitle = OpenSubtitlesSubtitle(Language('fra'), True, None, '1953767650', 'imdbid', 'movie', 0, 'Man of Steel',
                                     'man.of.steel.2013.720p.bluray.x264-felony', 2013, 'tt0770828', 0, 0,
                                     'man.of.steel.2013.720p.bluray.x264-felony.srt', None)
    matches = subtitle.get_matches(movies['man_of_steel'])
    assert matches == {'title', 'year', 'video_codec', 'imdb_id', 'resolution', 'format', 'release_group'}
示例#17
0
def test_get_matches_imdb_id(movies):
    subtitle = OpenSubtitlesSubtitle(Language('fra'), True, None, '1953767650', 'imdbid', 'movie', 0, 'Man of Steel',
                                     'man.of.steel.2013.720p.bluray.x264-felony', 2013, 770828, 0, 0, None)
    matches = subtitle.get_matches(movies['man_of_steel'], hearing_impaired=True)
    assert matches == {'title', 'year', 'video_codec', 'imdb_id', 'resolution', 'format', 'release_group',
                       'hearing_impaired'}