Маленький и простой как топор скрипт, вытаскивающий из last.fm название играющей в данный момент песни. Не забудьте вписать свой ник.
Алиас:
/lnpalias(lnp)
{
# ↓↓↓EDIT THIS↓↓↓
%user = "USERNAME"
######
if(%user == "USERNAME" || %user == "") {
echo "\[lnp\] Set username"
return
}
%output = "np: ~artist~ — ~name~"
%useaction = 1
######################################
######################################
http.asyncGet -a -w=h -q -y -c -i=$array($window,$channel,$target($window),%output,%useaction) ("http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=%user&api_key=eba9632ddc908a8fd7ad1200d771beb7&limit=1")
{
if($0)
{
%window = $3[0]
%output = $3[3]
%useaction = $3[4]
%f = $file.read($2)
if($str.match("<track nowplaying=\"true\"*<artist*</artist*<name*</name",%f))
{
%artist = $str.lefttofirst($str.rightfromfirst(%f,"<artist"),"</artist")
%artist =~ s/^[^>]+>//
%name = $str.lefttofirst($str.rightfromfirst(%f,"<name>"),"</name")
# echo -w=%window $str.replace($str.replace(%output,"~artist~",%artist),"~name~",%name)
%ret = $str.replace($str.replace(%output,"~artist~",%artist),"~name~",%name)
if(%useaction)
{
rebind -q %window
me %ret
}
else
{
say -r=%window %ret
}
}
else
{
echo -w=%window -i=$msgtype("ServerInfo") "\[lnp\] Silence"
}
}
}
}