cr_subtitle_shift
Version, currently master branch1 version
- master branchlatestMay 27, 2016
github.com/akitaonrails/cr_subtitle_shift
Port of my Shift-Subtitle Ruby script to Crystal
Installation
# Add this to your shard.yml
dependencies:
cr_subtitle_shift:
github: akitaonrails/cr_subtitle_shift
branch: mastermaster is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
- no constraint declared
- License
- MIT
- Author
- AkitaOnRails
Dependencies
This version declares no dependencies.
README
SRT file Time Shift
A few years ago I wrote a hack-ish script in Ruby to shift time in SRT subtitles.
The original script (it's a bit ugly with unnecessary metaprogramming and not clear Time manipulation) is here:
- https://github.com/akitaonrails/Shift-Subtitle/
The goal of this new version in Crystal was to:
- assess how easy it would be to port a Ruby script to Crystal (Time's API is different, so this was a bit difficult at first, but not an obstacle)
- assess how fast it could be compared to the Ruby version.
This is the time it takes for the Ruby script to shift a normal movie-length SRT file:
0,13s user 0,02s system 98% cpu 0,158 total
This Crystal version performs like this for the same input file:
0,02s user 0,00s system 106% cpu 0,020 total
It's not a particularly expensive operation, but more than 6x as fast is a very good start.
Installation
You can compile the binary like this:
crystal build src/cr_subtitle_shift.cr --release
Usage
Once compiled you can time shift your SRT files like this:
./cr_subtitle_shift -o add -t 02,100 movie_subtitle.srt movie_subtitle_shifted.srt
Development
You can run the available specs like this:
crystal specs
Contributing
- Fork it ( https://github.com/akitaonrails/cr_subtitle_shift/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- AkitaOnRails - creator, maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
master- Seen
- May 27, 2016
- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/akitaonrails/cr_subtitle_shift
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 12, 2026
- Synced
- Aug 12, 2026
- Versions
- 1