dragonfly_audio 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6a170d383f614e2e631182e1f7b46e83c99ae0d6
4
+ data.tar.gz: c7ef98a7e4fb7de069928e98a0f87f22da054322
5
+ SHA512:
6
+ metadata.gz: e6ddcbf3f71a510e4ac002ce582a93f477eb5ab5e3cc28b2ab6bf86b457c5360b75d3863c984cc9997985749dd45d5e445db6be7d132fab5f434d8a940516a95
7
+ data.tar.gz: c822ee6493eab379b2634d52769f3937764e78b7f66163fc705bc3956246e89d00e6d87a152cc1d01e167988040b353f2da92c96a5ce25898e4d757c8ebe1039
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ .DS_Store
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in dragonfly_audio.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,70 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ dragonfly_audio (0.0.1)
5
+ dragonfly (~> 1.0)
6
+ taglib-ruby
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ addressable (2.3.8)
12
+ coderay (1.1.0)
13
+ dragonfly (1.0.12)
14
+ addressable (~> 2.3)
15
+ multi_json (~> 1.0)
16
+ rack (>= 1.3.0)
17
+ ffi (1.9.10)
18
+ formatador (0.2.5)
19
+ guard (2.13.0)
20
+ formatador (>= 0.2.4)
21
+ listen (>= 2.7, <= 4.0)
22
+ lumberjack (~> 1.0)
23
+ nenv (~> 0.1)
24
+ notiffany (~> 0.0)
25
+ pry (>= 0.9.12)
26
+ shellany (~> 0.0)
27
+ thor (>= 0.18.1)
28
+ guard-compat (1.2.1)
29
+ guard-minitest (2.4.4)
30
+ guard-compat (~> 1.2)
31
+ minitest (>= 3.0)
32
+ listen (3.0.3)
33
+ rb-fsevent (>= 0.9.3)
34
+ rb-inotify (>= 0.9)
35
+ lumberjack (1.0.9)
36
+ method_source (0.8.2)
37
+ mini_portile (0.6.2)
38
+ minitest (5.8.1)
39
+ multi_json (1.11.2)
40
+ nenv (0.2.0)
41
+ nokogiri (1.6.6.2)
42
+ mini_portile (~> 0.6.0)
43
+ notiffany (0.0.8)
44
+ nenv (~> 0.1)
45
+ shellany (~> 0.0)
46
+ pry (0.10.2)
47
+ coderay (~> 1.1.0)
48
+ method_source (~> 0.8.1)
49
+ slop (~> 3.4)
50
+ rack (1.6.4)
51
+ rake (10.4.2)
52
+ rb-fsevent (0.9.6)
53
+ rb-inotify (0.9.5)
54
+ ffi (>= 0.5.0)
55
+ shellany (0.0.1)
56
+ slop (3.6.0)
57
+ taglib-ruby (0.7.0)
58
+ thor (0.19.1)
59
+
60
+ PLATFORMS
61
+ ruby
62
+
63
+ DEPENDENCIES
64
+ bundler (~> 1.6)
65
+ dragonfly_audio!
66
+ guard
67
+ guard-minitest
68
+ minitest
69
+ nokogiri
70
+ rake
data/Guardfile ADDED
@@ -0,0 +1,8 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard :minitest do
5
+ watch(%r{^lib/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
6
+ watch(%r{^test/.+_test\.rb$})
7
+ watch(%r{^test/test_helper\.rb$}) { 'test' }
8
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Tomas Celizna
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,41 @@
1
+ # Dragonfly Audio
2
+
3
+ Wraps common audio-related tasks into [Dragonfly](http://markevans.github.io/dragonfly) analysers and processors.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'dragonfly_audio'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install dragonfly_audio
18
+
19
+ ## Dependencies
20
+
21
+ ## Usage
22
+
23
+ Add the `:audio` plugin to your Dragonfly config block:
24
+
25
+ ```ruby
26
+ Dragonfly.app.configure do
27
+ plugin :audio
28
+ end
29
+ ```
30
+
31
+ ## Analysers
32
+
33
+ ## Processors
34
+
35
+ ## Contributing
36
+
37
+ 1. Fork it ( https://github.com/tomasc/dragonfly_audio/fork )
38
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
39
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
40
+ 4. Push to the branch (`git push origin my-new-feature`)
41
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.libs << 'test'
6
+ t.pattern = 'test/**/*_test.rb'
7
+ end
8
+
9
+ task :default => :test
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'dragonfly_audio/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "dragonfly_audio"
8
+ spec.version = DragonflyAudio::VERSION
9
+ spec.authors = ["Tomas Celizna", "Asger Behncke Jacobsen"]
10
+ spec.email = ["tomas.celizna@gmail.com", "asger@8kilo.com"]
11
+ spec.summary = %q{Wraps common audio-related tasks into Dragonfly analysers and processors.}
12
+ spec.homepage = "https://github.com/tomasc/dragonfly_audio"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency "dragonfly", "~> 1.0"
21
+ spec.add_dependency "taglib-ruby"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.6"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "nokogiri"
26
+ spec.add_development_dependency "guard"
27
+ spec.add_development_dependency "guard-minitest"
28
+ spec.add_development_dependency "minitest"
29
+ end
@@ -0,0 +1,46 @@
1
+ require 'taglib'
2
+
3
+ # IMPORTANT: See http://robinst.github.io/taglib-ruby/
4
+
5
+ module DragonflyAudio
6
+ module Analysers
7
+ class AudioProperties
8
+
9
+ def call content
10
+ taglib_fileref(content)
11
+ end
12
+
13
+ private # =============================================================
14
+
15
+ def taglib_fileref temp_object
16
+ res = {}
17
+ TagLib::FileRef.open(temp_object.path) do |fileref|
18
+ unless fileref.null?
19
+
20
+ # TODO: simplify me!
21
+ tag = fileref.tag
22
+ res.merge! title: tag.title
23
+ res.merge! artist: tag.artist
24
+ res.merge! album: tag.album
25
+ res.merge! year: tag.year
26
+ res.merge! tag: tag.year
27
+ res.merge! track: tag.track
28
+ res.merge! genre: tag.genre
29
+ res.merge! comment: tag.comment
30
+
31
+ prop = fileref.audio_properties
32
+ res.merge! length: prop.length
33
+ res.merge! bitrate: prop.bitrate
34
+ res.merge! channels: prop.channels
35
+ res.merge! sample_rate: prop.sample_rate
36
+
37
+ # prop.merge! %w(title artist album year track genre comment).inject({}) { |res, att| { att => fileref.tag.send(att) } }
38
+ # prop.merge! length: fileref.audio_properties.length
39
+ end
40
+ end
41
+ res
42
+ end
43
+
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,57 @@
1
+ require 'dragonfly_audio/analysers/audio_properties'
2
+
3
+ module DragonflyAudio
4
+ class Plugin
5
+
6
+ def call app, opts={}
7
+ app.add_analyser :audio_properties, DragonflyAudio::Analysers::AudioProperties.new
8
+
9
+ app.add_analyser :title do |content|
10
+ content.analyse(:audio_properties)[:title]
11
+ end
12
+
13
+ app.add_analyser :artist do |content|
14
+ content.analyse(:audio_properties)[:artist]
15
+ end
16
+
17
+ app.add_analyser :album do |content|
18
+ content.analyse(:audio_properties)[:album]
19
+ end
20
+
21
+ app.add_analyser :year do |content|
22
+ content.analyse(:audio_properties)[:year]
23
+ end
24
+
25
+ app.add_analyser :track do |content|
26
+ content.analyse(:audio_properties)[:track]
27
+ end
28
+
29
+ app.add_analyser :genre do |content|
30
+ content.analyse(:audio_properties)[:genre]
31
+ end
32
+
33
+ app.add_analyser :comment do |content|
34
+ content.analyse(:audio_properties)[:comment]
35
+ end
36
+
37
+ app.add_analyser :length do |content|
38
+ content.analyse(:audio_properties)[:length]
39
+ end
40
+
41
+ app.add_analyser :bitrate do |content|
42
+ content.analyse(:audio_properties)[:bitrate]
43
+ end
44
+
45
+ app.add_analyser :channels do |content|
46
+ content.analyse(:audio_properties)[:channels]
47
+ end
48
+
49
+ app.add_analyser :sample_rate do |content|
50
+ content.analyse(:audio_properties)[:sample_rate]
51
+ end
52
+ end
53
+
54
+ end
55
+ end
56
+
57
+ Dragonfly::App.register_plugin(:audio) { DragonflyAudio::Plugin.new }
@@ -0,0 +1,3 @@
1
+ module DragonflyAudio
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,7 @@
1
+ require 'dragonfly'
2
+ require 'dragonfly_audio/plugin'
3
+ require 'dragonfly_audio/version'
4
+
5
+ Dragonfly.app.configure do
6
+ plugin :audio
7
+ end
Binary file
@@ -0,0 +1,18 @@
1
+ require 'test_helper'
2
+
3
+ module DragonflyAudio
4
+ describe Plugin do
5
+
6
+ let(:app) { test_app.configure_with(:audio) }
7
+ let(:audio) { app.fetch_file(SAMPLES_DIR.join('BroadmoorSirenTest.mp3')) }
8
+
9
+ # ---------------------------------------------------------------------
10
+
11
+ describe 'analysers' do
12
+ it 'adds #audio_properties' do
13
+ audio.must_respond_to :audio_properties
14
+ end
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,21 @@
1
+ require 'bundler/setup'
2
+
3
+ require 'minitest'
4
+ require 'minitest/autorun'
5
+ require 'minitest/spec'
6
+
7
+ require 'dragonfly'
8
+ require 'dragonfly_audio'
9
+
10
+ # ---------------------------------------------------------------------
11
+
12
+ SAMPLES_DIR = Pathname.new(File.expand_path('../../samples', __FILE__))
13
+
14
+ # ---------------------------------------------------------------------
15
+
16
+ def test_app name=nil
17
+ app = Dragonfly::App.instance(name)
18
+ app.datastore = Dragonfly::MemoryDataStore.new
19
+ app.secret = "test secret"
20
+ app
21
+ end
metadata ADDED
@@ -0,0 +1,175 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dragonfly_audio
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Tomas Celizna
8
+ - Asger Behncke Jacobsen
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2015-10-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: dragonfly
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '1.0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '1.0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: taglib-ruby
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
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.6'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '1.6'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rake
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: nokogiri
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
+ - !ruby/object:Gem::Dependency
85
+ name: guard
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: guard-minitest
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: minitest
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ description:
127
+ email:
128
+ - tomas.celizna@gmail.com
129
+ - asger@8kilo.com
130
+ executables: []
131
+ extensions: []
132
+ extra_rdoc_files: []
133
+ files:
134
+ - ".gitignore"
135
+ - Gemfile
136
+ - Gemfile.lock
137
+ - Guardfile
138
+ - LICENSE.txt
139
+ - README.md
140
+ - Rakefile
141
+ - dragonfly_audio.gemspec
142
+ - lib/dragonfly_audio.rb
143
+ - lib/dragonfly_audio/analysers/audio_properties.rb
144
+ - lib/dragonfly_audio/plugin.rb
145
+ - lib/dragonfly_audio/version.rb
146
+ - samples/BroadmoorSirenTest.mp3
147
+ - test/dragonfly_audio/plugin_test.rb
148
+ - test/test_helper.rb
149
+ homepage: https://github.com/tomasc/dragonfly_audio
150
+ licenses:
151
+ - MIT
152
+ metadata: {}
153
+ post_install_message:
154
+ rdoc_options: []
155
+ require_paths:
156
+ - lib
157
+ required_ruby_version: !ruby/object:Gem::Requirement
158
+ requirements:
159
+ - - ">="
160
+ - !ruby/object:Gem::Version
161
+ version: '0'
162
+ required_rubygems_version: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ requirements: []
168
+ rubyforge_project:
169
+ rubygems_version: 2.4.8
170
+ signing_key:
171
+ specification_version: 4
172
+ summary: Wraps common audio-related tasks into Dragonfly analysers and processors.
173
+ test_files:
174
+ - test/dragonfly_audio/plugin_test.rb
175
+ - test/test_helper.rb