mantas-done / subtitles

Subtitle/caption converter
https://gotranscript.com/subtitle-converter
MIT License
142 stars 48 forks source link

Added speakers to internal_format #85

Open vnali opened 1 year ago

vnali commented 1 year ago

This PR is related to https://github.com/mantas-done/subtitles/issues/61

This PR:

mantas-done commented 1 year ago

Nice job, I will check this commit next week :)

mantas-done commented 1 year ago

Refactored code, check the newest commit from the "master" branch.

Added a new class for Webvtt. Now you can add the speaker like this (as you suggested): (new Webvtt)->add(0, 1, ['John' => 'hello', 'hello to you too'])->...

Also changed the name of styles (vtt_cue_settings -> settings): (new Webvtt)->add(0, 1, 'hello', ['settings' => 'position:50% line:15% align:middle'])->...

Webtt class saves everything to the vtt key: $internal_format[0]['vtt']

For the srt file detection of the speaker is not accurate. Checked a few files and there is text like: These colors: blue, green and red Which would set "These colors" as a speaker.

So for now left srt as is.

What do you think?

vnali commented 1 year ago

You are definitly right about false detection of SRT files, so we must skip SRT speaker detection for now, but:

Please let me know if i misunderstood something Thanks!