Created
April 7, 2015 00:19
-
-
Save armanbilge/961dc674ab8401d2ce8a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
Encoding.default_external = "UTF-8" | |
i = 0 | |
puts STDIN.read.sub(/(WEBVTT\s+)(\d{2}:)/){|s| "#{$2}"}.gsub(/(\d{2}:\d{2})\.(\d{3}\s+)-->(\s+\d{2}:\d{2})\.(\d{3}\s*)/) { |s| | |
"#{i+=1}\n#{s.sub(/(\d{2}:\d{2})\.(\d{3}\s+)-->(\s+)(\d{2}:\d{2})\.(\d{3}\s*)/){|t| "00:#{$1},#{$2}-->#{$3}00:#{$4},#{$5}"}}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment