mediainfo 1.3.0 → 1.5.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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +33 -11
- data/{.travis.yml → disabled.travis.yml} +0 -0
- data/lib/mediainfo.rb +4 -3
- data/lib/mediainfo/tracks.rb +2 -2
- data/lib/mediainfo/version.rb +2 -2
- data/mediainfo.gemspec +0 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 065c7f90befa0eb7259e1a804f906436c9eeea316b456cb15acb96ffb853eb73
|
4
|
+
data.tar.gz: d78a88f13eec40a22e62a63889fdf1221d72a77980d9a517616e93514030a259
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e384cc2ec918b16e0ee7acf7605be9fb685b1fcc6aa9105bcceef06c863ca2e192959a43e14f78d21492c77052e14adb7b6d2e77c8fbfb8439096506d8273f47
|
7
|
+
data.tar.gz: e29af6e586f2677c11005b0e89fba717446f598969e9c372053dd6c0197aa8095c979a670a2e496b0c9950889341208c941811a7c90bb265bbc74e47dc7fb7a5
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -8,7 +8,7 @@ MediaInfo is a class wrapping [the mediainfo CLI](http://mediainfo.sourceforge.n
|
|
8
8
|
|
9
9
|
## Usage
|
10
10
|
|
11
|
-
- Versions > 1.3.0 support S3 URLs. See rspec test for example
|
11
|
+
- Versions > 1.3.0 support S3 URLs. See rspec test for example.
|
12
12
|
|
13
13
|
#### Parsing raw XML
|
14
14
|
media_info = MediaInfo.from(File.open('iphone6+_video.mov.xml').read)
|
@@ -60,8 +60,18 @@ Sometimes you'll have more than one track of a given type:
|
|
60
60
|
- Any track attribute name with "date" and matching /\d-/ will be converted using Time.parse:
|
61
61
|
|
62
62
|
|
63
|
-
media_info.video.encoded_date => 2018-03-30 12:12:08
|
64
|
-
media_info.video.customdate => 2016-02-10 01:00:00
|
63
|
+
media_info.video.encoded_date => 2018-03-30 12:12:08 UTC
|
64
|
+
media_info.video.customdate => 2016-02-10 01:00:00 UTC
|
65
|
+
|
66
|
+
> 🕑 **A note on time zones:**
|
67
|
+
> Whenever possible, mediainfo provides timestamps in UTC.
|
68
|
+
> To convert UTC timestamps to your system time zone, use `#getlocal`:
|
69
|
+
>
|
70
|
+
> media_info.video.encoded_date.getlocal => 2018-03-30 05:12:08 -0700
|
71
|
+
>
|
72
|
+
> If a `*date` attribute is already in your local time zone,
|
73
|
+
> that means no time zone data was found,
|
74
|
+
> and the given time zone may not be correct.
|
65
75
|
|
66
76
|
- .duration and .overall_duration will be returned as milliseconds AS LONG AS the Duration and Overall_Duration match one of the expected units (each separated by a space or not):
|
67
77
|
- h (\<Duration>15h\</Duration>) (hour)
|
@@ -127,18 +137,30 @@ a variety of information about a file. Some attributes may be present
|
|
127
137
|
for some files where others are not, but any supported attribute
|
128
138
|
should at least return `nil`.
|
129
139
|
|
140
|
+
|
141
|
+
## Development
|
142
|
+
|
143
|
+
```shell
|
144
|
+
bundle install
|
145
|
+
irb -I ./lib -r mediainfo
|
146
|
+
irb(main):002:0> ::MediaInfo.location
|
147
|
+
=> "/usr/local/bin/mediainfo"
|
148
|
+
```
|
149
|
+
|
150
|
+
### Testing
|
151
|
+
|
152
|
+
```shell
|
153
|
+
bundle exec rspec
|
154
|
+
```
|
155
|
+
|
130
156
|
## Requirements
|
131
157
|
|
132
158
|
* Gem version 1.0.0 has been tested on v18.03.1
|
133
159
|
* Gem versions < 1.0.0 require at least: MediaInfoLib v0.7.25
|
134
160
|
* Gem versions <= 0.5.1 worked against MediaInfoLib v0.7.11, which did not generate XML output, and is no longer supported.
|
135
161
|
|
136
|
-
##
|
162
|
+
## TODO
|
137
163
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
* Ned Campion - [http://github.com/nedcampion](http://github.com/nedcampion)
|
142
|
-
* Daniel Jagszent - [http://github.com/d--j](http://github.com/d--j)
|
143
|
-
* Robert Mrasek - [http://github.com/derobo](http://github.com/derobo)
|
144
|
-
* Nathan Pierce - [http://github.com/NorseGaud](http://github.com/NorseGaud)
|
164
|
+
- Use github actions to test
|
165
|
+
- Replace URI.escape cause it's EOL
|
166
|
+
- Mocks/Stubs for AWS code? Maybe just disable the tests instead and only test when changing the code?
|
File without changes
|
data/lib/mediainfo.rb
CHANGED
@@ -3,6 +3,7 @@ require 'net/http'
|
|
3
3
|
require 'mediainfo/errors'
|
4
4
|
require 'mediainfo/tracks'
|
5
5
|
require 'mediainfo/string'
|
6
|
+
require 'open3'
|
6
7
|
|
7
8
|
module MediaInfo
|
8
9
|
|
@@ -25,7 +26,7 @@ module MediaInfo
|
|
25
26
|
mediainfo_location = ENV['MEDIAINFO_PATH']
|
26
27
|
raise EnvironmentError, "MediaInfo path you provided cannot be found. Please check your mediainfo installation location..." unless ::File.exist? mediainfo_location
|
27
28
|
end
|
28
|
-
raise EnvironmentError, "MediaInfo binary cannot be found. Are you sure mediainfo is installed?" if
|
29
|
+
raise EnvironmentError, "MediaInfo binary cannot be found. Are you sure mediainfo is installed?" if mediainfo_location.nil? || mediainfo_location.empty?
|
29
30
|
return mediainfo_location
|
30
31
|
end
|
31
32
|
|
@@ -88,9 +89,9 @@ module MediaInfo
|
|
88
89
|
|
89
90
|
def self.run(input = nil)
|
90
91
|
raise ArgumentError, 'Your input cannot be blank.' if input.nil?
|
91
|
-
command = "#{location}
|
92
|
+
command = "#{location} \"#{input}\" --Output=XML"
|
92
93
|
raw_response, errors, status = Open3.capture3(command)
|
93
|
-
unless
|
94
|
+
unless status.exitstatus == 0
|
94
95
|
raise ExecutionError, "Execution of '#{command}' failed: \n #{errors.red}"
|
95
96
|
end
|
96
97
|
return raw_response
|
data/lib/mediainfo/tracks.rb
CHANGED
@@ -109,14 +109,14 @@ module MediaInfo
|
|
109
109
|
return value.to_f
|
110
110
|
elsif name.downcase.include?('date') && !value.match(/\d-/).nil?
|
111
111
|
# Dates
|
112
|
-
return Time.parse(value)
|
112
|
+
return Time.parse(value.sub(/^UTC\s+(.*)$/, '\1 UTC'))
|
113
113
|
end
|
114
114
|
|
115
115
|
value
|
116
116
|
end
|
117
117
|
|
118
118
|
def self.standardize_to_milliseconds(value)
|
119
|
-
return standardize_float_to_milliseconds(value.to_f) if value
|
119
|
+
return standardize_float_to_milliseconds(value.to_f) if value =~ /^\d+\.?\d*$/
|
120
120
|
return standardize_string_to_milliseconds(value)
|
121
121
|
value
|
122
122
|
end
|
data/lib/mediainfo/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module MediaInfo
|
2
|
-
VERSION = '1.
|
3
|
-
end
|
2
|
+
VERSION = '1.5.0'
|
3
|
+
end
|
data/mediainfo.gemspec
CHANGED
@@ -14,7 +14,6 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.homepage = %q{https://github.com/greatseth/mediainfo}
|
15
15
|
s.rdoc_options = ['--line-numbers', '--inline-source', '--title', 'Mediainfo', '--main']
|
16
16
|
s.require_paths = ['lib']
|
17
|
-
s.rubyforge_project = %q{mediainfo}
|
18
17
|
s.summary = %q{MediaInfo is a class wrapping the mediainfo CLI (http://mediainfo.sourceforge.net)}
|
19
18
|
s.files = `git ls-files -z`.split("\x0").reject do |f|
|
20
19
|
f.match(%r{^(test|spec|features)/})
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mediainfo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seth Thomas Rasmussen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -110,12 +110,12 @@ extra_rdoc_files: []
|
|
110
110
|
files:
|
111
111
|
- ".gitignore"
|
112
112
|
- ".rspec"
|
113
|
-
- ".travis.yml"
|
114
113
|
- Changelog
|
115
114
|
- Gemfile
|
116
115
|
- LICENSE
|
117
116
|
- README.md
|
118
117
|
- Rakefile
|
118
|
+
- disabled.travis.yml
|
119
119
|
- lib/attribute_standardization_rules.yml
|
120
120
|
- lib/mediainfo.rb
|
121
121
|
- lib/mediainfo/errors.rb
|
@@ -147,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
147
|
- !ruby/object:Gem::Version
|
148
148
|
version: '1.2'
|
149
149
|
requirements: []
|
150
|
-
rubygems_version: 3.
|
150
|
+
rubygems_version: 3.1.4
|
151
151
|
signing_key:
|
152
152
|
specification_version: 3
|
153
153
|
summary: MediaInfo is a class wrapping the mediainfo CLI (http://mediainfo.sourceforge.net)
|