r0oth3x49 / acloud-dl

A cross-platform python based utility to download courses from acloud.guru for personal offline use.
MIT License
351 stars 142 forks source link

VVT2SRT RE.MATCH ISSUE #112

Open outtycast opened 1 year ago

outtycast commented 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