vidispine 1.5.1 → 1.5.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fad78c8b766bf87d952d77f3a73a667d887b064f
4
- data.tar.gz: eb13dce39554cdd7a0b4b1b00e212ecb7a5abe72
3
+ metadata.gz: b57220a13423aaf8fab088c32d0f837222ed74f2
4
+ data.tar.gz: f853f25d95937d7ef4b58d8b4236156e9f67437d
5
5
  SHA512:
6
- metadata.gz: 18a6979587fe7a8d85f90dcb248c7cb45558e6d8393a0064a921fa6d8000a7206b33b5f9d483f5bf5fee1ff7d074cfd6905e58b8849f3e9989361991efed13bf
7
- data.tar.gz: 867ace58974e2d2615bfba584b00585010db7438aeff9dd6dc6c520944898be4990d7f3b9409fd1370e45662340e535885523501245c39526b244656d97a5c86
6
+ metadata.gz: e1b99aa261d29fcbcd41f270762d174b4f98222554504f45e8a5e047153e7ea46926a03d5d77a5b4cfc116f86a4ffb80b7f992890dda387c6be9fbb1ab35050f
7
+ data.tar.gz: 43e181f59a8e2ace6afd9a4ddcdf0a06b1efa496a7bc2d8ca60b28ca2d0371b39b6c0256decbbfac3664437dc8639862c346b06ac6fa6b52a37e6aa288e40f6c
@@ -849,12 +849,13 @@ module Vidispine
849
849
  process_request(_request, options)
850
850
  end
851
851
 
852
- # @note UNDOCUMENTED API METHOD
853
852
  # @param [Hash] args
854
853
  # @option args [String] :storage_id (Required)
855
854
  # @option args [String] :path (Required)
856
855
  # @option args [Boolean] :create_only
857
856
  # @option args [String] :state
857
+ #
858
+ # @see http://apidoc.vidispine.com/latest/ref/storage/file.html#create-a-file-entity-in-the-database
858
859
  def storage_file_create(args = { }, options = { })
