Created
January 16, 2014 00:40
-
-
Save mcolyer/8447698 to your computer and use it in GitHub Desktop.
A very simple tool to convert from [subler](https://code.google.com/p/subler/) chapter export to SBV subtitle format so that youtube will accept it.
This file contains 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 | |
contents = File.read(ARGV[0]) | |
values = {} | |
chapters = [] | |
contents.each_line do |line| | |
key, value = line.split('=') | |
values[key] = value.strip | |
next if key =~ /NAME/ | |
chapters << key | |
end | |
chapters.each do |chapter| | |
start = values[chapter] | |
text = values["#{chapter}NAME"] | |
puts "#{start},#{start}" | |
puts "#{text}" | |
puts | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment