Created
March 23, 2010 01:39
-
-
Save steshaw/340760 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/ruby | |
require 'rubygems' | |
require 'id3lib' | |
def usage() | |
scriptName = File.basename($0) | |
STDERR.puts "Usage: #{scriptName} <mp3-file>" | |
exit 1 | |
end | |
if ARGV.length != 1 then | |
usage | |
end | |
file = ARGV[0] | |
if !File.readable? ARGV[0] then | |
STDERR.puts "Error: Cannot read the file you provided. [#{file}]" | |
usage | |
end | |
tags = ID3Lib::Tag.new(file) | |
uitsFaq = "http://uits.umusic.com/faq.htm" | |
uitsPrivFrame = tags.find{|frame| frame[:id] == :PRIV && frame[:owner] = uitsFaq} | |
if uitsPrivFrame == nil then | |
STDERR.puts "Cannot find UITS PRIV frame with owner attribute of #{uitsFaq}" | |
exit 1 | |
end | |
uitsXml = uitsPrivFrame[:data].sub(/\000+$/, "") | |
puts uitsXml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment