crgc / srt-linter

A linter for SubRip Text (.srt) files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


Logo

SRT Linter

This project is part of the Microverse Ruby Module
Report Bug · Request Feature

A basic linter for SubRip (.srt) files

The SubRip Text file format (.srt) is a very popular video subtitle format that is widely used all over the web today. This linter checks that the SRT file conforms to the SubRip format.

How to run the SRT Linter

Prerequisites

  1. Ruby (~v2.6.3 or more recent) installed in your machine.

Setup

  • To clone this repository, open your Terminal and execute the following command:
git clone https://github.com/crgc/srt-linter.git

Run

  • Change into the folder
cd srt-linter
  • Install gems
bundle install
  • Locate the .srt file you wish to validate and run it against the SRT Linter
./bin/main.rb <path_to_srt_file>

Good and Bad practices

Numeric sequence for each subtitle

  • Each subtitle should begin with a numeric counter identifying each sequential subtitle

    Numeric sequence

Subtitle timecode

  • The second line of the subtitle is composed by the time that the subtitle should appear on the screen, followed by --> and then the time it should disappear

    Subtitle timecode

Subtitle text & end of subtitle

  • Then comes the subtitle text itself, on one or more lines (this linter imposes a hard limit at 2 lines). Finally, there must be a blank line containing no text, indicating the end of this subtitle

    Subtitle text

Built With

  • Ruby

Authors

👤 Carlos González

🤝 Contributing

Contributions, issues, and feature requests are welcome!

Feel free to check the issues page.

Show your support

Give a ⭐️ if you like this project!

📝 License

This project is MIT licensed.

About

A linter for SubRip Text (.srt) files


Languages

Language:Ruby 100.0%