Packages
gosavetool
1.0.0
Parse, convert, shift and repair SRT and WebVTT subtitles; word count, social media character limits, Title Case and slugs. No dependencies.
Current section
Files
Jump to
Current section
Files
gosavetool
README.md
README.md
# GoSaveTool for Elixir
Parse, convert, shift and repair **SRT and WebVTT** subtitles, and count **words, characters and reading time** with **social media character limits**, **Title Case**, **slugs** and other case changes. No dependencies.
Made by [GoSaveTool](https://www.gosavetool.com/), free online tools for creators.
## Install
```elixir
def deps do
[{:gosavetool, "~> 1.0"}]
end
```
## Subtitles
```elixir
alias GoSaveTool.Subtitles
vtt = Subtitles.convert(File.read!("movie.srt"), :vtt)
cues = Subtitles.parse(text) # [%Cue{start: 1000, stop: 3500, settings: "", text: "Hello"}, ...]
later = cues |> Subtitles.shift(1500) |> Subtitles.to_srt()
{fixed, n} = Subtitles.repair(cues) # sorted, no overlaps, no empty cues
```
## Text
```elixir
alias GoSaveTool.Text
Text.stats(post) # %{words: 42, chars: 230, chars_no_spaces: 190, lines: 3, sentences: 4, read_seconds: 11}
Text.check_limits(post)["x-post"].fits # also instagram-caption, tiktok-caption, youtube-title, seo-title, ...
Text.title("the lord of the rings") # "The Lord of the Rings"
Text.slug("Ölçü Birimi & Çeviri!") # "olcu-birimi-ceviri"
Text.camel("best posting time") # "bestPostingTime"
```
Characters are Unicode code points, so an emoji counts as one, as on social media. The rules are the same as the [`@gosavetool/subtitles`](https://www.npmjs.com/package/@gosavetool/subtitles) and [`@gosavetool/text`](https://www.npmjs.com/package/@gosavetool/text) JavaScript packages.
## Tests
```bash
mix test
```
## Online tools
[VTT Subtitle Generator](https://www.gosavetool.com/vtt-subtitle-generator), [Auto Captions Generator](https://www.gosavetool.com/auto-captions-generator), [Character Counter](https://www.gosavetool.com/character-counter)
## License
MIT