- _("lastfm [<user>] => show your or <user>'s now playing track at lastfm. np [<user>] => same as 'lastfm'. other topics: events, artist, album, track, now, set, who")
+ _("lastfm [<user>] => show your or <user>'s now playing track at lastfm. np [<user>] => same as 'lastfm'. other topics: events, artist, album, track, now, set, who, compare")
end
xml = @bot.httputil.get_response(uri)
doc = Document.new xml.body
if xml.class == Net::HTTPInternalServerError
end
xml = @bot.httputil.get_response(uri)
doc = Document.new xml.body
if xml.class == Net::HTTPInternalServerError
venue = e.elements["venue"].elements["name"].text
city = e.elements["venue"].elements["location"].elements["city"].text
country = e.elements["venue"].elements["location"].elements["country"].text
venue = e.elements["venue"].elements["name"].text
city = e.elements["venue"].elements["location"].elements["city"].text
country = e.elements["venue"].elements["location"].elements["country"].text
date = e.elements["startDate"].text.split
h[:date] = Time.utc(date[3].to_i, date[2], date[1].to_i)
h[:desc] = e.elements["description"].text
date = e.elements["startDate"].text.split
h[:date] = Time.utc(date[3].to_i, date[2], date[1].to_i)
h[:desc] = e.elements["description"].text
def tasteometer(m, params)
opts = { :cache => false }
user1 = params[:user1].to_s
user2 = params[:user2].to_s
def tasteometer(m, params)
opts = { :cache => false }
user1 = params[:user1].to_s
user2 = params[:user2].to_s
doc = Document.new xml.body
unless doc
m.reply _("last.fm parsing failed")
return
end
if xml.class == Net::HTTPInternalServerError
doc = Document.new xml.body
unless doc
m.reply _("last.fm parsing failed")
return
end
if xml.class == Net::HTTPInternalServerError
error = doc.root.elements["error"].text
error.match(/Invalid username: \[(.*)\]/);
if @registry.has_key? $1 and not params[:recurs]
error = doc.root.elements["error"].text
error.match(/Invalid username: \[(.*)\]/);
if @registry.has_key? $1 and not params[:recurs]
doc = Document.new xml.body
unless doc
m.reply _("last.fm parsing failed")
return
end
if xml.class == Net::HTTPBadRequest
doc = Document.new xml.body
unless doc
m.reply _("last.fm parsing failed")
return
end
if xml.class == Net::HTTPBadRequest
year = get_album(artist, albumtxt)[2]
album = "[#{albumtxt}, #{year}] " if year
end
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
listeners = first.elements["stats"].elements["listeners"].text
summary = first.elements["bio"].elements["summary"].text
listeners = first.elements["stats"].elements["listeners"].text
summary = first.elements["bio"].elements["summary"].text
- m.reply _("\"%{a}\" has been played %{c} times and is being listened to by %{l} people.") % {:a => artist, :c => playcount, :l => listeners}
+ 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}
m.reply summary.ircify_html
end
def find_track(m, params)
track = params[:track].to_s
m.reply summary.ircify_html
end
def find_track(m, params)
track = params[:track].to_s
playcount = first.elements["playcount"].text
album = first.elements["name"].text
date = first.elements["releasedate"].text
playcount = first.elements["playcount"].text
album = first.elements["name"].text
date = first.elements["releasedate"].text
year = date.strip.split[2].chop
end
result = [artist, album, year, playcount]
year = date.strip.split[2].chop
end
result = [artist, album, year, playcount]
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 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 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
plugin.map 'lastfm compare :user1 :user2', :action => :tasteometer, :thread => true
plugin.map 'np', :action => :now_playing, :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
plugin.map 'lastfm compare :user1 :user2', :action => :tasteometer, :thread => true
plugin.map 'np', :action => :now_playing, :thread => true
plugin.map "lastfm [user] :action [:user]", :thread => true,
:requirements => { :action =>
/^(?:events|friends|neighbou?rs|playlists|recent?tracks|top(?:album|artist|tag)s?|weekly(?:album|artist|track)chart|weeklychartlist)$/
}
plugin.map "lastfm [user] :action [:user]", :thread => true,
:requirements => { :action =>
/^(?:events|friends|neighbou?rs|playlists|recent?tracks|top(?:album|artist|tag)s?|weekly(?:album|artist|track)chart|weeklychartlist)$/
}