summaryrefslogtreecommitdiffhomepage
path: root/tests/subliminal_patch/test_argenteam.py
blob: fc6ff511b2830a75f2c91913cf61f452568855a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# -*- coding: utf-8 -*-

import pytest
import os
from subliminal_patch.providers.argenteam import ArgenteamProvider
from subliminal_patch.providers.argenteam import ArgenteamSubtitle
from subzero.language import Language


def test_get_matches_episode(episodes):
    episode = episodes["breaking_bad_s01e01"]
    subtitle = ArgenteamSubtitle(
        Language.fromalpha2("es"),
        None,
        "https://argenteam.net/subtitles/24002/Breaking.Bad.%282008%29.S01E01-Pilot.BluRay.x264.720p-REWARD",
        "BluRay x264 720p",
        {"title", "season", "episode", "imdb_id"},
    )
    matches = subtitle.get_matches(episode)
    assert matches == {
        "title",
        "season",
        "episode",
        "imdb_id",
        "source",
        "video_codec",
        "resolution",
        "edition",
        "streaming_service",
        "release_group",
        "series",
        "year",
    }


def test_get_matches_movie(movies):
    movie = movies["dune"]
    subtitle = ArgenteamSubtitle(
        Language.fromalpha2("es"),
        None,
        "https://argenteam.net/subtitles/86024/Dune.Part.One.%282021%29.WEB.H264.1080p-NAISU",
        "WEB H264 1080p",
        {"title", "year", "imdb_id"},
    )
    matches = subtitle.get_matches(movie)
    assert matches == {
        "title",
        "year",
        "imdb_id",
        "source",
        "resolution",
        "edition",
        "video_codec",
    }


@pytest.mark.vcr
def test_list_subtitles_movie(movies):
    item = movies["dune"]
    with ArgenteamProvider() as provider:
        subtitles = provider.list_subtitles(item, {Language("spa", "MX")})

    for expected in (
        "https://argenteam.net/subtitles/86023/Dune.Part.One.%282021%29.WEB.H264.720p-NAISU",
        "https://argenteam.net/subtitles/86024/Dune.Part.One.%282021%29.WEB.H264.1080p-NAISU",
        "https://argenteam.net/subtitles/86025/Dune.Part.One.%282021%29.WEB.x265.2160p-NAISU",
    ):
        assert any(expected == sub.download_link for sub in subtitles)


@pytest.mark.vcr
def test_list_subtitles_episode(episodes):
    item = episodes["breaking_bad_s01e01"]
    with ArgenteamProvider() as provider:
        subtitles = provider.list_subtitles(item, {Language("spa", "MX")})

    for expected in (
        "https://argenteam.net/subtitles/24002/Breaking.Bad.%282008%29.S01E01-Pilot.BluRay.x264.720p-REWARD",
        "https://argenteam.net/subtitles/23940/Breaking.Bad.%282008%29.S01E01-Pilot.DVDRip.XviD-ORPHEUS",
    ):
        assert any(expected == sub.download_link for sub in subtitles)


@pytest.mark.vcr
def test_download_subtitle(episodes):
    item = episodes["breaking_bad_s01e01"]
    with ArgenteamProvider() as provider:
        subtitles = provider.list_subtitles(item, {Language("spa", "MX")})
        subtitle = subtitles[0]
        provider.download_subtitle(subtitle)
        assert subtitle.content is not None