def _start(self): if not self.videofile: messagebox.showwarning('提示', '请先选择视频文件或目录') return def start(*args, **kwargs): subfinder = SubFinder(*args, **kwargs) subfinder.start() subfinder.done() subsearchers = [ get_subsearcher('shooter'), get_subsearcher('zimuku'), get_subsearcher('zimuzu') ] t = Thread(target=start, args=[self.videofile, ], kwargs=dict( logger_output=self._output, subsearcher_class=subsearchers)) t.start()
def test_search_subs_by_zimuzu(): directory = os.path.expanduser('~/Downloads/test/') if not os.path.exists(directory): pytest.skip('test directory not exists') rm_subtitles(directory) subfinder = SubFinder(path=directory, subsearcher_class=get_subsearcher('zimuzu'), debug=True) subfinder.start() files = [f for f in os.listdir(directory) if f.endswith('.ass') or f.endswith('.srt')] assert len(files) >= 0
def test_search_subs_by_subhd(videofile: pathlib.Path): parent = videofile.parent rm_subtitles(parent) sc = get_subsearcher('subhd') subfinder = SubFinder(path=videofile, subsearcher_class=sc, debug=True) subfinder.start() exts = sc.SUPPORT_EXTS files = [f for f in parent.iterdir() if f.suffix[1:] in exts] assert len(files) >= 0