859
860
  _request = Requests::BaseRequest.new(
860
861
  args,
@@ -188,10 +188,12 @@ module Vidispine
188
188
  # @option args [Any] :body (nil)
189
189
  # @param [Hash] options
190
190
  # @option options [Hash] :default_request_headers (@default_request_headers)
191
+ # @option options [Hash] :headers
192
+ # @option options [Hash] :query
191
193
  def build_request(method_name = :get, args = { }, options = { })
192
194
  headers = args[:headers] || options[:headers] || { }
193
195
  path = args[:path] || ''
194
- query = args[:query] || { }
196
+ query = args[:query] || options[:query] || { }
195
197
  body = args[:body]
196
198
 
197
199
  # Allow the default request headers to be overridden
@@ -200,7 +200,7 @@ module Vidispine
200
200
 
201
201
  def query
202
202
  @query ||= begin
203
- query_arguments.is_a?(Hash) ? query_arguments.map { |k,v| "#{CGI.escape(k.to_s).gsub('+', '%20')}=#{CGI.escape(v.respond_to?(:to_s) ? v.to_s : v).gsub('+', '%20')}" }.join('&') : query_arguments
203
+ query_arguments.is_a?(Hash) ? (client.http_client.default_query_data.merge(query_arguments)).map { |k,v| "#{CGI.escape(k.to_s).gsub('+', '%20')}=#{CGI.escape(v.respond_to?(:to_s) ? v.to_s : v).gsub('+', '%20')}" }.join('&') : query_arguments
204
204
  end
205
205
  end
206
206
 
@@ -7,12 +7,14 @@ module Vidispine
7
7
 
8
8
  class Utilities < Client
9
9
 
10
+ DEFAULT_REQUIRE_METADATA_MAP_MATCH = false
11
+
10
12
  attr_accessor :default_metadata_map, :default_storage_map
11
13
 
12
14
  def initialize(args = { })
13
15
  @default_storage_map = args[:storage_map] || { }
14
16
  @default_metadata_map = args[:metadata_map] || { }
15
-
17
+ @default_require_metadata_map_match = args.fetch(:require_metadata_map_match, DEFAULT_REQUIRE_METADATA_MAP_MATCH)
16
18
  super
17
19
  end
18
20
 
@@ -309,9 +311,11 @@ module Vidispine
309
311
  # @return [Hash]
310
312
  def self.build_metadata_document(metadata_in, map = { }, options = { })
311
313
  # map = (options[:default_metadata_map]).merge((options[:metadata_map] || { }).merge(map))
314
+ require_map_match = options.fetch(:require_metadata_map_match, DEFAULT_REQUIRE_METADATA_MAP_MATCH)
312
315
  groups = { }
313
316
  metadata_in.each do |k,v|
314
317
  _map = map[k]
318
+ _map = k if _map.nil? && !require_map_match
315
319
  next unless _map
316
320
  _map = [ _map ] unless _map.is_a?(Array)
317
321
  _map.each do |_map_|
@@ -349,19 +353,20 @@ module Vidispine
349
353
 
350
354
  def build_metadata_document(metadata_in, map = { }, options = { })
351
355
  map = (options[:default_metadata_map] || default_metadata_map).merge((options[:metadata_map] || { }).merge(map))
356
+ _require_metadata_map_match = options[:require_metadata_map_match]
357
+ options[:require_metadata_map_match] = @default_require_metadata_map_match if _require_metadata_map_match.nil?
352
358
  self.class.build_metadata_document(metadata_in, map, options)
353
359
  end
354
360
 
355
- # @return [Array]
356
- def build_metadata_documents(metadata_in, map = { }, options = { })
357
- map = (options[:default_metadata_map] || default_metadata_map).merge(map.merge(options[:metadata_map] || { }))
361
+ def self.build_metadata_documents(metadata_in, map = { }, options = { })
362
+ require_map_match = options.fetch(:require_metadata_map_match, DEFAULT_REQUIRE_METADATA_MAP_MATCH)
358
363
  groups = { }
359
364
  metadata_in.each do |k,v|
360
- _map = map[k]
365
+ _map = require_map_match ? map[k] : map.fetch(k, k)
361
366
  next unless _map
362
367
  _map = [ _map ] unless _map.is_a?(Array)
363
368
  _map.each do |_map_|
364
- _map_ = { :field => _map_ } if _map_.is_a?(String)
369
+ _map_ = { :field => _map_ } if _map_.is_a?(String) || _map.is_a?(Symbol)
365
370
  #puts "##{_map_[:group].inspect} #{_map_.class.name} #{_map_.inspect}"
366
371
  (groups[_map_[:group]] ||= { })[_map_[:field]] = v
367
372
  end
@@ -385,6 +390,15 @@ module Vidispine
385
390
  docs
386
391
  end
387
392
 
393
+
394
+ # @return [Array]
395
+ def build_metadata_documents(metadata_in, map = { }, options = { })
396
+ map = (options[:default_metadata_map] || default_metadata_map).merge(map.merge(options[:metadata_map] || { }))
397
+ _require_metadata_map_match = options[:require_metadata_map_match]
398
+ options[:require_metadata_map_match] = @default_require_metadata_map_match if _require_metadata_map_match.nil?
399
+ self.class.build_metadata_documents(metadata_in, map, options)
400
+ end
401
+
388
402
  # @param [String|Hash] field_group
389
403
  # @return [Hash]
390
404
  def cantemo_metadata_field_group_map(field_group, options = { })
@@ -534,6 +548,8 @@ module Vidispine
534
548
  args = symbolize_keys(args, false)
535
549
  _response = { }
536
550
 
551
+ original_shape_tag_name = args[:original_shape_tag_name] || 'original'
552
+
537
553
  # 1. Receive a File Path
538
554
  file_path = args[:file_path]
539
555
  raise ArgumentError, ':file_path is a required argument.' unless file_path
@@ -648,10 +664,14 @@ module Vidispine
648
664
  _response[:collection_object_add] = collection_object_add_response
649
665
  end
650
666
 
667
+ create_thumbnails = args.fetch(:create_thumbnails, true)
668
+ create_posters = args.fetch(:create_posters, 3)
669
+
651
670
  unless shape
652
671
  # 6. Add the file as the original shape
653
672
  logger.debug { 'Adding the file as the Original Shape.' }
654
- item_shape_import_response = item_shape_import(:item_id => item_id, :file_id => file_id, :tag => 'original')
673
+ item_shape_import_response = import_placeholder_item(:item_id => item_id, :file_id => file_id, :tag => original_shape_tag_name)
674
+ # item_shape_import_response = item_shape_import(:item_id => item_id, :file_id => file_id, :tag => original_shape_tag_name)
655
675
  _response[:item_shape_import] = item_shape_import_response
656
676
 
657
677
  job_id = item_shape_import_response['jobId']
@@ -693,8 +713,6 @@ module Vidispine
693
713
  end
694
714
 
695
715
  # 8. Generate the Thumbnails and Poster Frame
696
- create_thumbnails = args.fetch(:create_thumbnails, true)
697
- create_posters = args.fetch(:create_posters, 3)
698
716
  if (create_thumbnails or create_posters)
699
717
  logger.debug { 'Generating Thumbnails(s) and Poster Frame.' }
700
718
  args_out = { :item_id => item_id }
@@ -1,3 +1,3 @@
1
1
  module Vidispine
2
- VERSION = '1.5.1'
2
+ VERSION = '1.5.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vidispine
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Whitson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-05 00:00:00.000000000 Z
11
+ date: 2018-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler