ebert 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MzViYTY1MDZiNTkzYTkyYmYxNTAwZGVkNjBhNWExM2EzOTI1MWE4ZQ==
5
+ data.tar.gz: !binary |-
6
+ MDc0MWFmM2RiZjk1NmNjYmJjMzJjODgzOGIxZDgyYWUxMDUyMjg0ZA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MGUyNDhhYjMwZTM3OWE5NDc3ZmVmMmM1NzgyYjRlM2YwNDY4MWYzZjNiYmFi
10
+ ZTAwOTU2MTU5YjU3ZGVlNTE2NThlNTA4YTY1YWIzZGViNDAyOTkyZGNjODE2
11
+ MWM4MjBlYjU5Y2E1YzUzNmRjYjA3OWRmZDg5ZDFlZTNlMDY1NDk=
12
+ data.tar.gz: !binary |-
13
+ N2RiNjJjOWVhYTAwZGUzNzM3Zjc3Mzc1OTI2NDViODZlNGMxYWFmMTQ1MmNk
14
+ NDQyYThiZDQwMDAyNGUzYmYwOGM4YTk3YmYxNWEwOTQ4ZDdmYjE4MmQ2OWI5
15
+ OWM3Mjk3ZjA4ZmM3ZjU1NDQyZjczNjk0ZjU1ZmVhZTE3OTQxZmU=
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "shoulda", ">= 0"
10
+ gem "rdoc", "~> 3.12"
11
+ gem "bundler", "~> 1.0"
12
+ gem "jeweler", "~> 2.0.1"
13
+ gem "simplecov", ">= 0"
14
+ end
@@ -0,0 +1,80 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activesupport (4.2.4)
5
+ i18n (~> 0.7)
6
+ json (~> 1.7, >= 1.7.7)
7
+ minitest (~> 5.1)
8
+ thread_safe (~> 0.3, >= 0.3.4)
9
+ tzinfo (~> 1.1)
10
+ addressable (2.3.8)
11
+ builder (3.2.2)
12
+ descendants_tracker (0.0.4)
13
+ thread_safe (~> 0.3, >= 0.3.1)
14
+ docile (1.1.5)
15
+ faraday (0.9.1)
16
+ multipart-post (>= 1.2, < 3)
17
+ git (1.2.9.1)
18
+ github_api (0.12.4)
19
+ addressable (~> 2.3)
20
+ descendants_tracker (~> 0.0.4)
21
+ faraday (~> 0.8, < 0.10)
22
+ hashie (>= 3.4)
23
+ multi_json (>= 1.7.5, < 2.0)
24
+ nokogiri (~> 1.6.6)
25
+ oauth2
26
+ hashie (3.4.2)
27
+ highline (1.7.5)
28
+ i18n (0.7.0)
29
+ jeweler (2.0.1)
30
+ builder
31
+ bundler (>= 1.0)
32
+ git (>= 1.2.5)
33
+ github_api
34
+ highline (>= 1.6.15)
35
+ nokogiri (>= 1.5.10)
36
+ rake
37
+ rdoc
38
+ json (1.8.3)
39
+ jwt (1.5.1)
40
+ mini_portile (0.6.2)
41
+ minitest (5.8.0)
42
+ multi_json (1.11.2)
43
+ multi_xml (0.5.5)
44
+ multipart-post (2.0.0)
45
+ nokogiri (1.6.6.2)
46
+ mini_portile (~> 0.6.0)
47
+ oauth2 (1.0.0)
48
+ faraday (>= 0.8, < 0.10)
49
+ jwt (~> 1.0)
50
+ multi_json (~> 1.3)
51
+ multi_xml (~> 0.5)
52
+ rack (~> 1.2)
53
+ rack (1.6.4)
54
+ rake (10.4.2)
55
+ rdoc (3.12.2)
56
+ json (~> 1.4)
57
+ shoulda (3.5.0)
58
+ shoulda-context (~> 1.0, >= 1.0.1)
59
+ shoulda-matchers (>= 1.4.1, < 3.0)
60
+ shoulda-context (1.2.1)
61
+ shoulda-matchers (2.8.0)
62
+ activesupport (>= 3.0.0)
63
+ simplecov (0.10.0)
64
+ docile (~> 1.1.0)
65
+ json (~> 1.8)
66
+ simplecov-html (~> 0.10.0)
67
+ simplecov-html (0.10.0)
68
+ thread_safe (0.3.5)
69
+ tzinfo (1.2.2)
70
+ thread_safe (~> 0.1)
71
+
72
+ PLATFORMS
73
+ ruby
74
+
75
+ DEPENDENCIES
76
+ bundler (~> 1.0)
77
+ jeweler (~> 2.0.1)
78
+ rdoc (~> 3.12)
79
+ shoulda
80
+ simplecov
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2015 Charles Kirk
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,92 @@
1
+ # ebert
2
+
3
+ Inspect any video, describe data field descriptions using mediainfo
4
+
5
+ ### Install ebert
6
+
7
+ ```
8
+ gem install ebert
9
+ ```
10
+
11
+ ### Install MediaInfo
12
+ #### Using Homebrew
13
+
14
+ ```
15
+ brew install mediainfo
16
+ ```
17
+
18
+ #### Other platforms
19
+ http://mediainfo.sourceforge.net/en/Download
20
+ #### From source
21
+ http://mediainfo.sourceforge.net/en/Download/Source
22
+
23
+ ## Basic Usage
24
+
25
+ ```ruby
26
+ results = Ebert.inspect 'path/to/video.mp4'
27
+
28
+ results[:format] # 'MPEG-4'
29
+ results[:duration] # '1mn 1s'
30
+ results[:audio][:format] # 'AAC'
31
+ results[:video][:width] # '1920 pixels'
32
+ ```
33
+
34
+ #### Full info
35
+
36
+ ```ruby
37
+ results = Ebert.inspect 'path/to/video.mp4', full: true
38
+
39
+ results[:file_size]
40
+ # => {
41
+ # string0: '11246943',
42
+ # string1: '10.7 MiB',
43
+ # string2: '11 MiB',
44
+ # string3: '10.7 MiB',
45
+ # string4: '10.73 MiB'
46
+ # }
47
+
48
+ results[:duration]
49
+ # => {
50
+ # string0: '60935',
51
+ # string1: '1mn 0s',
52
+ # string2: '1mn 0s 935ms',
53
+ # string3: '00:01:00.935',
54
+ # string4: '00:01:00;23',
55
+ # string5: '00:01:00.935 (00:01:00;23)'
56
+ # }
57
+
58
+ results[:video][:width]
59
+ # => {
60
+ # string0: '1920',
61
+ # string1: '1920 pixels'
62
+ # }
63
+ ```
64
+
65
+ #### Specify path to MediaInfo
66
+
67
+ ```ruby
68
+ Ebert.mediainfo_path = '/usr/local/bin/mediainfo'
69
+ ```
70
+
71
+ #### Describe a MediaInfo field
72
+
73
+ ```ruby
74
+ Ebert.describe :video, :duration, :string0
75
+ # => "Play time of the stream in ms"
76
+ ```
77
+
78
+ ## Contributing to ebert
79
+
80
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
81
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
82
+ * Fork the project.
83
+ * Start a feature/bugfix branch.
84
+ * Commit and push until you are happy with your contribution.
85
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
86
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
87
+
88
+ ## Copyright
89
+
90
+ Copyright (c) 2015 Archr.IO. See LICENSE.txt for
91
+ further details.
92
+
@@ -0,0 +1,51 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
17
+ gem.name = "ebert"
18
+ gem.homepage = "http://github.com/ablearcher9/ebert"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Inspect any video, describe data field descriptions using mediainfo.}
21
+ gem.description = %Q{Inspect any video, describe data field descriptions using mediainfo.}
22
+ gem.email = "charles@archr.io"
23
+ gem.authors = ["Charles Kirk", "Patrick Randall"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rake/testtask'
29
+ Rake::TestTask.new(:test) do |test|
30
+ test.libs << 'lib' << 'test'
31
+ test.pattern = 'test/**/test_*.rb'
32
+ test.verbose = true
33
+ end
34
+
35
+ desc "Code coverage detail"
36
+ task :simplecov do
37
+ ENV['COVERAGE'] = "true"
38
+ Rake::Task['test'].execute
39
+ end
40
+
41
+ task :default => :test
42
+
43
+ require 'rdoc/task'
44
+ Rake::RDocTask.new do |rdoc|
45
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
46
+
47
+ rdoc.rdoc_dir = 'rdoc'
48
+ rdoc.title = "ebert #{version}"
49
+ rdoc.rdoc_files.include('README*')
50
+ rdoc.rdoc_files.include('lib/**/*.rb')
51
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,63 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+ # stub: ebert 0.1.0 ruby lib
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "ebert"
9
+ s.version = "0.1.0"
10
+
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib"]
13
+ s.authors = ["Charles Kirk", "Patrick Randall"]
14
+ s.date = "2015-09-16"
15
+ s.description = "Inspect any video, describe data field descriptions using mediainfo."
16
+ s.email = "charles@archr.io"
17
+ s.extra_rdoc_files = [
18
+ "LICENSE.txt",
19
+ "README.md"
20
+ ]
21
+ s.files = [
22
+ ".document",
23
+ "Gemfile",
24
+ "Gemfile.lock",
25
+ "LICENSE.txt",
26
+ "README.md",
27
+ "Rakefile",
28
+ "VERSION",
29
+ "ebert.gemspec",
30
+ "lib/ebert.rb",
31
+ "test/helper.rb",
32
+ "test/test_ebert.rb"
33
+ ]
34
+ s.homepage = "http://github.com/ablearcher9/ebert"
35
+ s.licenses = ["MIT"]
36
+ s.rubygems_version = "2.4.1"
37
+ s.summary = "Inspect any video, describe data field descriptions using mediainfo."
38
+
39
+ if s.respond_to? :specification_version then
40
+ s.specification_version = 4
41
+
42
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
43
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
44
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
45
+ s.add_development_dependency(%q<bundler>, ["~> 1.0"])
46
+ s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
47
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
48
+ else
49
+ s.add_dependency(%q<shoulda>, [">= 0"])
50
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
51
+ s.add_dependency(%q<bundler>, ["~> 1.0"])
52
+ s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
53
+ s.add_dependency(%q<simplecov>, [">= 0"])
54
+ end
55
+ else
56
+ s.add_dependency(%q<shoulda>, [">= 0"])
57
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
58
+ s.add_dependency(%q<bundler>, ["~> 1.0"])
59
+ s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
60
+ s.add_dependency(%q<simplecov>, [">= 0"])
61
+ end
62
+ end
63
+
@@ -0,0 +1,58 @@
1
+ require 'shellwords'
2
+
3
+ class Ebert
4
+
5
+ # results = Siskel.inspect(file: 'path/to/myfile.mov', full_response: false)
6
+ # results[:format] # => 'MPEG-4'
7
+ # results[:video][:frame_rate] # => '29.970 fps'
8
+
9
+ class << self
10
+ def inspect(options = {})
11
+ raise ArgumentError, "Must supply either an input file or a pregenerated response" if options[:raw_response].nil? and options[:file].nil?
12
+ raise ArgumentError, "File not found: #{options[:file]}" if options[:file] and !FileTest.exist?(options[:file])
13
+ full_response_command = options[:full_response] ? '-f' : ''
14
+ puts "Executing command 'mediainfo #{Shellwords.escape(options[:file])} #{full_response_command}'"
15
+ parse_results(options[:raw_response] || `mediainfo #{Shellwords.escape(options[:file])} #{full_response_command}`)
16
+ end
17
+
18
+ def parse_results(mediainfo_results)
19
+ mediainfo_results.split("\n").inject({}) do |ebert_results, row|
20
+ result = parse_row(row)
21
+ if result.is_a?(Symbol)
22
+ @prefix = result
23
+ ebert_results[@prefix] ||= {}
24
+ elsif result.is_a?(Hash)
25
+ if @prefix.nil?
26
+ puts "No prefix #{result.keys.first}: #{result.values.first} \n"
27
+ if ebert_results.key?(result.keys.first)
28
+ ebert_results[result.keys.first] << result.values.first
29
+ else
30
+ ebert_results[result.keys.first] = result.values.first
31
+ end
32
+ else
33
+ puts "Prefix #{@prefix} - #{result.keys.first}: #{result.values.first} \n"
34
+ if ebert_results[@prefix].key?(result.keys.first)
35
+ ebert_results[@prefix][result.keys.first].push(result.values.first)
36
+ else
37
+ ebert_results[@prefix][result.keys.first] = result.values.first
38
+ end
39
+ end
40
+ end
41
+ ebert_results
42
+ end
43
+ end
44
+
45
+ def parse_row(row)
46
+ results = /(.*) : (.*)/.match(row)
47
+ if results
48
+ return { make_key(results[1]) => results[2].strip }
49
+ elsif row =~ /\w+/ && row !=~ /General/i
50
+ return row.strip.downcase.to_sym
51
+ end
52
+ end
53
+
54
+ def make_key(str)
55
+ str.strip.gsub(/[\(\)]/, "").gsub(/\W+/, "_").gsub(/_$/, "").downcase.to_sym
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,34 @@
1
+ require 'simplecov'
2
+
3
+ module SimpleCov::Configuration
4
+ def clean_filters
5
+ @filters = []
6
+ end
7
+ end
8
+
9
+ SimpleCov.configure do
10
+ clean_filters
11
+ load_adapter 'test_frameworks'
12
+ end
13
+
14
+ ENV["COVERAGE"] && SimpleCov.start do
15
+ add_filter "/.rvm/"
16
+ end
17
+ require 'rubygems'
18
+ require 'bundler'
19
+ begin
20
+ Bundler.setup(:default, :development)
21
+ rescue Bundler::BundlerError => e
22
+ $stderr.puts e.message
23
+ $stderr.puts "Run `bundle install` to install missing gems"
24
+ exit e.status_code
25
+ end
26
+ require 'test/unit'
27
+ require 'shoulda'
28
+
29
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
30
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
31
+ require 'ebert'
32
+
33
+ class Test::Unit::TestCase
34
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestEbert < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,127 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ebert
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Charles Kirk
8
+ - Patrick Randall
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2015-09-16 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: shoulda
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ! '>='
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ! '>='
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rdoc
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ~>
33
+ - !ruby/object:Gem::Version
34
+ version: '3.12'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ~>
40
+ - !ruby/object:Gem::Version
41
+ version: '3.12'
42
+ - !ruby/object:Gem::Dependency
43
+ name: bundler
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ~>
47
+ - !ruby/object:Gem::Version
48
+ version: '1.0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ~>
54
+ - !ruby/object:Gem::Version
55
+ version: '1.0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: jeweler
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ~>
61
+ - !ruby/object:Gem::Version
62
+ version: 2.0.1
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 2.0.1
70
+ - !ruby/object:Gem::Dependency
71
+ name: simplecov
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ! '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ description: Inspect any video, describe data field descriptions using mediainfo.
85
+ email: charles@archr.io
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files:
89
+ - LICENSE.txt
90
+ - README.md
91
+ files:
92
+ - .document
93
+ - Gemfile
94
+ - Gemfile.lock
95
+ - LICENSE.txt
96
+ - README.md
97
+ - Rakefile
98
+ - VERSION
99
+ - ebert.gemspec
100
+ - lib/ebert.rb
101
+ - test/helper.rb
102
+ - test/test_ebert.rb
103
+ homepage: http://github.com/ablearcher9/ebert
104
+ licenses:
105
+ - MIT
106
+ metadata: {}
107
+ post_install_message:
108
+ rdoc_options: []
109
+ require_paths:
110
+ - lib
111
+ required_ruby_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ! '>='
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ required_rubygems_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ! '>='
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ requirements: []
122
+ rubyforge_project:
123
+ rubygems_version: 2.4.1
124
+ signing_key:
125
+ specification_version: 4
126
+ summary: Inspect any video, describe data field descriptions using mediainfo.
127
+ test_files: []