After many months of on-again, off-again tinkering (because this has bothered me for ages now), I've finally figured out a batch script that works! At least for me, anyway, though I have noticed that the batch process stops unless there is a blank line after the last video file. With batch.rb in a PATH folder and a specific directory specified for queue.txt, this can be run anywhere and plops the transcoded files into the working directory as intended.
In theory, it should also output an error message should the process fail, but I don't know how to make it fail.
#!/usr/bin/env ruby
#
# batch.rb
#
QUEUE_PATH = 'queue.txt'
while true
content = File.read(QUEUE_PATH)
input = content.match(/^.*\R/).to_s.chomp
break if input.empty?
queue = File.new(QUEUE_PATH, 'wb')
queue.print content.sub(/^.*\R/, '')
queue.close
puts "Attempting: ruby C:/bin/transcode-video.rb #{input} #{ARGV.join(' ')}"
result = system('ruby', 'C:/bin/transcode-video.rb', input, *ARGV)
puts "system() returned: #{result.inspect}, exit status: #{$?.inspect}"
break unless result
end
After many months of on-again, off-again tinkering (because this has bothered me for ages now), I've finally figured out a batch script that works! At least for me, anyway, though I have noticed that the batch process stops unless there is a blank line after the last video file. With batch.rb in a PATH folder and a specific directory specified for queue.txt, this can be run anywhere and plops the transcoded files into the working directory as intended.
In theory, it should also output an error message should the process fail, but I don't know how to make it fail.