Пример #1
0
 def test_set_index(self):
     _line = r"1623879181.7519188610 | 4025725826 | " \
             r"/home/johndoe/files/Show.S04.1080p.WEB.H264-GROUPNAME/" \
             r"Show.S04E02.iNTERNAL.1080p.WEB.H264-GROUPNAME.mkv"
     _item = FileListItem(_line)
     assert _item.index is None
     _item.index = 0
     assert _item.index == 0
     _item.index = 999
     assert _item.index == 999
Пример #2
0
 def test_parse_invalid_rar_not_part01(self):
     _line = r"1611998314.0000000000 | 50000000 | " \
             r"/home/johndoe/files/Some.Cool.Movie.2007.1080p.BluRay.DTS.x264-Grp/" \
             r"some.cool.movie.2007.1080p.bluray.dts.x264-grp.part{:02d}.rar"
     for part_num in range(2, 100):
         _item = FileListItem(_line.format(part_num))
         assert _item.valid is False
Пример #3
0
 def test_parent_name_season_pack(self):
     _line = r"1623879181.7519188610 | 4025725826 | " \
             r"/home/johndoe/files/Show.S04.iNTERNAL.1080p.WEB.H264-GROUPNAME/" \
             r"Show.S04E02.iNTERNAL.1080p.WEB.H264-GROUPNAME/" \
             r"show.s04e02.1080p.web-grpname.mkv"
     _item = FileListItem(_line)
     assert _item.parent_name == "Show.S04E02.iNTERNAL.1080p.WEB.H264-GROUPNAME"
Пример #4
0
 def test_parse_invalid_lines(self):
     _line = r"1611998314.0000000000 45986355 | " \
             r"/home/johndoe/files/SomeFile.mkv"
     _item = FileListItem(_line)
     assert _item.valid is False
     _line = r"1611998314.0000000000 | 45986355 | " \
             r"not_correct_path"
     _item = FileListItem(_line)
     assert _item.valid is False
     _line = r"1611998314.0000000000 | xxxxx | " \
             r"/home/johndoe/files/SomeFile.mkv"
     _item = FileListItem(_line)
     assert _item.valid is False
     _line = r"xxxxx | 45986355 | " \
             r"/home/johndoe/files/SomeFile.mkv"
     _item = FileListItem(_line)
     assert _item.valid is False
Пример #5
0
 def test_is_movie_mkv(self):
     _line = r"1611998314.0000000000 | 50000000 | " \
             r"/home/johndoe/files/Some.Cool.Movie.2007.1080p.BluRay.DTS.x264-Grp.mkv"
     _item = FileListItem(_line)
     assert _item.is_rar is False
     assert _item.is_video is True
     assert _item.is_movie is True
     assert _item.is_tvshow is False
Пример #6
0
 def test_download_path_vid_file(self):
     _line = r"1623879181.7519188610 | 4025725826 | " \
             r"/home/johndoe/files/Show.S04E02.iNTERNAL.1080p.WEB.H264-GROUPNAME/" \
             r"show.s04e02.1080p.web-grpname.mkv"
     _item = FileListItem(_line)
     assert _item.download_path == PurePosixPath(
         r"/home/johndoe/files/Show.S04E02.iNTERNAL.1080p.WEB.H264-GROUPNAME/"
         r"show.s04e02.1080p.web-grpname.mkv")
Пример #7
0
 def test_is_episode_mkv(self):
     _line = r"1623879181.7519188610 | 4025725826 | " \
             r"/home/johndoe/files/Show.S04E02.iNTERNAL.1080p.WEB.H264-GROUPNAME.mkv"
     _item = FileListItem(_line)
     assert _item.is_rar is False
     assert _item.is_video is True
     assert _item.is_movie is False
     assert _item.is_tvshow is True
     assert _item.media_type == FileListItem.MediaType.Episode
Пример #8
0
 def test_is_episode_mkv_in_dir(self):
     _line = r"1623879181.7519188610 | 4025725826 | " \
             r"/home/johndoe/files/Show.S04E02.iNTERNAL.1080p.WEB.H264-GROUPNAME/" \
             r"show.s04e02.1080p.web-grpname.mkv"
     _item = FileListItem(_line)
     assert _item.is_rar is False
     assert _item.is_video is True
     assert _item.is_movie is False
     assert _item.is_tvshow is True
