Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

adding ogg, updating manifest, rdoc

  • Loading branch information...
commit 61bccb980863a0a39cb23d1e38b890b30dd0d98b 1 parent 9e633ce
@tenderlove tenderlove authored
View
2  .gitignore
@@ -1 +1,3 @@
.*.swp
+doc
+pkg
View
2  History.txt
@@ -1,4 +1,4 @@
-=== 1.0.0 / 2008-08-01
+=== 0.0.1 / 2008-08-01
* 1 major enhancement
View
7 Manifest.txt
@@ -4,4 +4,9 @@ README.txt
Rakefile
bin/earworm
lib/earworm.rb
-test/test_earworm.rb
+lib/earworm/client.rb
+lib/earworm/fingerprint.rb
+lib/earworm/puid.rb
+lib/earworm/track.rb
+lib/earworm_lib.rb
+test/test_earworm.rb
View
32 README.txt
@@ -1,32 +1,50 @@
= earworm
-* FIX (url)
+* http://earworm.rubyforge.org
== DESCRIPTION:
-FIX (describe your package)
+Earworm can identify unknown music using MusicDNS and libofa.
== FEATURES/PROBLEMS:
-* FIX (list of features or problems)
+* Identifies mp3, ogg, and wav files.
== SYNOPSIS:
- FIX (code sample of usage)
+Identify an unknown audio file:
+
+ ew = Earworm::Client.new('MY Music DNS Key')
+ info = ew.identify(:file => '/home/aaron/unknown.wav')
+ puts "#{info.artist_name} - #{info.title}"
+
+Fetch info for a PUID:
+
+ ew = Earworm::Client.new('MY Music DNS Key')
+ info = ew.identify(:puid => 'f39d4c68-ab2d-5067-9a1a-c6b45a367906')
+ puts "#{info.artist_name} - #{info.title}"
== REQUIREMENTS:
-* FIX (list of requirements)
+* {MusicDNS key}[https://secure.musicip.com/dns/index.jsp]
+* libofa
+* icanhasaudio
== INSTALL:
-* FIX (sudo gem install, anything else)
+OS X:
+* sudo port install libogg libvorbis lame libofa
+* gem install earworm
+
+Linux:
+* sudo yum install libogg-devel libvorbis-devel lame-devel libofa
+* gem install earworm
== LICENSE:
(The MIT License)
-Copyright (c) 2008 FIX
+Copyright (c) 2008 {Aaron Patterson}[http://tenderlovemaking.com/]
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
View
1  Rakefile
@@ -8,6 +8,7 @@ require 'earworm.rb'
Hoe.new('earworm', Earworm::VERSION) do |p|
p.developer('Aaron Patterson', 'aaronp@rubyforge.org')
+ p.extra_deps = [['icanhasaudio', '>=0.1.1']]
end
# vim: syntax=Ruby
View
26 lib/earworm/fingerprint.rb
@@ -14,7 +14,9 @@ def to_hash
tmpfile = case @thing
when /mp3$/
decode_mp3(@thing)
- when /wav$/
+ when /ogg$/
+ decode_ogg(@thing)
+ else # Assume its a wav file
@thing
end
File.open(tmpfile, 'rb') { |f|
@@ -60,15 +62,21 @@ def wav_info_for(io)
info
end
- def decode_mp3(filename)
- reader = Audio::MPEG::Decoder.new
- name = File.join(Dir::tmpdir, "#{File.basename(filename, '.mp3')}.wav")
- File.open(filename, 'rb') { |input|
- File.open(name, 'wb') { |tmpfile|
- reader.decode(input, tmpfile)
+ {
+ 'ogg' => Audio::OGG::Decoder,
+ 'mp3' => Audio::MPEG::Decoder,
+ }.each do |type,klass|
+ define_method(:"decode_#{type}") do |filename|
+ reader = klass.new
+ name = File.join(Dir::tmpdir,
+ "#{File.basename(filename, ".#{type}")}.wav")
+ File.open(filename, 'rb') { |input|
+ File.open(name, 'wb') { |tmpfile|
+ reader.decode(input, tmpfile)
+ }
}
- }
- name
+ name
+ end
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.