youpy-scissor-echonest 0.0.3 → 0.0.4
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/README.rdoc +1 -1
- data/Rakefile +1 -1
- data/lib/scissor/echonest.rb +11 -3
- data/lib/scissor/echonest/chunk_ext.rb +11 -0
- data/spec/scissor-echonest_spec.rb +7 -3
- metadata +5 -4
- data/lib/scissor/echonest/meta.rb +0 -32
data/README.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -21,7 +21,7 @@ DESCRIPTION = "Scissor extension to use Echo Nest Developers API"
|
|
21
21
|
RUBYFORGE_PROJECT = "scissorechonest"
|
22
22
|
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
23
23
|
BIN_FILES = %w( )
|
24
|
-
VERS = "0.0.
|
24
|
+
VERS = "0.0.4"
|
25
25
|
|
26
26
|
REV = File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
|
27
27
|
CLEAN.include ['**/.*.sw?', '*.gem', '.config']
|
data/lib/scissor/echonest.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'scissor'
|
2
2
|
require 'echonest'
|
3
|
-
require 'scissor/echonest/
|
3
|
+
require 'scissor/echonest/chunk_ext.rb'
|
4
4
|
|
5
5
|
module Scissor
|
6
6
|
def self.echonest_api_key=(echonest_api_key)
|
@@ -22,9 +22,17 @@ module Scissor
|
|
22
22
|
scissor = to_file(tmpfile)
|
23
23
|
|
24
24
|
beats = echonest.get_beats(tmpfile)
|
25
|
+
|
26
|
+
if beats.size != 0
|
27
|
+
chunk = self[0, beats.first.start]
|
28
|
+
beat = Beat.new(beats.first.start, 1.0)
|
29
|
+
chunk.set_delegate(beat)
|
30
|
+
chunks << chunk
|
31
|
+
end
|
32
|
+
|
25
33
|
beats.inject do |m, beat|
|
26
34
|
chunk = self[m.start, beat.start - m.start]
|
27
|
-
|
35
|
+
chunk.set_delegate(m)
|
28
36
|
chunks << chunk
|
29
37
|
beat
|
30
38
|
end
|
@@ -40,7 +48,7 @@ module Scissor
|
|
40
48
|
segments = echonest.get_segments(tmpfile)
|
41
49
|
segments.inject([]) do |chunks, segment|
|
42
50
|
chunk = self[segment.start, segment.duration]
|
43
|
-
|
51
|
+
chunk.set_delegate(segment)
|
44
52
|
chunks << chunk
|
45
53
|
chunks
|
46
54
|
end
|
@@ -21,11 +21,15 @@ describe Scissor do
|
|
21
21
|
scissor.stub!(:echonest).and_return(api)
|
22
22
|
|
23
23
|
beats = scissor.beats
|
24
|
-
beats.size.should eql(
|
24
|
+
beats.size.should eql(385)
|
25
25
|
beats[0].should be_an_instance_of(Scissor::Chunk)
|
26
|
-
beats[0].duration.should eql(0.
|
26
|
+
beats[0].duration.should eql(0.35812)
|
27
27
|
beats[0].fragments.first.filename.should eql(fixture('sample.mp3'))
|
28
|
-
beats[0].confidence.should eql(0
|
28
|
+
beats[0].confidence.should eql(1.0)
|
29
|
+
beats[1].should be_an_instance_of(Scissor::Chunk)
|
30
|
+
beats[1].duration.should eql(0.47604)
|
31
|
+
beats[1].fragments.first.filename.should eql(fixture('sample.mp3'))
|
32
|
+
beats[1].confidence.should eql(0.296)
|
29
33
|
end
|
30
34
|
|
31
35
|
it 'should get segments' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: youpy-scissor-echonest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- youpy
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-08-31 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -54,10 +54,11 @@ files:
|
|
54
54
|
- spec/spec_helper.rb
|
55
55
|
- lib/scissor
|
56
56
|
- lib/scissor/echonest
|
57
|
-
- lib/scissor/echonest/
|
57
|
+
- lib/scissor/echonest/chunk_ext.rb
|
58
58
|
- lib/scissor/echonest.rb
|
59
59
|
has_rdoc: true
|
60
60
|
homepage: http://scissorechonest.rubyforge.org
|
61
|
+
licenses:
|
61
62
|
post_install_message:
|
62
63
|
rdoc_options:
|
63
64
|
- --title
|
@@ -89,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
90
|
requirements: []
|
90
91
|
|
91
92
|
rubyforge_project: scissorechonest
|
92
|
-
rubygems_version: 1.
|
93
|
+
rubygems_version: 1.3.5
|
93
94
|
signing_key:
|
94
95
|
specification_version: 2
|
95
96
|
summary: Scissor extension to use Echo Nest Developers API
|
@@ -1,32 +0,0 @@
|
|
1
|
-
module Scissor
|
2
|
-
module Echonest
|
3
|
-
module Meta
|
4
|
-
module Beat
|
5
|
-
def self.init(obj, beat)
|
6
|
-
obj.extend self
|
7
|
-
obj.instance_eval {
|
8
|
-
@confidence = beat.confidence
|
9
|
-
@start = beat.start
|
10
|
-
}
|
11
|
-
end
|
12
|
-
|
13
|
-
attr_reader :confidence, :start
|
14
|
-
end
|
15
|
-
|
16
|
-
module Segment
|
17
|
-
def self.init(obj, segment)
|
18
|
-
obj.extend self
|
19
|
-
obj.instance_eval {
|
20
|
-
@start = segment.start
|
21
|
-
@loudness = segment.loudness
|
22
|
-
@max_loudness = segment.max_loudness
|
23
|
-
@pitches = segment.pitches
|
24
|
-
@timbre = segment.timbre
|
25
|
-
}
|
26
|
-
end
|
27
|
-
|
28
|
-
attr_reader :start, :loudness, :max_loudness, :pitches, :timbre
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|