Пример #9
0
 def test_is_movie_rar_in_dir(self):
     _line = r"1611998314.0000000000 | 50000000 | " \
             r"/home/johndoe/files/Some.Cool.Movie.2007.1080p.BluRay.DTS.x264-Grp/" \
             r"some.cool.movie.2007.1080p.bluray.dts.x264-grp.rar"
     _item = FileListItem(_line)
     assert _item.is_rar is True
     assert _item.is_video is False
     assert _item.is_movie is True
     assert _item.is_tvshow is False
Пример #10
0
 def test_parse_valid_episode(self):
     _line = r"1623879181.7519188610 | 4025725826 | " \
             r"/home/johndoe/files/Show.S04.1080p.WEB.H264-GROUPNAME/" \
             r"Show.S04E02.iNTERNAL.1080p.WEB.H264-GROUPNAME.mkv"
     _item = FileListItem(_line)
     assert _item.valid is True
     assert _item.name == "Show.S04E02.iNTERNAL.1080p.WEB.H264-GROUPNAME.mkv"
     assert _item.size == 4025725826
     assert _item.timestamp == 1623879181
     assert _item.path == PurePosixPath(
         r"/home/johndoe/files/Show.S04.1080p.WEB.H264-GROUPNAME/"
         r"Show.S04E02.iNTERNAL.1080p.WEB.H264-GROUPNAME.mkv")
Пример #11
0
 def test_parse_valid_rar_part01(self):
     _line = r"1611998314.0000000000 | 50000000 | " \
             r"/home/johndoe/files/Some.Cool.Movie.2007.1080p.BluRay.DTS.x264-Grp/" \
             r"some.cool.movie.2007.1080p.bluray.dts.x264-grp.part01.rar"
     _item = FileListItem(_line)
     assert _item.valid is True
Пример #12
0
 def test_parse_invalid_subpack(self):
     _line = r"1611998314.0000000000 | 196154 | " \
             r"/home/jk/files/SE.SUBPACKS.02.03.2012-Collection/" \
             r"Cool.Movie.2004.NORDiC.SUBPACK.x264-Grp/cmv.x264-grp.rar"
     _item = FileListItem(_line)
     assert _item.valid is False
Пример #13
0
 def test_parse_invalid_movie_sample(self):
     _line = r"1611998314.0000000000 | 45986355 | " \
             r"/home/johndoe/files/The.Movie.2021.1080p.WEB.H264-GROUPNAME/Sample/" \
             r"the.movie.2021.1080p.web.h264-grp-sample.mkv"
     _item = FileListItem(_line)
     assert _item.valid is False
Пример #14
0
 def test_download_path_rar_file_parent_is_dl_dir_raises_error(self):
     _line = r"1623879181.7519188610 | 4025725826 | " \
             r"/home/johndoe/files/show.s04e02.1080p.web-grpname.rar"
     _item = FileListItem(_line)
     with pytest.raises(AssertionError):
         _ = _item.download_path
Пример #15
0
 def test_parent_name_episode_mkv(self):
     _line = r"1623879181.7519188610 | 4025725826 | " \
             r"/home/johndoe/files/Show.S04E02.iNTERNAL.1080p.WEB.H264-GROUPNAME.mkv"
     _item = FileListItem(_line)
     assert _item.parent_name is None
Пример #16
0
 def parse_find_cmd_output(self, lines: List[str], server_id: str):
     for line in lines:
         _item = FileListItem(line, server_id)
         if _item.valid:
             self._items.append(_item)
Пример #17
0
 def test_parse_invalid_sample_dir(self):
     _line = r"1611998314.0000000000 | 50000000 | " \
             r"/home/johndoe/files/Some.Cool.Movie.2007.1080p.BluRay.DTS.x264-Grp/" \
             r"Sample/smpl.mkv"
     _item = FileListItem(_line)
     assert _item.valid is False