Laev.Subtitles (laev v0.1.40)

Copy Markdown View Source

Convert subtitle files to WebVTT, which is the only format an HTML5 <video> <track> accepts. Handles SubRip (.srt) and Advanced SubStation Alpha (.ass, common for anime), dispatching on the file name.

Summary

Functions

ASS → WebVTT: keep only the dialogue events, drop styling/override tags. Not a full ASS renderer, but yields readable timed text the browser shows.

Known subtitle file extensions.

SubRip → WebVTT: add the header and switch the comma decimal to a dot.

True when the filename ends in a known subtitle extension.

Convert by file extension; falls back to SRT handling.

Functions

ass_to_vtt(ass)

ASS → WebVTT: keep only the dialogue events, drop styling/override tags. Not a full ASS renderer, but yields readable timed text the browser shows.

extensions()

Known subtitle file extensions.

srt_to_vtt(srt)

SubRip → WebVTT: add the header and switch the comma decimal to a dot.

subtitle_filename?(name)

True when the filename ends in a known subtitle extension.

to_vtt(filename, content)

Convert by file extension; falls back to SRT handling.