class Object
Public Instance Methods
delete_backups(f)
click to toggle source
# File bin/mkvtoolhelper, line 14 def delete_backups f i = 0 while File.exist?(f.path + ".backup#{i}") do FileUtils.rm "#{f.path}.backup#{i}" i += 1 end end
print_audio(group)
click to toggle source
# File bin/mkvtoolhelper, line 207 def print_audio group file = group.first puts "Audio tracks in this group:" file.audio.each do |a| puts " #{a.default ? ?* : ' '} #{a.id}: #{a.name} (#{a.language}, #{a.codec})" end end
print_group(group)
click to toggle source
# File bin/mkvtoolhelper, line 202 def print_group group puts "Files in this group:" group.each { |f| puts " #{f.path}" } end
print_subtitles(group)
click to toggle source
# File bin/mkvtoolhelper, line 221 def print_subtitles group file = group.first puts "Subtitles tracks in this group:" file.subtitles.each do |a| puts " #{a.default ? ?* : ' '} #{a.id}: #{a.name} (#{a.language})" end end
process_groups(groups, kit)
click to toggle source
# File bin/mkvtoolhelper, line 235 def process_groups groups, kit begin $kit = kit commands = [*kit[:commands], *$commands] $temp_commands = commands groups.each do |group| $group = group print_group group kit[:print].call group catch (:next) do while line = Readline.readline("> ", true) accepting = commands.select { |c| c.accepts line } # sanity check raise "Multiple commands for '#{line}'" if accepting.size > 1 if accepting.empty? puts "No matching command." else accepting.first.action! end end end end ensure $group = nil $kit = nil end end
rotate_backups(f)
click to toggle source
# File bin/mkvtoolhelper, line 8 def rotate_backups f i = 0 i += 1 while File.exist?(f.path + ".backup#{i}") i.downto(1) { |i| FileUtils.mv "#{f.path}.backup#{i - 1}", "#{f.path}.backup#{i}" } end