New paste Repaste Download
tmpdir = local('/tmp/pytest-of-root/pytest-11/test_find_best_subtitles_match0')
mock = <pytest_mock.MockFixture object at 0x7f20533280a0>
    def test_find_best_subtitles_matches(tmpdir, mock):
        movie_filename = str(
            (tmpdir / 'Parks.and.Recreation.S05E13.HDTV.x264-LOL.avi').ensure())
    
        server = MagicMock(name='MockServer')
        mock.patch('ss.ServerProxy', autospec=True, return_value=server)
        mock.patch('ss.calculate_hash_for_file', autospec=True, return_value='13ab')
        server.LogIn.return_value = dict(token='TOKEN')
    
        server.SearchSubtitles.return_value = {
            'data': [
                # OpenSubtitles returned wrong Season: should be skipped
                dict(
                    MovieReleaseName='Parks.and.Recreation.S05E13.HDTV.x264-LOL.srt',
                    SubDownloadsCnt='1000',
                    SubDownloadLink='http://sub99.srt',
                    SubFormat='srt',
                    SeriesSeason='4',
                    SeriesEpisode='13',
                ),
                # OpenSubtitles returned wrong Episode: should be skipped
                dict(
                    MovieReleaseName='Parks.and.Recreation.S05E13.HDTV.x264-LOL.srt',
                    SubDownloadsCnt='1000',
                    SubDownloadLink='http://sub98.srt',
                    SubFormat='srt',
                    SeriesSeason='5',
                    SeriesEpisode='11',
                ),
                # First with correct season and episode: winner
                dict(
                    MovieReleaseName='Parks.and.Recreation.S05E13.HDTV.x264-LOL.srt',
                    SubDownloadsCnt='1000',
                    SubDownloadLink='http://sub1.srt',
                    SubFormat='srt',
                    SeriesSeason='5',
                    SeriesEpisode='13',
                ),
                dict(
                    MovieReleaseName='Parks.and.Recreation.S05E13.HDTV.x264-LOL.srt',
                    SubDownloadsCnt=1500,
                    SubDownloadLink='http://sub2.srt',
                    SubFormat='srt',
                    SeriesSeason='5',
                    SeriesEpisode='13',
                ),
                dict(
                    MovieReleaseName='Parks.and.Recreation.S05E13.HDTV.-LOL.srt',
                    SubDownloadsCnt=9999,
                    SubDownloadLink='http://sub3.srt',
                    SubFormat='srt',
                    SeriesSeason='5',
                    SeriesEpisode='13',
                ),
            ]
        }
    
>       result = ss.find_subtitle(movie_filename, 'en')
tests/test_ss.py:193:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/local/bin/ss.py:99: in find_subtitle
    search_results = query_open_subtitles(movie_filename, language)
/usr/local/bin/ss.py:81: in query_open_subtitles
    guessit_query = obtain_guessit_query(movie_filename, language)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
movie_filename = '/tmp/pytest-of-root/pytest-11/test_find_best_subtitles_match0/Parks.and.Recreation.S05E13.HDTV.x264-LOL.avi'
language = 'en'
    def obtain_guessit_query(movie_filename, language):
>       guess = guessit.guess_file_info(os.path.basename(movie_filename), info=['filename'])
E       AttributeError: module 'guessit' has no attribute 'guess_file_info'
/usr/local/bin/ss.py:28: AttributeError
Filename: None. Size: 3kb. View raw, , hex, or download this file.

This paste expires on 2026-04-10 08:59:20.670613+00:00. Pasted through deprecated-web.