Skip to content

Instantly share code, notes, and snippets.

@mcolyer
Created January 16, 2014 00:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcolyer/8447698 to your computer and use it in GitHub Desktop.
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.
#!/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