=====[[LastFMAction | LastFM]] Action=====
>>==See also:==
Documentation: LastFMActionInfo.>>This is the development page for the [[LastFMAction | LastFM]] action.::c::
With this action you can embed the widgeds of last.fm .
==Changelog==
=##v1.0##=
##
~- __init__##
=##v1.1##=
##
~- __fix:__ autostart from radio doesn't work correctly
~- __new:__ playlist widget implemented##
=##v1.1.1##=
##
~- __fix:__ playlist loaded the wrong widget
~- __fix:__ playlist ignored the theme settings##
__''WARNING: May contain one, two bugs, but it works all in all.''__
**actions/lastfm.php**
%%(php)
You must provide the kind of LastFM (chart,radio,playlist,quilt) and a username.";
return;
} else {
if ($style=="black")
{
$style = "black";
$bgcolor = "000000";
} elseif ($style=="red")
{
$style = "red";
$bgcolor = "d01f3c";
} elseif ($style=="blue")
{
$style = "blue";
$bgcolor = "000000";
} else
{
$style = "grey";
$bgcolor = "999999";
}
if (!$float || ($float != "right" && $float != "left"))
{
$float = "left";
}
if ($src=="chart" && !$type)
{
print "You must provide a type of playlist (recently,otracks (overall tracks),".
"oartists (overall artists),wtracks (weekly tracks), wartists (weekly artists))";
return;
}
if ($src=="radio" && !$size)
{
$size = "regular";
}
if ($src=="quilt")
{
if (!$type)
{
print "You must provide a type of quilt (album,artist)";
return;
}
if (!$size)
{
$size="small";
}
if (!$orient)
{
$orient="vert";
}
}
}
//gen HTML
if ($src=="chart")
{
//fill size
if (!$width)
{
$width="184";
}
if (!$height)
{
$height="140";
}
//fill kind
//recently|otracks|oartists|wtracks|wartists
if ($type == "otracks")
{
$type="toptracks";
} elseif ($type == "oartists")
{
$type="topartists";
} elseif ($type == "wtracks")
{
$type="weeklytrackchart";
} elseif ($type == "wartists")
{
$type="weeklyartistchart";
} else
{
$type="recenttracks";
}
print '';
} elseif ($src=="radio")
{
//fill size
if ($size)
{
if ($size=="mini")
{
$height="140";
$width="110";
} else
{
$height="140";
$width="184";
}
} else
{
if (!$width)
{
$width="140";
}
if (!$height)
{
$height="184";
}
}
//correct autostart
if ($autostart != "true")
{
$autostart="";
}
print '';
} elseif ($src=="plist")
{
//fill size
if ($size)
{
if ($size=="mini")
{
$width="110";
} else
{
$width="184";
}
$height="248";
} else
{
if (!$width)
{
$width="140";
}
if (!$height)
{
$height="184";
}
}
//correct autostart
if ($autostart != "true")
{
$autostart="";
}
print '';
} elseif ($src=="quilt")
{
//fill size
if ($size)
{
if ($orient="vert")
{
if ($size=="small")
{
$height="370";
} elseif ($size=="large")
{
$height="640";
} else
{
$height="505";
}
$width="234";
} else {
if ($size=="small")
{
$height="235";
} elseif ($size=="large")
{
$height="325";
} else
{
$height="280";
}
$width="510";
}
} else
{
if (!$width)
{
$width="234";
}
if (!$height)
{
$height="505";
}
}
//fill kind
if ($type=="artist")
{
$type="topartists";
} else
{
$type="topalbums";
}
print '';
} else
{
print "Can't identify the kind of widget. Please only use chart,radio,plist (playlist),quilt.";
return;
}
?>
%%
----
CategoryDevelopmentActions - CategoryUserContributions