def test_download_best_subtitles_no_language(episodes): video = episodes['bbt_s07e05'] languages = {Language('fra')} video.subtitle_languages = languages providers = ['addic7ed'] subtitles = download_best_subtitles({video}, languages, min_score=episode_scores['hash'], providers=providers) assert len(subtitles) == 0
def test_download_best_subtitles_undefined(episodes): video = episodes['bbt_s07e05'] languages = {Language('und')} video.subtitle_languages = languages providers = ['addic7ed'] subtitles = download_best_subtitles({video}, languages, min_score=episode_scores['hash'], only_one=True, providers=providers) assert len(subtitles) == 0
def test_download_best_subtitles_only_one(episodes): video = episodes['bbt_s07e05'] languages = {Language('nld'), Language('por', 'BR')} providers = ['addic7ed', 'thesubdb'] expected_subtitles = {('thesubdb', '9dbbfb7ba81c9a6237237dae8589fccc-pt-BR')} subtitles = download_best_subtitles({video}, languages, only_one=True, providers=providers) assert len(subtitles) == 1 assert len(subtitles[video]) == 1 assert {(s.provider_name, s.id) for s in subtitles[video]} == expected_subtitles
def test_download_best_subtitles(episodes): video = episodes['bbt_s07e05'] languages = {Language('eng'), Language('por', 'BR')} providers = ['podnapisi', 'thesubdb'] expected_subtitles = {('thesubdb', '9dbbfb7ba81c9a6237237dae8589fccc-en'), ('thesubdb', '9dbbfb7ba81c9a6237237dae8589fccc-pt-BR')} subtitles = download_best_subtitles({video}, languages, providers=providers) assert len(subtitles) == 1 assert len(subtitles[video]) == 2 assert {(s.provider_name, s.id) for s in subtitles[video]} == expected_subtitles