mr_eko 0.5.3 → 0.6.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/README.md +1 -0
- data/lib/mr_eko/song.rb +8 -8
- data/lib/mr_eko.rb +4 -2
- data/mr_eko.gemspec +3 -3
- data/test/song_test.rb +10 -7
- metadata +6 -3
data/README.md
CHANGED
|
@@ -26,6 +26,7 @@ Requirements:
|
|
|
26
26
|
-------------
|
|
27
27
|
* [ffmpeg](http://www.ffmpeg.org/download.html) in your path.
|
|
28
28
|
* an [Echonest API token](http://developer.echonest.com/) which goes here: ~/.mreko/echonest_api.key
|
|
29
|
+
* [Ruby 1.9.3](http://ruby-lang.org) or above
|
|
29
30
|
|
|
30
31
|
TimedPlaylists:
|
|
31
32
|
---------------
|
data/lib/mr_eko/song.rb
CHANGED
|
@@ -109,7 +109,7 @@ class MrEko::Song < Sequel::Model
|
|
|
109
109
|
song.md5 = md5
|
|
110
110
|
song.tempo = analysis.audio_summary.tempo
|
|
111
111
|
song.duration = analysis.audio_summary.duration
|
|
112
|
-
song.key = analysis.audio_summary
|
|
112
|
+
song.key = analysis.audio_summary['key']
|
|
113
113
|
song.mode = analysis.audio_summary.mode
|
|
114
114
|
song.loudness = analysis.audio_summary.loudness
|
|
115
115
|
song.time_signature = analysis.audio_summary.time_signature
|
|
@@ -221,15 +221,15 @@ class MrEko::Song < Sequel::Model
|
|
|
221
221
|
# @param [Array<ID3Lib::Tag>]
|
|
222
222
|
# @return [Array<ID3Lib::Tag>]
|
|
223
223
|
def self.clean_tags(tags)
|
|
224
|
-
ic = Iconv.new("utf-8", "ucs-2")
|
|
225
224
|
|
|
226
|
-
REQUIRED_ID3_TAGS.each do |rt|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
225
|
+
(REQUIRED_ID3_TAGS + [:album]).each do |rt|
|
|
226
|
+
tag = tags.send(rt).to_s
|
|
227
|
+
if tag.encoding != Encoding::UTF_8
|
|
228
|
+
decoded = tag.encode
|
|
229
|
+
else
|
|
230
|
+
decoded = tag
|
|
231
231
|
end
|
|
232
|
-
|
|
232
|
+
|
|
233
233
|
tags.send("#{rt}=", decoded)
|
|
234
234
|
end
|
|
235
235
|
|
data/lib/mr_eko.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
Encoding.default_internal = Encoding::UTF_8
|
|
2
|
+
|
|
1
3
|
require "rubygems"
|
|
2
4
|
require "bundler"
|
|
3
5
|
|
|
@@ -10,7 +12,7 @@ require "digest/md5"
|
|
|
10
12
|
require 'id3lib'
|
|
11
13
|
require "echonest"
|
|
12
14
|
begin
|
|
13
|
-
require '
|
|
15
|
+
require 'debugger'
|
|
14
16
|
rescue LoadError
|
|
15
17
|
end
|
|
16
18
|
|
|
@@ -20,7 +22,7 @@ EKO_ENV = ENV['EKO_ENV'] || 'development'
|
|
|
20
22
|
Sequel.default_timezone = :utc
|
|
21
23
|
|
|
22
24
|
module MrEko
|
|
23
|
-
VERSION = '0.
|
|
25
|
+
VERSION = '0.6.0'
|
|
24
26
|
USER_DIR = File.join(ENV['HOME'], ".mreko")
|
|
25
27
|
FINGERPRINTS_DIR = File.join(USER_DIR, 'fingerprints')
|
|
26
28
|
LOG_DIR = File.join(USER_DIR, 'logs')
|
data/mr_eko.gemspec
CHANGED
|
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
|
|
|
13
13
|
## If your rubyforge_project name is different, then edit it and comment out
|
|
14
14
|
## the sub! line in the Rakefile
|
|
15
15
|
s.name = 'mr_eko'
|
|
16
|
-
s.version = '0.
|
|
17
|
-
s.date = '2013-08-
|
|
16
|
+
s.version = '0.6.0'
|
|
17
|
+
s.date = '2013-08-13'
|
|
18
18
|
s.rubyforge_project = 'mr_eko'
|
|
19
19
|
|
|
20
20
|
## Make sure your summary is short. The description may be as long
|
|
@@ -58,7 +58,7 @@ Gem::Specification.new do |s|
|
|
|
58
58
|
s.add_development_dependency('mocha', "= 0.9.8")
|
|
59
59
|
s.add_development_dependency('shoulda', "~> 2.11")
|
|
60
60
|
s.add_development_dependency('test-unit', "~> 2.1")
|
|
61
|
-
s.add_development_dependency("
|
|
61
|
+
s.add_development_dependency("debugger")
|
|
62
62
|
s.add_development_dependency("autotest")
|
|
63
63
|
s.add_development_dependency("pry")
|
|
64
64
|
s.add_development_dependency("yard")
|
data/test/song_test.rb
CHANGED
|
@@ -104,8 +104,8 @@ class SongTest < Test::Unit::TestCase
|
|
|
104
104
|
|
|
105
105
|
setup do
|
|
106
106
|
@mp3 = MrEko::Song.parse_id3_tags(TAGLESS_MP3)
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
assert_empty @mp3.artist
|
|
108
|
+
assert_empty @mp3.title
|
|
109
109
|
end
|
|
110
110
|
|
|
111
111
|
should 'return nil' do
|
|
@@ -132,10 +132,10 @@ class SongTest < Test::Unit::TestCase
|
|
|
132
132
|
end
|
|
133
133
|
end
|
|
134
134
|
|
|
135
|
-
context 'cleaning
|
|
135
|
+
context 'cleaning encoded ID3 tags' do
|
|
136
136
|
|
|
137
|
-
should "decode iTunes'
|
|
138
|
-
dm =
|
|
137
|
+
should "decode iTunes' encoded tags" do
|
|
138
|
+
dm = 'Dead Meadow'.encode(Encoding::UCS_2BE, Encoding::UTF_8)
|
|
139
139
|
tag_stub = OpenStruct.new(:artist => dm, :title => 'Good Moaning')
|
|
140
140
|
ID3Lib::Tag.expects(:new).once.returns(tag_stub)
|
|
141
141
|
parsed_tags = MrEko::Song.parse_id3_tags(TEST_MP3)
|
|
@@ -143,11 +143,14 @@ class SongTest < Test::Unit::TestCase
|
|
|
143
143
|
assert_equal "Dead Meadow", parsed_tags.artist
|
|
144
144
|
end
|
|
145
145
|
|
|
146
|
-
should "not
|
|
146
|
+
should "not alter the tags when they aren't encoded" do
|
|
147
147
|
tag_stub = OpenStruct.new(:artist => 'Dead Meadow', :title => 'Good Moaning')
|
|
148
148
|
ID3Lib::Tag.expects(:new).once.returns(tag_stub)
|
|
149
149
|
|
|
150
|
-
|
|
150
|
+
parsed = MrEko::Song.parse_id3_tags(TEST_MP3)
|
|
151
|
+
|
|
152
|
+
assert_equal parsed.artist, 'Dead Meadow'
|
|
153
|
+
assert_equal parsed.title, 'Good Moaning'
|
|
151
154
|
end
|
|
152
155
|
end
|
|
153
156
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mr_eko
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-08-
|
|
12
|
+
date: 2013-08-13 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: sequel
|
|
@@ -172,7 +172,7 @@ dependencies:
|
|
|
172
172
|
- !ruby/object:Gem::Version
|
|
173
173
|
version: '2.1'
|
|
174
174
|
- !ruby/object:Gem::Dependency
|
|
175
|
-
name:
|
|
175
|
+
name: debugger
|
|
176
176
|
requirement: !ruby/object:Gem::Requirement
|
|
177
177
|
none: false
|
|
178
178
|
requirements:
|
|
@@ -298,6 +298,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
298
298
|
- - ! '>='
|
|
299
299
|
- !ruby/object:Gem::Version
|
|
300
300
|
version: '0'
|
|
301
|
+
segments:
|
|
302
|
+
- 0
|
|
303
|
+
hash: 2527726127632796201
|
|
301
304
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
302
305
|
none: false
|
|
303
306
|
requirements:
|