seamus 0.3.3 → 0.4.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.
- data/lib/seamus/file/application.rb +5 -0
- data/lib/seamus/file/audio.rb +6 -1
- data/lib/seamus/file/image.rb +5 -0
- data/lib/seamus/file/text.rb +5 -0
- data/lib/seamus/file/video.rb +6 -1
- data/lib/seamus/standard_additions.rb +22 -1
- data/seamus.gemspec +1 -1
- metadata +5 -10
data/lib/seamus/file/audio.rb
CHANGED
@@ -6,8 +6,13 @@ module Seamus
|
|
6
6
|
include Seamus::StandardAdditions
|
7
7
|
def initialize(*args, &block)
|
8
8
|
super(*args, &block)
|
9
|
-
create_methods_for inspector, :except =>
|
9
|
+
create_methods_for inspector, :except => [:filename, :path, :full_filename, :raw_response, :raw_metadata, :ffmpeg_binary, :ffmpeg_binary=]
|
10
10
|
end
|
11
|
+
|
12
|
+
def inspection_attributes
|
13
|
+
@inspection_attributes ||= [:valid?, :invalid?, :unknown_format?, :unreadable_file?, :audio?, :video?, :container, :raw_duration, :duration, :bitrate, :bitrate_units, :audio_bit_rate, :audio_stream, :audio_codec, :audio_sample_rate, :audio_sample_units, :audio_channels_string, :audio_channels, :audio_stream_id, :video_stream, :video_stream_id, :video_codec, :video_colorspace, :width, :height, :resolution, :fps] + standard_attributes
|
14
|
+
end
|
15
|
+
|
11
16
|
end
|
12
17
|
end
|
13
18
|
end
|
data/lib/seamus/file/image.rb
CHANGED
data/lib/seamus/file/text.rb
CHANGED
data/lib/seamus/file/video.rb
CHANGED
@@ -6,8 +6,13 @@ module Seamus
|
|
6
6
|
include Seamus::StandardAdditions
|
7
7
|
def initialize(*args, &block)
|
8
8
|
super(*args, &block)
|
9
|
-
create_methods_for inspector, :except =>
|
9
|
+
create_methods_for inspector, :except => [:filename, :path, :full_filename, :raw_response, :raw_metadata, :ffmpeg_binary, :ffmpeg_binary=]
|
10
10
|
end
|
11
|
+
|
12
|
+
def inspection_attributes
|
13
|
+
@inspection_attributes ||= [:valid?, :invalid?, :unknown_format?, :unreadable_file?, :audio?, :video?, :container, :raw_duration, :duration, :bitrate, :bitrate_units, :audio_bit_rate, :audio_stream, :audio_codec, :audio_sample_rate, :audio_sample_units, :audio_channels_string, :audio_channels, :audio_stream_id, :video_stream, :video_stream_id, :video_codec, :video_colorspace, :width, :height, :resolution, :fps] + standard_attributes
|
14
|
+
end
|
15
|
+
|
11
16
|
end
|
12
17
|
end
|
13
18
|
end
|
@@ -22,6 +22,23 @@ module Seamus
|
|
22
22
|
MimeTable.lookup_by_extension(extension).to_s
|
23
23
|
end
|
24
24
|
|
25
|
+
def add_inspection_attributes(*args)
|
26
|
+
args.select{|arg| arg.respond_to?(:to_sym) }.each do |arg|
|
27
|
+
inspection_attributes.push arg
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def [](attribute)
|
32
|
+
attributes[attribute.to_sym]
|
33
|
+
end
|
34
|
+
|
35
|
+
def attributes
|
36
|
+
@attributes ||= inspection_attributes.inject({}) do |h, i|
|
37
|
+
h[i] = self.send(i) if self.respond_to?(i)
|
38
|
+
h
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
25
42
|
private
|
26
43
|
|
27
44
|
def create_method(method, method_binding)
|
@@ -29,11 +46,15 @@ module Seamus
|
|
29
46
|
end
|
30
47
|
|
31
48
|
def create_methods_for(object, options={})
|
32
|
-
options[:except] = options[:except]
|
49
|
+
options[:except] = [options[:except]] unless options[:except].is_a?(Array)
|
33
50
|
object.public_methods(false).each do |method|
|
34
51
|
create_method(method, lambda {object.method(method.to_s).call}) unless options[:except].include?(method)
|
35
52
|
end
|
36
53
|
end
|
54
|
+
|
55
|
+
def standard_attributes
|
56
|
+
[:size, :md5]
|
57
|
+
end
|
37
58
|
|
38
59
|
# def method_missing(method, *args, &block)
|
39
60
|
# if file_attributes.has_key?(method.to_s)
|
data/seamus.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seamus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
4
|
+
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
7
|
+
- 4
|
8
|
+
- 0
|
9
|
+
version: 0.4.0
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Scott Burton
|
@@ -26,7 +25,6 @@ dependencies:
|
|
26
25
|
requirements:
|
27
26
|
- - ">="
|
28
27
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 3
|
30
28
|
segments:
|
31
29
|
- 0
|
32
30
|
version: "0"
|
@@ -40,7 +38,6 @@ dependencies:
|
|
40
38
|
requirements:
|
41
39
|
- - ">="
|
42
40
|
- !ruby/object:Gem::Version
|
43
|
-
hash: 3
|
44
41
|
segments:
|
45
42
|
- 0
|
46
43
|
version: "0"
|
@@ -111,7 +108,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
111
108
|
requirements:
|
112
109
|
- - ">="
|
113
110
|
- !ruby/object:Gem::Version
|
114
|
-
hash: 3
|
115
111
|
segments:
|
116
112
|
- 0
|
117
113
|
version: "0"
|
@@ -120,14 +116,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
116
|
requirements:
|
121
117
|
- - ">="
|
122
118
|
- !ruby/object:Gem::Version
|
123
|
-
hash: 3
|
124
119
|
segments:
|
125
120
|
- 0
|
126
121
|
version: "0"
|
127
122
|
requirements: []
|
128
123
|
|
129
124
|
rubyforge_project:
|
130
|
-
rubygems_version: 1.
|
125
|
+
rubygems_version: 1.3.7
|
131
126
|
signing_key:
|
132
127
|
specification_version: 3
|
133
128
|
summary: Seamus is not an Irish monk
|