Open outtycast opened 1 year ago
**had issue/error this part of script giving and error with the conversion:
re.error: global flags not at the start of the expression at position 63
I did a work around using ffmpeg and importing subprocess to achieve the same result. you have to add ffmpeg, ffprobe, ffplay to the main folder.**
def download_subtitles(self, subtitle='', filepath=''): if subtitle: filename = "%s\%s" % (filepath, subtitle.filename) if os.name == 'nt' else "%s/%s" % ( filepath, subtitle.filename) try: retval = subtitle.download(filepath=filepath, quiet=True) except KeyboardInterrupt: sys.stdout.write(fc + sd + "\n[" + fr + sb + "-" + fc + sd + "] : " + fr + sd + "User Interrupted..\n") sys.exit(0) else: msg = retval.get('msg') if msg == "download": self.convert(filename=filename) #convert to srt using ffmpeg instead of vvt2srt srt_name = filename.replace('.vtt', '.srt') try: subprocess.run(['ffmpeg', '-i', filename, '-loglevel', 'quiet', '-hide_banner', '-nostats', '-y', srt_name]) except: pass
def download_subtitles(self, subtitle='', filepath=''): if subtitle: filename = "%s\%s" % (filepath, subtitle.filename) if os.name == 'nt' else "%s/%s" % ( filepath, subtitle.filename) try: retval = subtitle.download(filepath=filepath, quiet=True) except KeyboardInterrupt: sys.stdout.write(fc + sd + "\n[" + fr + sb + "-" + fc + sd + "] : " + fr + sd + "User Interrupted..\n") sys.exit(0) else: msg = retval.get('msg') if msg == "download":
#convert to srt using ffmpeg instead of vvt2srt srt_name = filename.replace('.vtt', '.srt') try: subprocess.run(['ffmpeg', '-i', filename, '-loglevel', 'quiet', '-hide_banner', '-nostats', '-y', srt_name]) except: pass
**had issue/error this part of script giving and error with the conversion:
re.error: global flags not at the start of the expression at position 63
I did a work around using ffmpeg and importing subprocess to achieve the same result. you have to add ffmpeg, ffprobe, ffplay to the main folder.**