scissor-echonest 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/scissor/echonest.rb +5 -5
- data/spec/scissor-echonest_spec.rb +12 -2
- metadata +2 -2
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://github.com/youpy/scissor-echonest"
|
23
23
|
BIN_FILES = %w( )
|
24
|
-
VERS = "0.0.
|
24
|
+
VERS = "0.0.7"
|
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
@@ -10,10 +10,10 @@ module Scissor
|
|
10
10
|
class Chunk
|
11
11
|
class << self
|
12
12
|
attr_accessor :echonest_api_key
|
13
|
-
end
|
14
13
|
|
15
|
-
|
16
|
-
|
14
|
+
def echonest
|
15
|
+
@echonest ||= Echonest(echonest_api_key)
|
16
|
+
end
|
17
17
|
end
|
18
18
|
|
19
19
|
def beats
|
@@ -21,7 +21,7 @@ module Scissor
|
|
21
21
|
chunks = []
|
22
22
|
scissor = to_file(tmpfile, :bitrate => '64k')
|
23
23
|
|
24
|
-
beats = echonest.get_beats(tmpfile)
|
24
|
+
beats = self.class.echonest.get_beats(tmpfile)
|
25
25
|
|
26
26
|
if beats.size != 0
|
27
27
|
chunk = self[0, beats.first.start]
|
@@ -45,7 +45,7 @@ module Scissor
|
|
45
45
|
tempfile_for_echonest do |tmpfile|
|
46
46
|
scissor = to_file(tmpfile, :bitrate => '64k')
|
47
47
|
|
48
|
-
segments = echonest.get_segments(tmpfile)
|
48
|
+
segments = self.class.echonest.get_segments(tmpfile)
|
49
49
|
segments.inject([]) do |chunks, segment|
|
50
50
|
chunk = self[segment.start, segment.duration]
|
51
51
|
chunk.set_delegate(segment)
|
@@ -11,6 +11,16 @@ describe Scissor do
|
|
11
11
|
Scissor::Chunk.echonest_api_key.should eql('XXX')
|
12
12
|
end
|
13
13
|
|
14
|
+
it 'should get an instance of EchoNest::Api' do
|
15
|
+
Scissor.echonest_api_key = 'XXX'
|
16
|
+
|
17
|
+
echonest = Scissor::Chunk.echonest
|
18
|
+
echonest.user_agent.send_timeout = 300
|
19
|
+
|
20
|
+
echonest.should be_an_instance_of(Echonest::Api)
|
21
|
+
Scissor::Chunk.echonest.user_agent.send_timeout.should eql(300)
|
22
|
+
end
|
23
|
+
|
14
24
|
it 'should get beats' do
|
15
25
|
Scissor.echonest_api_key = 'XXX'
|
16
26
|
|
@@ -18,7 +28,7 @@ describe Scissor do
|
|
18
28
|
api.user_agent.stub!(:get_content).and_return(open(fixture('get_beats.xml')).read)
|
19
29
|
|
20
30
|
scissor = Scissor(fixture('sample.mp3'))
|
21
|
-
|
31
|
+
Scissor::Chunk.stub!(:echonest).and_return(api)
|
22
32
|
|
23
33
|
beats = scissor.beats
|
24
34
|
beats.size.should eql(385)
|
@@ -39,7 +49,7 @@ describe Scissor do
|
|
39
49
|
api.user_agent.stub!(:get_content).and_return(open(fixture('get_segments.xml')).read)
|
40
50
|
|
41
51
|
scissor = Scissor(fixture('sample.mp3'))
|
42
|
-
|
52
|
+
Scissor::Chunk.stub!(:echonest).and_return(api)
|
43
53
|
|
44
54
|
segments = scissor.segments
|
45
55
|
segments.size.should eql(830)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scissor-echonest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
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:
|
12
|
+
date: 2010-01-08 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|