示例#1
0
def test_get_matches_no_match(episodes):
    subtitle = TVsubtitlesSubtitle(Language('por'), None, 261077,
                                   'Game of Thrones', 3, 10, None,
                                   '1080p.BluRay', 'DEMAND')
    matches = subtitle.get_matches(episodes['bbt_s07e05'],
                                   hearing_impaired=True)
    assert matches == set()
示例#2
0
def test_get_matches_video_codec_resolution(episodes):
    subtitle = TVsubtitlesSubtitle(Language('por'), None, 261077,
                                   'Game of Thrones', 3, 10, None,
                                   '720p.BluRay', 'x264-DEMAND')
    matches = subtitle.get_matches(episodes['got_s03e10'])
    assert matches == {
        'series', 'season', 'episode', 'year', 'video_codec', 'resolution'
    }
示例#3
0
def test_get_matches_format_release_group(episodes):
    subtitle = TVsubtitlesSubtitle(Language('fra'), None, 249518,
                                   'The Big Bang Theory', 7, 5, 2007, 'HDTV',
                                   'lol-dimension')
    matches = subtitle.get_matches(episodes['bbt_s07e05'])
    assert matches == {
        'series', 'season', 'episode', 'year', 'format', 'release_group'
    }
示例#4
0
def test_download_subtitles(mock_providers):
    subtitles = [
        Addic7edSubtitle(Language('eng'), True, None, 'The Big Bang Theory', 7, 5, 'The Workplace Proximity', 2007,
                         'DIMENSION', None),
        TheSubDBSubtitle(Language('eng'), 'ad32876133355929d814457537e12dc2'),
        TVsubtitlesSubtitle(Language('por'), None, 261077, 'Game of Thrones', 3, 10, None, '1080p.BluRay', 'DEMAND')
    ]

    download_subtitles(subtitles)

    # test providers
    assert provider_manager['addic7ed'].plugin.download_subtitle.called
    assert not provider_manager['opensubtitles'].plugin.download_subtitle.called
    assert not provider_manager['podnapisi'].plugin.download_subtitle.called
    assert provider_manager['thesubdb'].plugin.download_subtitle.called
    assert provider_manager['tvsubtitles'].plugin.download_subtitle.called
    assert not provider_manager['subscenter'].plugin.download_subtitle.called
示例#5
0
def test_download_subtitles(mock_providers):
    subtitles = [
        # Addic7edSubtitle(Language('eng'), True, None, 'The Big Bang Theory', 7, 5, 'The Workplace Proximity', 2007,
        #                 'DIMENSION', None),
        TheSubDBSubtitle(Language('eng'), 'ad32876133355929d814457537e12dc2'),
        TVsubtitlesSubtitle(Language('por'), None, 261077, 'Game of Thrones',
                            3, 10, None, '1080p.BluRay', 'DEMAND')
    ]

    download_subtitles(subtitles)

    # test providers
    for name in ('addic7ed', 'legendastv', 'napiprojekt', 'opensubtitles',
                 'opensubtitlesvip', 'podnapisi', 'shooter'):
        assert not provider_manager[name].plugin.download_subtitle.called

    for name in ('thesubdb', 'tvsubtitles'):
        assert provider_manager[name].plugin.download_subtitle.called
示例#6
0
def test_get_matches_no_match(episodes):
    subtitle = TVsubtitlesSubtitle(Language('por'), None, 261077,
                                   'Game of Thrones', 3, 10, 2011,
                                   '1080p.BluRay', 'DEMAND')
    matches = subtitle.get_matches(episodes['house_of_cards_us_s06e01'])
    assert matches == set()
示例#7
0
def test_get_matches_only_year_country(episodes):
    subtitle = TVsubtitlesSubtitle(Language('por'), None, 261077,
                                   'Game of Thrones', 3, 10, None,
                                   '1080p.BluRay', 'DEMAND')
    matches = subtitle.get_matches(episodes['bbt_s07e05'])
    assert matches == {'year', 'country'}
示例#8
0
def test_get_matches_no_match(episodes):
    subtitle = TVsubtitlesSubtitle(Language('por'), None, 261077, 'Game of Thrones', 3, 10, None, '1080p.BluRay',
                                   'DEMAND')
    matches = subtitle.get_matches(episodes['bbt_s07e05'], hearing_impaired=True)
    assert matches == set()
示例#9
0
def test_get_matches_video_codec_resolution(episodes):
    subtitle = TVsubtitlesSubtitle(Language('por'), None, 261077, 'Game of Thrones', 3, 10, None, '720p.BluRay',
                                   'x264-DEMAND')
    matches = subtitle.get_matches(episodes['got_s03e10'])
    assert matches == {'series', 'season', 'episode', 'year', 'video_codec', 'resolution', 'hearing_impaired'}
示例#10
0
def test_get_matches_format_release_group(episodes):
    subtitle = TVsubtitlesSubtitle(Language('fra'), None, 249518, 'The Big Bang Theory', 7, 5, 2007, 'HDTV',
                                   'lol-dimension')
    matches = subtitle.get_matches(episodes['bbt_s07e05'])
    assert matches == {'series', 'season', 'episode', 'year', 'format', 'release_group', 'hearing_impaired'}