Skip to content

Instantly share code, notes, and snippets.

@pavels
Created January 20, 2019 23:50
Show Gist options
  • Save pavels/0fb78287560feb3f35fd9f44cdbf8626 to your computer and use it in GitHub Desktop.
Save pavels/0fb78287560feb3f35fd9f44cdbf8626 to your computer and use it in GitHub Desktop.
#!/bin/ruby
require 'rubygems'
require 'bundler'
Bundler.setup(:default)
require 'srt'
file = SRT::File.parse(File.new(ARGV[0]))
outfile_name = File.basename(ARGV[0], '.srt') + '.txt'
File.open(outfile_name, "w") do |f|
file.lines.each do |line|
f.puts line.text.join(" ")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment