Пример #1
0
def test_scan_video_invalid_extension(movies, tmpdir, monkeypatch):
    monkeypatch.chdir(str(tmpdir))
    movie_name = os.path.splitext(movies['man_of_steel'].name)[0] + '.mp3'
    tmpdir.ensure(movie_name)
    with pytest.raises(ValueError) as excinfo:
        scan_video(movie_name)
    assert str(excinfo.value) == '\'.mp3\' is not a valid video extension'
Пример #2
0
def test_scan_video_invalid_extension(movies, tmpdir, monkeypatch):
    monkeypatch.chdir(str(tmpdir))
    movie_name = os.path.splitext(movies['man_of_steel'].name)[0] + '.mp3'
    tmpdir.ensure(movie_name)
    with pytest.raises(ValueError) as excinfo:
        scan_video(movie_name)
    assert str(excinfo.value) == '\'.mp3\' is not a valid video extension'
Пример #3
0
def test_refine_video_metadata(mkv):
    scanned_video = scan_video(mkv['test5'])
    refine(scanned_video,
           episode_refiners=('metadata', ),
           movie_refiners=('metadata', ))
    assert type(scanned_video) is Movie
    assert scanned_video.name == mkv['test5']
    assert scanned_video.source is None
    assert scanned_video.release_group is None
    assert scanned_video.resolution is None
    assert scanned_video.video_codec == 'H.264'
    assert scanned_video.audio_codec == 'AAC'
    assert scanned_video.imdb_id is None
    assert scanned_video.hashes == {
        'opensubtitles': '49e2530ea3bd0d18',
        # 'shooter': '36f3e2c50566ca01f939bf15d8031432;b6132ab62b8f7d4aaabe9d6344b90d90;'
        #           'bea6074cef7f1de85794f3941530ba8b;18db05758d5d0d96f246249e4e4b5d79',
        'thesubdb': '64a8b87f12daa4f31895616e6c3fd39e'
    }
    assert scanned_video.size == 31762747
    assert scanned_video.subtitle_languages == {
        Language('spa'),
        Language('deu'),
        Language('jpn'),
        Language('und'),
        Language('ita'),
        Language('fra'),
        Language('hun')
    }
    assert scanned_video.title == 'test5'
    assert scanned_video.year is None
Пример #4
0
def test_scan_video_movie(movies, tmpdir, monkeypatch):
    video = movies['man_of_steel']
    monkeypatch.chdir(str(tmpdir))
    tmpdir.ensure(video.name)
    scanned_video = scan_video(video.name)
    assert scanned_video.name == video.name
    assert scanned_video.format == video.format
    assert scanned_video.release_group == video.release_group
    assert scanned_video.resolution == video.resolution
    assert scanned_video.video_codec == video.video_codec
    assert scanned_video.audio_codec is None
    assert scanned_video.imdb_id is None
    assert scanned_video.hashes == {}
    assert scanned_video.size == 0
    assert scanned_video.subtitle_languages == set()
    assert scanned_video.title == video.title
    assert scanned_video.year == video.year
Пример #5
0
def test_scan_video_movie(movies, tmpdir, monkeypatch):
    video = movies['man_of_steel']
    monkeypatch.chdir(str(tmpdir))
    tmpdir.ensure(video.name)
    scanned_video = scan_video(video.name)
    assert scanned_video.name == video.name
    assert scanned_video.format == video.format
    assert scanned_video.release_group == video.release_group
    assert scanned_video.resolution == video.resolution
    assert scanned_video.video_codec == video.video_codec
    assert scanned_video.audio_codec is None
    assert scanned_video.imdb_id is None
    assert scanned_video.hashes == {}
    assert scanned_video.size == 0
    assert scanned_video.subtitle_languages == set()
    assert scanned_video.title == video.title
    assert scanned_video.year == video.year
Пример #6
0
def test_scan_video_broken(mkv, tmpdir, monkeypatch):
    broken_path = 'test1.mkv'
    with io.open(mkv['test1'], 'rb') as original:
        with tmpdir.join(broken_path).open('wb') as broken:
            broken.write(original.read(512))
    monkeypatch.chdir(str(tmpdir))
    scanned_video = scan_video(broken_path)
    assert type(scanned_video) is Movie
    assert scanned_video.name == str(broken_path)
    assert scanned_video.format is None
    assert scanned_video.release_group is None
    assert scanned_video.resolution is None
    assert scanned_video.video_codec is None
    assert scanned_video.audio_codec is None
    assert scanned_video.imdb_id is None
    assert scanned_video.hashes == {}
    assert scanned_video.size == 512
    assert scanned_video.subtitle_languages == set()
    assert scanned_video.title == 'test1'
    assert scanned_video.year is None
Пример #7
0
def test_scan_video_broken(mkv, tmpdir, monkeypatch):
    broken_path = 'test1.mkv'
    with io.open(mkv['test1'], 'rb') as original:
        with tmpdir.join(broken_path).open('wb') as broken:
            broken.write(original.read(512))
    monkeypatch.chdir(str(tmpdir))
    scanned_video = scan_video(broken_path)
    assert type(scanned_video) is Movie
    assert scanned_video.name == str(broken_path)
    assert scanned_video.format is None
    assert scanned_video.release_group is None
    assert scanned_video.resolution is None
    assert scanned_video.video_codec is None
    assert scanned_video.audio_codec is None
    assert scanned_video.imdb_id is None
    assert scanned_video.hashes == {}
    assert scanned_video.size == 512
    assert scanned_video.subtitle_languages == set()
    assert scanned_video.title == 'test1'
    assert scanned_video.year is None
Пример #8
0
def test_scan_video_episode(episodes, tmpdir, monkeypatch):
    video = episodes['bbt_s07e05']
    monkeypatch.chdir(str(tmpdir))
    tmpdir.ensure(video.name)
    scanned_video = scan_video(video.name)
    assert scanned_video.name, video.name
    assert scanned_video.format == video.format
    assert scanned_video.release_group == video.release_group
    assert scanned_video.resolution == video.resolution
    assert scanned_video.video_codec == video.video_codec
    assert scanned_video.audio_codec is None
    assert scanned_video.imdb_id is None
    assert scanned_video.hashes == {}
    assert scanned_video.size == 0
    assert scanned_video.subtitle_languages == set()
    assert scanned_video.series == video.series
    assert scanned_video.season == video.season
    assert scanned_video.episode == video.episode
    assert scanned_video.title is None
    assert scanned_video.year is None
    assert scanned_video.tvdb_id is None
Пример #9
0
def test_scan_video_episode(episodes, tmpdir, monkeypatch):
    video = episodes['bbt_s07e05']
    monkeypatch.chdir(str(tmpdir))
    tmpdir.ensure(video.name)
    scanned_video = scan_video(video.name)
    assert scanned_video.name, video.name
    assert scanned_video.format == video.format
    assert scanned_video.release_group == video.release_group
    assert scanned_video.resolution == video.resolution
    assert scanned_video.video_codec == video.video_codec
    assert scanned_video.audio_codec is None
    assert scanned_video.imdb_id is None
    assert scanned_video.hashes == {}
    assert scanned_video.size == 0
    assert scanned_video.subtitle_languages == set()
    assert scanned_video.series == video.series
    assert scanned_video.season == video.season
    assert scanned_video.episode == video.episode
    assert scanned_video.title is None
    assert scanned_video.year is None
    assert scanned_video.tvdb_id is None
Пример #10
0
def test_refine_video_metadata(mkv):
    scanned_video = scan_video(mkv['test5'])
    refine(scanned_video, episode_refiners=('metadata',), movie_refiners=('metadata',))
    assert type(scanned_video) is Movie
    assert scanned_video.name == mkv['test5']
    assert scanned_video.format is None
    assert scanned_video.release_group is None
    assert scanned_video.resolution is None
    assert scanned_video.video_codec == 'h264'
    assert scanned_video.audio_codec == 'AAC'
    assert scanned_video.imdb_id is None
    assert scanned_video.hashes == {
        'napiprojekt': 'de2e9caa58dd53a6ab9d241e6b252e35',
        'opensubtitles': '49e2530ea3bd0d18',
        'shooter': '36f3e2c50566ca01f939bf15d8031432;b6132ab62b8f7d4aaabe9d6344b90d90;'
                   'bea6074cef7f1de85794f3941530ba8b;18db05758d5d0d96f246249e4e4b5d79',
        'thesubdb': '64a8b87f12daa4f31895616e6c3fd39e'}
    assert scanned_video.size == 31762747
    assert scanned_video.subtitle_languages == {Language('spa'), Language('deu'), Language('jpn'), Language('und'),
                                                Language('ita'), Language('fra'), Language('hun')}
    assert scanned_video.title == 'test5'
    assert scanned_video.year is None
Пример #11
0
def test_scan_video_path_does_not_exist(movies):
    with pytest.raises(ValueError) as excinfo:
        scan_video(movies['man_of_steel'].name)
    assert str(excinfo.value) == 'Path does not exist'
Пример #12
0
def test_scan_video_path_does_not_exist(movies):
    with pytest.raises(ValueError) as excinfo:
        scan_video(movies['man_of_steel'].name)
    assert str(excinfo.value) == 'Path does not exist'