when :now, :np
_("lastfm now [<user>] => show the now playing track from last.fm. np [<user>] does the same.")
when :set
- _("lastfm set nick <user> => associate your current irc nick with a last.fm user. lastfm set verb <present> <past> => set your preferred now playing verb. default \"listening\" and \"listened\".")
+ _("lastfm set user <user> => associate your current irc nick with a last.fm user. lastfm set verb <present> <past> => set your preferred now playing verb. default \"listening\" and \"listened\".")
when :who
_("lastfm who [<nick>] => show who <nick> is at last.fm. if <nick> is empty, show who you are at lastfm.")
when :compare
}
m.reply disp_events.join(' | '), :split_at => /\s+\|\s+/
- end
+ end
def tasteometer(m, params)
opts = { :cache => false }
return
end
if xml.class == Net::HTTPInternalServerError
- if doc.root.elements["error"].attributes["code"] == "7" then
+ if doc.root.elements["error"].attributes["code"] == "7" then
error = doc.root.elements["error"].text
error.match(/Invalid username: \[(.*)\]/);
if @registry.has_key? $1 and not params[:recurs]
return
end
if xml.class == Net::HTTPBadRequest
- if doc.root.elements["error"].text == "Invalid user name supplied" then
+ if doc.root.elements["error"].text == "Invalid user name supplied" then
if @registry.has_key? user and not params[:recurs]
params[:who] = @registry[ user ]
params[:recurs] = true
year = get_album(artist, albumtxt)[2]
album = "[#{albumtxt}, #{year}] " if year
end
- date = first.elements["date"].attributes["uts"]
- past = Time.at(date.to_i)
+ past = nil
+ date = XPath.first(first, "//date")
+ if date != nil
+ time = date.attributes["uts"]
+ past = Time.at(time.to_i)
+ end
if now == "true"
verb = _("listening")
if @registry.has_key? "#{m.sourcenick}_verb_present"
end
first = doc.root.elements["artist"]
artist = first.elements["name"].text
- playcount = first.elements["stats"].elements["plays"].text
+ playcount = first.elements["stats"].elements["playcount"].text
listeners = first.elements["stats"].elements["listeners"].text
summary = first.elements["bio"].elements["summary"].text
m.reply _("%{b}%{a}%{b} has been played %{c} times and is being listened to by %{l} people.") % {:b => Bold, :a => artist, :c => playcount, :l => listeners}
playcount = first.elements["playcount"].text
album = first.elements["name"].text
date = first.elements["releasedate"].text
- unless date.strip.length < 2
+ unless date.strip.length < 2
year = date.strip.split[2].chop
end
result = [artist, album, year, playcount]
nick = ""
if params[:who]
nick = params[:who].to_s
- else
+ else
nick = m.sourcenick
end
if @registry.has_key? nick
plugin.map 'lastfm album *album [by *artist]', :action => :find_album
plugin.map 'lastfm track *track', :action => :find_track, :thread => true
plugin.map 'lastfm set nick :who', :action => :set_user, :thread => true
+plugin.map 'lastfm set user :who', :action => :set_user, :thread => true
+plugin.map 'lastfm set username :who', :action => :set_user, :thread => true
plugin.map 'lastfm set verb :present :past', :action => :set_verb, :thread => true
plugin.map 'lastfm who :who', :action => :get_user, :thread => true
plugin.map 'lastfm who', :action => :get_user, :thread => true