6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/pig-media-server/aspect.rb', line 6
def run
pit_config = Pit.get 'Pig Media Server'
while true
GC.start
q = open("#{pit_config['user_data_path']}/rate/queue.txt").read.split("\n")
q.each do |x|
key = x.split(' ').first
rate = x.split(' ').last
pig = Pig.find key
next unless pig
puts pig.path
if rate == '16:9'
system 'MP4Box', '-add', "#{pig.record.path}:par=1:1", '-new', "#{pig.record.path}.MP4"
FileUtils.mv "#{pig.record.path}.MP4", pig.record.path
end
end
open("#{pit_config['user_data_path']}/rate/queue.txt", 'w'){|x| x.puts ''}
sleep 5
end
end
|