Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/Voyeur/converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def call_external_converter
command = "ffmpeg -y -i #{@input_media.filename} #{self.convert_options} #{@output_media.filename}"
out, err = ""

status = Open4::popen4(command) do |pid, stdin, stdout, stderr|
OPEN4::popen4(command) do |pid, stdin, stdout, stderr|
err = ''
out = ''
stderr.each("r") do |line|
Expand All @@ -58,9 +58,9 @@ def call_external_converter
end
end

error_message = err.split('\n').last
error_message = err.split("\n").last

@status = { status: status.exitstatus, stdout: out, stderr: err,
@status = { status: $?.exitstatus, stdout: out, stderr: err,
error_message: error_message, media: @output_media }
return @status
end
Expand Down
2 changes: 1 addition & 1 deletion lib/Voyeur/media.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def initialize(options)

def get_info
output = ''
status = Open4::popen4("ffmpeg -i #{@filename}") do |pid, stdin, stdout, stderr|
OPEN4::popen4("ffmpeg -i #{@filename}") do |pid, stdin, stdout, stderr|
output = stderr.read.strip
end
@raw_duration = $1 if output =~ /Duration: (\d+:\d+:\d+.\d+)/
Expand Down
4 changes: 4 additions & 0 deletions lib/voyeur.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@
require "Voyeur/audio_converters/ogg"
require "Voyeur/media_time"
require 'open4'

module Voyeur
OPEN4 = RUBY_PLATFORM =~ /java/ ? IO : Open4
end