digitalfilmtree-util 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/Gemfile +4 -0
- data/Guardfile +24 -0
- data/LICENSE.txt +22 -0
- data/README.md +37 -0
- data/Rakefile +1 -0
- data/digitalfilmtree-util.gemspec +26 -0
- data/lib/digitalfilmtree/util.rb +50 -0
- data/lib/digitalfilmtree/util/mediainfo.rb +45 -0
- data/lib/digitalfilmtree/util/version.rb +5 -0
- data/spec/lib/digitalfilmtree/util/mediainfo_spec.rb +59 -0
- data/spec/spec_helper.rb +20 -0
- data/vendor/util/mediainfo/mac/mediainfo +0 -0
- data/vendor/util/mediainfo/windows/MediaInfo.dll +0 -0
- data/vendor/util/mediainfo/windows/MediaInfo.exe +0 -0
- metadata +132 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: befd82ff77366a8961088664e8546f88b1f18ffb
|
4
|
+
data.tar.gz: bded79bfe2fb99b34fcce572c5b555eda8f22f6f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: db0968fcdd2a6b6c8755b8ba1f6d416ff1b073e4662a12ffcd1ddfea026a2c1f7be9b5898220101b0cad528cdf7d0f36d2857d1b8586379101ced0334ee3cb3a
|
7
|
+
data.tar.gz: 15ad971fd6d9850c89c3abccec64353c03e662e9883e14cbbf1dc6262e247eef8eeab2ff0c73763f858b8a60a9584b3695566751c600007b30ff33cc155ddb69
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard :rspec do
|
5
|
+
watch(%r{^spec/.+_spec\.rb$})
|
6
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
7
|
+
watch('spec/spec_helper.rb') { "spec" }
|
8
|
+
|
9
|
+
# Rails example
|
10
|
+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
11
|
+
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
12
|
+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
13
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
14
|
+
watch('config/routes.rb') { "spec/routing" }
|
15
|
+
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
16
|
+
|
17
|
+
# Capybara features specs
|
18
|
+
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
|
19
|
+
|
20
|
+
# Turnip features and steps
|
21
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
22
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
|
23
|
+
end
|
24
|
+
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Keyvan Fatehi
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Digitalfilmtree::Util
|
2
|
+
|
3
|
+
Provides methods used in our other gems -- specifically for
|
4
|
+
cross-platform compatibilities.
|
5
|
+
|
6
|
+
## Contents
|
7
|
+
|
8
|
+
### Digitalfilmtree::Util::Mediainfo
|
9
|
+
|
10
|
+
Contains vendored binaries for Windows 7 x64 or newer and Mac OS X 10.6
|
11
|
+
or newer
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
Add this line to your application's Gemfile:
|
16
|
+
|
17
|
+
gem 'digitalfilmtree-util'
|
18
|
+
|
19
|
+
And then execute:
|
20
|
+
|
21
|
+
$ bundle
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
$ gem install digitalfilmtree-util
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
TODO: Write usage instructions here
|
30
|
+
|
31
|
+
## Contributing
|
32
|
+
|
33
|
+
1. Fork it
|
34
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
35
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
36
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
37
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'digitalfilmtree/util/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "digitalfilmtree-util"
|
8
|
+
spec.version = Digitalfilmtree::Util::VERSION
|
9
|
+
spec.authors = ["Keyvan Fatehi"]
|
10
|
+
spec.email = ["keyvan@digitalfilmtree.com"]
|
11
|
+
spec.description = %q{Contains common utilities and vendored binaries used in libraries related to DigitalFilm Tree's post production workflow}
|
12
|
+
spec.summary = %q{Contains common utilities and vendored binaries}
|
13
|
+
spec.homepage = "https://github.com/DFTi/digitalfilmtree-util"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "pry"
|
24
|
+
spec.add_development_dependency "guard-rspec"
|
25
|
+
spec.add_development_dependency "simplecov"
|
26
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require "digitalfilmtree/util/version"
|
2
|
+
|
3
|
+
module Digitalfilmtree
|
4
|
+
module Util
|
5
|
+
FILE_SEP = File::ALT_SEPARATOR || File::SEPARATOR
|
6
|
+
|
7
|
+
##
|
8
|
+
# Pass a file path through this to fix separators
|
9
|
+
def self.safe_path path
|
10
|
+
path.gsub(File::SEPARATOR, FILE_SEP)
|
11
|
+
end
|
12
|
+
|
13
|
+
##
|
14
|
+
# Grab a vendored binary
|
15
|
+
def self.vendored_bin name, platform, filename
|
16
|
+
Util.safe_path(File.expand_path(
|
17
|
+
File.join(File.dirname(__FILE__),
|
18
|
+
'..', '..','vendor', 'util',
|
19
|
+
name.to_s, platform.to_s, filename)))
|
20
|
+
end
|
21
|
+
|
22
|
+
##
|
23
|
+
# Introspect about the platform
|
24
|
+
def self.platform
|
25
|
+
require 'rbconfig'
|
26
|
+
@platform ||= Class.new do
|
27
|
+
def initialize
|
28
|
+
@os = RbConfig::CONFIG['host_os']
|
29
|
+
end
|
30
|
+
|
31
|
+
def windows?
|
32
|
+
@os =~ /mswin|mingw|cygwin/
|
33
|
+
end
|
34
|
+
|
35
|
+
def mac?
|
36
|
+
@os =~ /darwin/
|
37
|
+
end
|
38
|
+
|
39
|
+
def linux?
|
40
|
+
@os =~ /linux/
|
41
|
+
end
|
42
|
+
|
43
|
+
def to_s
|
44
|
+
@os
|
45
|
+
end
|
46
|
+
end.new
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'digitalfilmtree/util'
|
2
|
+
|
3
|
+
module Digitalfilmtree
|
4
|
+
module Util
|
5
|
+
module Mediainfo
|
6
|
+
REGEX = {
|
7
|
+
:start_timecode =>
|
8
|
+
/Time code of first frame\s+\:\s(.+)\n/
|
9
|
+
}
|
10
|
+
|
11
|
+
def mediainfo path, key
|
12
|
+
raise "Mediainfo bin path unset" unless Mediainfo.bin
|
13
|
+
if Util.platform.windows?
|
14
|
+
path = Util.safe_path path
|
15
|
+
end
|
16
|
+
output = `#{Mediainfo.bin} "#{path}"`
|
17
|
+
|
18
|
+
if key
|
19
|
+
output.scan(REGEX[key]).flatten.first
|
20
|
+
else
|
21
|
+
output
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.bin
|
26
|
+
@@binpath ||= false
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.bin= path
|
30
|
+
raise "No such binary #{path}" unless File.exists? path
|
31
|
+
@@binpath = path
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.autoconfigure
|
35
|
+
os = Util.platform
|
36
|
+
if os.windows?
|
37
|
+
path = Util.vendored_bin(:mediainfo, :windows, 'MediaInfo.exe')
|
38
|
+
Mediainfo.bin = Util.safe_path(path)
|
39
|
+
elsif os.mac?
|
40
|
+
Mediainfo.bin = Util.vendored_bin(:mediainfo, :mac, 'mediainfo')
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'digitalfilmtree/util/mediainfo'
|
3
|
+
|
4
|
+
describe Digitalfilmtree::Util::Mediainfo do
|
5
|
+
describe ".bin (binary path)" do
|
6
|
+
it "is initially unset" do
|
7
|
+
subject.bin.should be_false
|
8
|
+
end
|
9
|
+
|
10
|
+
context "when set" do
|
11
|
+
let(:path) { __FILE__ }
|
12
|
+
before { subject.bin = path }
|
13
|
+
it "is global to the module" do
|
14
|
+
Digitalfilmtree::Util::Mediainfo.bin.should eq path
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
let(:platform) { Digitalfilmtree::Util.platform }
|
20
|
+
|
21
|
+
describe ".autoconfigure" do
|
22
|
+
context "on windows 7 x64 and up" do
|
23
|
+
before do
|
24
|
+
platform.stub(:mac?).and_return(false)
|
25
|
+
platform.stub(:windows?).and_return(true)
|
26
|
+
end
|
27
|
+
it "sets the binary to the vendored windows exe" do
|
28
|
+
subject.autoconfigure
|
29
|
+
subject.bin.should match /windows/
|
30
|
+
File.exists?(subject.bin).should be_true
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context "on mac 10.6 and up" do
|
35
|
+
before do
|
36
|
+
platform.stub(:mac?).and_return(true)
|
37
|
+
platform.stub(:windows?).and_return(false)
|
38
|
+
end
|
39
|
+
it "sets the binary to the vendored mac binary" do
|
40
|
+
subject.autoconfigure
|
41
|
+
subject.bin.should match /mac/
|
42
|
+
File.exists?(subject.bin).should be_true
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe ".mediainfo" do
|
47
|
+
before do
|
48
|
+
Digitalfilmtree::Util::Mediainfo .autoconfigure
|
49
|
+
end
|
50
|
+
subject { Class.new {
|
51
|
+
include Digitalfilmtree::Util::Mediainfo
|
52
|
+
}.new }
|
53
|
+
it "queries using mediainfo" do
|
54
|
+
version_string = "MediaInfo Command line, \nMediaInfoLib - v0.7.64\n"
|
55
|
+
subject.mediainfo("--version", false).should eq version_string
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
SimpleCov.start
|
3
|
+
|
4
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
5
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
6
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
7
|
+
# loaded once.
|
8
|
+
#
|
9
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
10
|
+
RSpec.configure do |config|
|
11
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
12
|
+
config.run_all_when_everything_filtered = true
|
13
|
+
config.filter_run :focus
|
14
|
+
|
15
|
+
# Run specs in random order to surface order dependencies. If you find an
|
16
|
+
# order dependency and want to debug it, you can fix the order by providing
|
17
|
+
# the seed, which is printed after each run.
|
18
|
+
# --seed 1234
|
19
|
+
config.order = 'random'
|
20
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
metadata
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: digitalfilmtree-util
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Keyvan Fatehi
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-08-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: guard-rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Contains common utilities and vendored binaries used in libraries related
|
84
|
+
to DigitalFilm Tree's post production workflow
|
85
|
+
email:
|
86
|
+
- keyvan@digitalfilmtree.com
|
87
|
+
executables: []
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- .gitignore
|
92
|
+
- Gemfile
|
93
|
+
- Guardfile
|
94
|
+
- LICENSE.txt
|
95
|
+
- README.md
|
96
|
+
- Rakefile
|
97
|
+
- digitalfilmtree-util.gemspec
|
98
|
+
- lib/digitalfilmtree/util.rb
|
99
|
+
- lib/digitalfilmtree/util/mediainfo.rb
|
100
|
+
- lib/digitalfilmtree/util/version.rb
|
101
|
+
- spec/lib/digitalfilmtree/util/mediainfo_spec.rb
|
102
|
+
- spec/spec_helper.rb
|
103
|
+
- vendor/util/mediainfo/mac/mediainfo
|
104
|
+
- vendor/util/mediainfo/windows/MediaInfo.dll
|
105
|
+
- vendor/util/mediainfo/windows/MediaInfo.exe
|
106
|
+
homepage: https://github.com/DFTi/digitalfilmtree-util
|
107
|
+
licenses:
|
108
|
+
- MIT
|
109
|
+
metadata: {}
|
110
|
+
post_install_message:
|
111
|
+
rdoc_options: []
|
112
|
+
require_paths:
|
113
|
+
- lib
|
114
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - '>='
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - '>='
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
requirements: []
|
125
|
+
rubyforge_project:
|
126
|
+
rubygems_version: 2.0.3
|
127
|
+
signing_key:
|
128
|
+
specification_version: 4
|
129
|
+
summary: Contains common utilities and vendored binaries
|
130
|
+
test_files:
|
131
|
+
- spec/lib/digitalfilmtree/util/mediainfo_spec.rb
|
132
|
+
- spec/spec_helper.rb
|