active_encode 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 20e6ade3d61ad1841bcc39b5fbb7b2574a193c420cd2de46ccd8870673e2a97b
4
- data.tar.gz: daa888be0970d54530da2d1dcbc3fcb0eb4e254ba52e219e6e83c8a054c6e445
3
+ metadata.gz: 9104a0bde11fcf84284f375301d9c4b2de4a25010e8834a363323b7e8e0bb994
4
+ data.tar.gz: d03aa952ac5d8cee3b8668950563e3b4ce4c2fb4cfade4562f69b48918b60e37
5
5
  SHA512:
6
- metadata.gz: ea736ead421bf6640916c675ba1b6f2529206ababccf9dd25776ba049a9eedd390171d0e2dd87c61c3fc68acdd80731cd86b8f35798435153fe6289f7c8fa8d0
7
- data.tar.gz: 753701c6f655a8ae671d1dd4c2538a5ae2ef47abe797297e9ffdd3c810f7c995ce2949a047b721405f34b4c83c132c29981bdb7e2416ac49813e18257e20bd40
6
+ metadata.gz: 6e3280b175e3943a28094f5298fe5c9674317b3d8d4147d83a9d5f215edd9dd422f452f7181fb57f28ebbc7632775c9bc6b91bdd7b72b5abe239c56edc7c3caf
7
+ data.tar.gz: '01062903b0008ae7299d1b97c91f26d8a1b8b6f4b69fb14a5722a577046da6b6357b0f8970b150c25735471d23166d1a25e78f216228cfcc87ad4ca257eecf98'
data/.circleci/config.yml CHANGED
@@ -25,6 +25,7 @@ jobs:
25
25
  steps:
26
26
  - run:
27
27
  command: |
28
+ sudo rm /etc/apt/sources.list.d/google-chrome.list # We don't need chrome and it is causing problems so just remove it
28
29
  sudo apt-get update
29
30
  sudo apt-get install libmms0
30
31
  sudo wget -P /tmp/ https://mediaarea.net/download/binary/libzen0/0.4.39/libzen0v5_0.4.39-1_amd64.Debian_11.deb
@@ -17,10 +17,8 @@ module ActiveEncode
17
17
  MEDIAINFO_PATH = ENV["MEDIAINFO_PATH"] || "mediainfo"
18
18
  FFMPEG_PATH = ENV["FFMPEG_PATH"] || "ffmpeg"
19
19
 
20
- def create(input_url, options = {})
21
- # Decode file uris for ffmpeg (mediainfo works either way)
22
- input_url = Addressable::URI.unencode(input_url) if input_url.starts_with? "file:///"
23
- input_url = ActiveEncode.sanitize_input(input_url)
20
+ def create(original_input_url, options = {})
21
+ input_url = sanitize_input_url(original_input_url)
24
22
 
25
23
  new_encode = ActiveEncode::Base.new(input_url, options)
26
24
  new_encode.id = SecureRandom.uuid
@@ -76,9 +74,7 @@ module ActiveEncode
76
74
 
77
75
  # Copy derivatives to work directory
78
76
  options[:outputs].each do |opt|
79
- url = opt[:url]
80
- output_path = working_path("outputs/#{ActiveEncode.sanitize_base opt[:url]}#{File.extname opt[:url]}", new_encode.id)
81
- FileUtils.cp FileLocator.new(url).location, output_path
77
+ output_path = copy_derivative_to_working_path(opt[:url], new_encode.id)
82
78
  filename_label_hash[output_path] = opt[:label]
83
79
  end
84
80
 
@@ -271,6 +267,31 @@ module ActiveEncode
271
267
  write_errors new_encode
272
268
  new_encode
273
269
  end
270
+
271
+ def sanitize_input_url(url)
272
+ input_url = if url.starts_with?("file://")
273
+ # Decode file uris for ffmpeg (mediainfo works either way)
274
+ Addressable::URI.unencode(url)
275
+ elsif url.starts_with?("s3://")
276
+ # Change s3 uris into presigned http urls
277
+ FileLocator.new(url).location
278
+ else
279
+ url
280
+ end
281
+ ActiveEncode.sanitize_input(input_url)
282
+ end
283
+
284
+ def copy_derivative_to_working_path(url, id)
285
+ output_path = working_path("outputs/#{ActiveEncode.sanitize_base url}#{File.extname url}", id)
286
+ if url.start_with? "s3://"
287
+ # Use aws-sdk-s3 download_file method
288
+ # Single request mode needed for compatibility with minio
289
+ FileLocator::S3File.new(url).object.download_file(output_path, mode: 'single_request')
290
+ else
291
+ FileUtils.cp FileLocator.new(url).location, output_path
292
+ end
293
+ output_path
294
+ end
274
295
  end
275
296
  end
276
297
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ActiveEncode
3
- VERSION = '1.2.1'
3
+ VERSION = '1.2.2'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_encode
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Klein, Chris Colvard, Phuong Dinh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-21 00:00:00.000000000 Z
11
+ date: 2024-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -318,7 +318,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
318
318
  - !ruby/object:Gem::Version
319
319
  version: '0'
320
320
  requirements: []
321
- rubygems_version: 3.1.6
321
+ rubygems_version: 3.5.6
322
322
  signing_key:
323
323
  specification_version: 4
324
324
  summary: Declare encode job classes that can be run by a variety of encoding services