Class: TranscodingMachine::Server::AtomicParsleyIntegrator

Inherits:
Object
  • Object
show all
Defined in:
lib/transcoding_machine/server/media_file_attributes.rb

Constant Summary collapse

BINARY =
["AtomicParsley"]
OPTIONS =
['-T', '1']
TIMEOUT =
60

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_path) ⇒ AtomicParsleyIntegrator

Returns a new instance of AtomicParsleyIntegrator.



495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
# File 'lib/transcoding_machine/server/media_file_attributes.rb', line 495

def initialize(file_path)
  commandline = []
  commandline += BINARY
  commandline += [file_path]
  commandline += OPTIONS
  puts "trying to run: #{commandline.join(' ')}"
  result = begin
    timeout(TIMEOUT) do
      Open3.popen3(*commandline) do |i, o, e|
        o.read
      end
    end
  rescue Timeout::Error => e
    puts "Timeout reached when inspecting #{file_path} with AtomicParsley"
    raise e
  end

  @tracks = {:container => {:type => :container, :ipod_uuid => false}}

  atomic_parsley_values = Hash.new

  if result =~ /Atom uuid=6b6840f2-5f24-4fc5-ba39-a51bcf0323f3/
    @tracks[:container][:ipod_uuid] = true
    atomic_parsley_values[:ipod_uuid] = true
  end
  @values = atomic_parsley_values
end

Instance Attribute Details

#tracksObject (readonly)

Returns the value of attribute tracks.



490
491
492
# File 'lib/transcoding_machine/server/media_file_attributes.rb', line 490

def tracks
  @tracks
end

#valuesObject (readonly)

Returns the value of attribute values.



490
491
492
# File 'lib/transcoding_machine/server/media_file_attributes.rb', line 490

def values
  @values
end