venus_video 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/venus.rb +49 -1
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e3081b91e825af2e25590bf8f0986f91a4c0f8588089873dd9b4e0b039e8d366
4
- data.tar.gz: 4c2e862ebaf55dd5cdd6e42d31967461c13748fc4eabbf8a802383555bf12eff
3
+ metadata.gz: c5baf63783ab590a23d4a88870cd42ed127c50614141eb17ad5d29f5783e55e1
4
+ data.tar.gz: e72d5df9e471aab1d7e0d05a9326bb00fc4e45b23d40723e4dba9e81402f59d7
5
5
  SHA512:
6
- metadata.gz: 94ffc262bb9c5ed8a9a0d8002b0d14dc667262bf904b93963ba1686bbe150bd833fbb9a44e101a1b4c5952b42d293222bbecf988e8ea7f2c8d0489a66dffa762
7
- data.tar.gz: c0e39e8c3b60b0bf705d938951f5acbfce6dc9a553cec83775b65bb3ec3b2e1e491fe1e6c3b7133d3270a960d858492f33da18df8a5a35c0b33a12028207eac9
6
+ metadata.gz: 8f01d55ad8f331500548384d86b454808618072bad24d5d79d6eda20bf5987bfe7c7b2bb4cfc75ecb342822e9a733a716b845eeb79e3dd22a9d615fcf23b1b82
7
+ data.tar.gz: 6d4737b9d4fe43fdd9731d04b203e39f8c14ca5c48738b3dd2d84df94b88f857a80971f8f153f7fba22c885571579253a84946d2bc9e6caaab93d3cb37598a94
data/lib/venus.rb CHANGED
@@ -136,4 +136,52 @@ module Venus
136
136
  [input_file1, input_file2, output_file]
137
137
  end
138
138
  end
139
- end
139
+
140
+ class BlurVideo
141
+ def self.blur_video(input_file, output_file, path: nil, blur_intensity: 20)
142
+ unless File.exist?(input_file)
143
+ puts "File not found: #{input_file}"
144
+ exit 1
145
+ end
146
+
147
+ # Проверка на допустимость blur_intensity
148
+ unless blur_intensity.is_a?(Numeric) && blur_intensity >= 0
149
+ puts "Invalid blur intensity. It should be a non-negative number."
150
+ exit 1
151
+ end
152
+
153
+ output_file = "#{output_file}.mp4" unless output_file.end_with?('.mp4')
154
+
155
+ output_path = path ? File.join(path, output_file) : File.join(Dir.pwd, output_file)
156
+
157
+ command = "ffmpeg -i #{input_file} -vf 'boxblur=#{blur_intensity}:1' -c:a copy #{output_path}"
158
+
159
+ Open3.popen3(command) do |_stdin, _stdout, stderr, wait_thr|
160
+ while line = stderr.gets
161
+ puts line
162
+ end
163
+
164
+ exit_status = wait_thr.value
165
+ unless exit_status.success?
166
+ puts "Error executing command: #{command}"
167
+ exit 1
168
+ end
169
+ end
170
+ end
171
+
172
+ def self.process_arguments(args_string)
173
+ args = args_string.split
174
+
175
+ # Проверяем количество аргументов
176
+ if args.length < 2 || args.length > 4
177
+ puts 'Usage: ruby main.rb <input_file> <output_file> [path] [blur_intensity]'
178
+ exit 1
179
+ end
180
+
181
+ input_file = args[0]
182
+ output_file = args[1]
183
+
184
+ [input_file, output_file]
185
+ end
186
+ end
187
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: venus_video
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - acm-wq