Correct timestamps within subtitle files (.srt only lol) [=[==[[=[=

Wazakindjes 6f102c90b9 Some clarifications and better file access checks, also remove UTF BOMs cuz many players can't handle em xd 8 months ago
serbur 6f102c90b9 Some clarifications and better file access checks, also remove UTF BOMs cuz many players can't handle em xd 8 months ago
.editorconfig 53fcd92cc3 Added editorc0nfig =] 1 year ago
.gitignore c540c6d6fa Initial commit elemao 2 years ago
LICENSE c540c6d6fa Initial commit elemao 2 years ago
README.md 6f102c90b9 Some clarifications and better file access checks, also remove UTF BOMs cuz many players can't handle em xd 8 months ago
srthax.pl 6f102c90b9 Some clarifications and better file access checks, also remove UTF BOMs cuz many players can't handle em xd 8 months ago

README.md

The fuck is this

This shit allows you to correct the timestamps within subtitle files (.srt and .ass only lol). ;;];]]; As a b0nus, it also converts the files to use Linux-style line endings, cuz many are uploaded with Wind0ngs ones instead. It also shits out a bunch of warnings to help ya find inconsistencies within em subs y0.

Besides the main skrip, there's also a "server" thingy which I'm using from my k0di app so I can easily correct subs as I watch some shit. [=[[=[==[=[=[

Dependencies

srthax itself:

  • Data::Dumper
  • File::Slurp
  • Getopt::Mixed

The server script:

  • Config::IniFiles
  • Data::Dumper
  • File::Basename
  • IO::Handle
  • IO::Select
  • IO::Socket::INET
  • IO::Socket::SSL

Usage

srthax [options] <time shift> <subtitle file(s)>

Due to how Getopt::Mixed works, if you want a negative time shift make sure to terminate the options with --:
srthax -o -- -10 poop.srt

Simply run srthax --halp to view the built-in halp and see all the supported options. ;] The server doesn't take any arguments but works with a config file. Just copy serbur/muhconf.ini.example to serbur/muhconf.ini and edit that shit, everything's explained in thur. ;];]];;] It also doesn't log anything by itself, all info is printed to stdout so you can do whatever you want with it. =] This also means it runs in the foreground and you should probably just run it within screen/tmux.

Note: if you shift subtitles by a negative amount, some lines may end up with negative timestamps too. Those are normally not even shown by the player so I'm not removing them. You can also pass a negative starting timestamp to srthax if needed, although omitting the time will have it read the entire file anyways.