bindestriche / srt_fix

yt-autosub-srt-fix a yt-dlp plugin to fix double lines of youtube subtitles converted to srt via ffmpeg
The Unlicense
22 stars 5 forks source link

Fix to allow `srt_fix` to run with `--skip-download` #12

Closed bashonly closed 3 weeks ago

bashonly commented 4 months ago

Improve plugin to allow usage of --use-postprocessor srt_fix:when=before_dl --skip-download

See https://github.com/yt-dlp/yt-dlp/issues/6986#issuecomment-1743692895

Closes #9

My editor auto-removed some unnecessary whitespace, I can revert those lines if desired

bindestriche commented 4 months ago

@bashonly thanks for the suggestion. I am not quite sure what the code does. It seems the subtitles dict does not get updated, I can however just create a new file. the additional import of FFmpegSubtitlesConvertorPP seems to work. I now implemented a botched version of your suggestion allready.


            subs = dedupe_yt_srt(srt.subs)
            text=subs_to_text(subs)     

            sub_info['data'] = text
            modified_subtitles[lang] = sub_info
            with open(original_filepath[:-4]+".srt","w",encoding="utf-8") as f:
                f.write(text)

        subtitles.update(modified_subtitles) # Merge```