media_info 0.2.0 → 0.2.1

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
  SHA1:
3
- metadata.gz: 6a27fd9d51e03db397ca6587a2cff5cbf985aa80
4
- data.tar.gz: 20b835fcba806eeaeee8f82230809961edaa9849
3
+ metadata.gz: 1ce99269aae2f45a0d60f0439099d894cb4f9938
4
+ data.tar.gz: 50eb1a77dce5460ad55c5b0320641e75f932fdef
5
5
  SHA512:
6
- metadata.gz: 5234d12da535a1b0fbd850bde23db0bacc7e85ea44788bc0f8a4e7e846a265b23c8a71c08a4f6e133ea9ad44019aaecbd73ca2b1c864bffd3f59a0fce9ee8171
7
- data.tar.gz: 12d3d23d5f6314bb247cf7af6554388f91f08a47bb6ef38ef7db7d550dc422361aa90660b96d0a703fae3877f16af355046754acce053af396ba4971bf0efb77
6
+ metadata.gz: 4ebf7e159f6390a05bede5f09dc130aabdb60332fc2c9151a2a5ce38ddd580242eef9609b31dd1cd1402069ef3575382b866370aa6112d3da5a064071652dfab
7
+ data.tar.gz: 71f179e348a31062d1b02533b7f118ec8e2110eed2156d373f1e2f32d2a5dcbee2d4b2b7bdcd8bdde58bec8c036f0f286c88f442fff75450043736f3fd5d09cb
@@ -1,89 +1,8 @@
1
1
  require 'media_info/parser'
2
+ require 'media_info/base'
2
3
 
3
4
  module MediaInfo
4
- class Base
5
- attr_reader :streams
6
-
7
- def initialize(filename)
8
- check_file(filename)
9
-
10
- @streams = Parser.call(filename)
11
- end
12
-
13
- def streams_types
14
- streams.map do |stream|
15
- stream.class::TYPE
16
- end.uniq
17
- end
18
-
19
- def general?
20
- stream?(:general)
21
- end
22
-
23
- def video?
24
- stream?(:video)
25
- end
26
-
27
- def audio?
28
- stream?(:audio)
29
- end
30
-
31
- def text?
32
- stream?(:text)
33
- end
34
-
35
- def image?
36
- stream?(:image)
37
- end
38
-
39
- def menu?
40
- stream?(:menu)
41
- end
42
-
43
- def other?
44
- stream?(:other)
45
- end
46
-
47
- def general
48
- search_stream(:general)
49
- end
50
-
51
- def video
52
- search_stream(:video)
53
- end
54
-
55
- def audio
56
- search_stream(:audio)
57
- end
58
-
59
- def text
60
- search_stream(:text)
61
- end
62
-
63
- def image
64
- search_stream(:image)
65
- end
66
-
67
- def menu
68
- search_stream(:menu)
69
- end
70
-
71
- def other
72
- search_stream(:other)
73
- end
74
-
75
- private
76
-
77
- def stream?(type)
78
- streams.any? { |stream| stream.class::TYPE == type }
79
- end
80
-
81
- def search_stream(type)
82
- streams.select { |stream| stream.class::TYPE == type }
83
- end
84
-
85
- def check_file(file_path)
86
- raise ArgumentError, "#{file_path} does not exist or is not local file" unless File.exist?(file_path)
87
- end
5
+ def self.parse(file_path)
6
+ Base.new(file_path)
88
7
  end
89
8
  end
@@ -0,0 +1,87 @@
1
+ module MediaInfo
2
+ class Base
3
+ attr_reader :streams
4
+
5
+ def initialize(filename)
6
+ check_file(filename)
7
+
8
+ @streams = Parser.call(filename)
9
+ end
10
+
11
+ def streams_types
12
+ streams.map do |stream|
13
+ stream.class::TYPE
14
+ end.uniq
15
+ end
16
+
17
+ def general?
18
+ stream?(:general)
19
+ end
20
+
21
+ def video?
22
+ stream?(:video)
23
+ end
24
+
25
+ def audio?
26
+ stream?(:audio)
27
+ end
28
+
29
+ def text?
30
+ stream?(:text)
31
+ end
32
+
33
+ def image?
34
+ stream?(:image)
35
+ end
36
+
37
+ def menu?
38
+ stream?(:menu)
39
+ end
40
+
41
+ def other?
42
+ stream?(:other)
43
+ end
44
+
45
+ def general
46
+ search_stream(:general)
47
+ end
48
+
49
+ def video
50
+ search_stream(:video)
51
+ end
52
+
53
+ def audio
54
+ search_stream(:audio)
55
+ end
56
+
57
+ def text
58
+ search_stream(:text)
59
+ end
60
+
61
+ def image
62
+ search_stream(:image)
63
+ end
64
+
65
+ def menu
66
+ search_stream(:menu)
67
+ end
68
+
69
+ def other
70
+ search_stream(:other)
71
+ end
72
+
73
+ private
74
+
75
+ def stream?(type)
76
+ streams.any? { |stream| stream.class::TYPE == type }
77
+ end
78
+
79
+ def search_stream(type)
80
+ streams.select { |stream| stream.class::TYPE == type }
81
+ end
82
+
83
+ def check_file(file_path)
84
+ raise ArgumentError, "#{file_path} does not exist or is not local file" unless File.exist?(file_path)
85
+ end
86
+ end
87
+ end
@@ -2,7 +2,7 @@ module MediaInfo
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- TINY = 0
5
+ TINY = 1
6
6
  PRE = nil
7
7
 
8
8
  NUMBER = [MAJOR, MINOR, TINY, PRE].compact.join('.')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: media_info
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Radovan Smitala
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-30 00:00:00.000000000 Z
11
+ date: 2017-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -101,6 +101,7 @@ extensions: []
101
101
  extra_rdoc_files: []
102
102
  files:
103
103
  - lib/media_info.rb
104
+ - lib/media_info/base.rb
104
105
  - lib/media_info/parser.rb
105
106
  - lib/media_info/stream.rb
106
107
  - lib/media_info/stream_factory.rb
@@ -112,7 +113,7 @@ files:
112
113
  - lib/media_info/streams/text.rb
113
114
  - lib/media_info/streams/video.rb
114
115
  - lib/media_info/version.rb
115
- homepage: http://github.com/radeno/ruby-mediainfo-simple
116
+ homepage: http://github.com/radeno/media_info
116
117
  licenses:
117
118
  - MIT
118
119
  metadata: {}