Class: Agqr::Recorder

Inherits:
Object
  • Object
show all
Defined in:
lib/agqr/recorder.rb,
lib/agqr/recorder/job.rb

Defined Under Namespace

Classes: Job

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Recorder

Returns a new instance of Recorder.



10
11
12
13
# File 'lib/agqr/recorder.rb', line 10

def initialize(attributes)
  @attributes = attributes
  @jobs = []
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



8
9
10
# File 'lib/agqr/recorder.rb', line 8

def attributes
  @attributes
end

#jobsObject

Returns the value of attribute jobs.



7
8
9
# File 'lib/agqr/recorder.rb', line 7

def jobs
  @jobs
end

Instance Method Details

#load_programsObject



15
16
17
18
19
20
# File 'lib/agqr/recorder.rb', line 15

def load_programs
  programs.each do |program|
    reserve(program)
  end
  exec
end

#record(job) ⇒ Object



29
30
31
32
# File 'lib/agqr/recorder.rb', line 29

def record(job)
  cmd = "#{rtmpdump} -r #{agqr_stream_url} --live -B #{job.program.length} -o #{save_path}/#{job.program.title}_#{Time.now.strftime('%Y%m%d').gsub(' ', '')}.flv"
  system cmd
end

#reserve(program) ⇒ Object



22
23
24
25
26
27
# File 'lib/agqr/recorder.rb', line 22

def reserve(program)
  job = Job.new(self)
  job.build(program)
  jobs << job
  job.start
end