def test_clean_up(self, ecmd): input, profile = "some-film.mkv", profiles.ROKU # Convert flac with 6 channels stream = {"index": 6, "codec_type": "subtitle", "codec_name": "ass", "tags": {"language": "por"}} processor = SubtitleProcessor(input, stream, profile) processor.clean_up() cmd = ["sed", "-i", "-e", r"s/<[^>]*>//ig", "-e", r"s/{[^}]*}//ig", "subtitle-6.srt"] self.assertTrue(ecmd.called) ecmd.assert_called_once_with(cmd)
def test_process(self): input, profile = "some-film.mkv", profiles.ROKU # Attempt simple process, still converts stream = {"index": 4, "codec_type": "subtitle", "codec_name": "srt", "tags": {"language": "por"}} processor = SubtitleProcessor(input, stream, profile) res = processor.process() self.assertEqual(res, {"input": "subtitle-4.srt", "index": 0, "language": "por"}) self.assertTrue(processor.convert.called) self.assertTrue(processor.clean_up.called)
def test_convert(self, ecmd): input, profile = "some-film.mkv", profiles.ROKU # Convert flac with 6 channels stream = {"index": 5, "codec_type": "subtitle", "codec_name": "ass", "tags": {"language": "por"}} processor = SubtitleProcessor(input, stream, profile) processor.convert() cmd = ["ffmpeg", "-sub_charenc", "utf-8", "-i", "some-film.mkv", "-map", "0:5", "subtitle-5.srt"] self.assertTrue(ecmd.called) ecmd.assert_called_once_with(cmd)