Sha256: 3da32396e3a23d4c171b06b755fa82bb5e1b744e18d702cf87f5fcbd9a11a77b

Contents?: true

Size: 817 Bytes

Versions: 1

Compression:

Stored size: 817 Bytes

Contents

require 'fileutils'

module SimplePvr
  class Recorder
    def initialize(tuner, recording)
      @tuner, @recording = tuner, recording
    end
  
    def start!
      @directory = PvrInitializer.recording_manager.create_directory_for_recording(@recording)
      PvrInitializer.hdhomerun.start_recording(@tuner, @recording.channel.frequency, @recording.channel.channel_id, @directory)
      
      icon_url = @recording.programme.icon_url
      ProgrammeIconFetcher.fetch(icon_url, "#{@directory}/icon") if icon_url
      
      PvrLogger.info "Started recording #{@recording.show_name} in #{@directory}"
    end
  
    def stop!
      PvrInitializer.hdhomerun.stop_recording(@tuner)
      Ffmpeg.create_thumbnail_for(@directory)
    
      PvrLogger.info "Stopped recording #{@recording.show_name}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_pvr-1.1.0 lib/simple_pvr/recorder.rb