Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

filling out bin file

  • Loading branch information...
commit ee1e1297361d655c6c6948a2dbbbb84fbbab6748 1 parent 3c89db0
@tenderlove authored
Showing with 26 additions and 0 deletions.
  1. +25 −0 bin/earworm
  2. +1 −0  lib/earworm/track.rb
View
25 bin/earworm 100644 → 100755
@@ -0,0 +1,25 @@
+#!/usr/bin/env ruby
+
+require 'rubygems'
+require 'earworm'
+require 'yaml'
+
+CONFIG = File.join(File.expand_path(ENV['HOME']), '.earworm')
+config = YAML.load_file(CONFIG)
+
+(puts("USAGE: #{$0} unknown_file") || exit) unless ARGV[0]
+
+ew = Earworm::Client.new(config['key'])
+track =
+ if File.exists?(ARGV[0])
+ ew.identify(:file => ARGV[0])
+ else
+ ew.identify(:puid => ARGV[0])
+ end
+
+puts "Title: #{track.title}" if track.title
+puts "Artist: #{track.artist}" if track.artist
+track.puid_list.each do |puid|
+ puts "PUID: #{puid}"
+end
+
View
1  lib/earworm/track.rb
@@ -1,6 +1,7 @@
module Earworm
class Track
attr_accessor :title, :artist_name, :puid_list
+ alias :artist :artist_name
def initialize
@title = nil
@artist_name = nil
Please sign in to comment.
Something went wrong with that request. Please try again.