Class: RecordingTS

Inherits:
Object
  • Object
show all
Defined in:
lib/recording_ts.rb

Instance Method Summary collapse

Constructor Details

#initialize(recording) ⇒ RecordingTS

Returns a new instance of RecordingTS.



4
5
6
# File 'lib/recording_ts.rb', line 4

def initialize(recording)
	@parent = recording
end

Instance Method Details

#process!Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/recording_ts.rb', line 7

def process!()
	target_file = @parent.target_dir + "/#{@parent.friendly_name}.ts"
	FileDir.mkdirtree(@parent.target_dir)
	tf = File.new(target_file, 'wb:ascii-8bit')
	source_files = Dir.glob("#{@parent.directory}/*.ts")
	source_files.sort!
	source_files.each { | source_file |
 sf = File.new(source_file, 'rb:ascii-8bit')
 while not sf.eof?
tf.write(sf.read(1*(2**20))) # Only read some bytes at once
sleep(0.01) # Be friendly to other processes
 end
 sf.close
	}
end