Module: SleepRoom::Record

Defined in:
lib/sleeproom/record.rb,
lib/sleeproom/record/tasks.rb,
lib/sleeproom/record/record.rb,
lib/sleeproom/record/api/api.rb,
lib/sleeproom/record/api/room.rb,
lib/sleeproom/record/websocket.rb,
lib/sleeproom/record/api/room_api.rb,
lib/sleeproom/record/write_status.rb,
lib/sleeproom/record/api/streaming_api.rb

Defined Under Namespace

Modules: API Classes: Showroom, Tasks, WebSocket, WriteStatus

Class Method Summary collapse

Class Method Details

.call_minyami(url:, is_live: true, threads: configatron.minyami.threads, output:, retries: configatron.minyami.retries) ⇒ Boolean

Okite!!!

Parameters:

  • url (String)

Returns:

  • (Boolean)


18
19
20
21
22
23
24
25
26
27
28
# File 'lib/sleeproom/record.rb', line 18

def self.call_minyami(url:, is_live: true, threads: configatron.minyami.threads, output:, retries: configatron.minyami.retries)
  command = "minyami -d #{Shellwords.escape(url)}"
  command += " --retries #{retries.to_i}" if retries
  command += " --threads #{threads.to_i}" if threads
  command += " --live" if is_live
  output = File.join(configatron.save_path, output)
  command += " --output #{Shellwords.escape(output)}" if output
  download_dir_check(output)
  pid = exec_command(command, output)
  return pid
end

.download_dir_check(output) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/sleeproom/record.rb', line 41

def self.download_dir_check(output)
  dir = File.dirname(output)
  if !Dir.exist?(dir)
    SleepRoom.info("#{dir} does not exist, creating...")
    SleepRoom.mkdir(dir)
  end
end

.exec_command(command, output) ⇒ Boolean

Parameters:

  • command (String)

Returns:

  • (Boolean)


32
33
34
35
36
37
38
39
# File 'lib/sleeproom/record.rb', line 32

def self.exec_command(command, output)
  SleepRoom.info("Call command: #{command}")
  SleepRoom.info("STDOUT: #{output}.out , STDERR: #{output}.err")
  pid = spawn(command, out: "#{output}.out", err: "#{output}.err")
  SleepRoom.info("PID: #{pid}")
  Process.detach(pid)
  return pid
end