forked from tenderlove/earworm
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3c89db0
commit ee1e129
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters