Example #1
0
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with "Podes musikkmashup".  If not, see <http://www.gnu.org/licenses/>.
Source code available from: 
http://github.com/pode/musikkmashup/
*/
include_once '../config.php';
if (!$config['moduler']['albuminfo']['aktiv']) {
    exit;
}
include_once '../include/functions.php';
if (!empty($_GET['album']) && !empty($_GET['artist'])) {
    $url = $config['lastfm']['api_root'];
    $url .= "?method=album.getinfo";
    $url .= "&api_key=" . $config['lastfm']['api_key'];
    $url .= "&artist=" . urlencode(avinverter($_GET['artist']));
    $url .= "&album=" . urlencode($_GET['album']);
    $url .= "&format=json";
    if ($album = json_decode(file_get_contents($url), true)) {
        // Sjekk om det er noe feil
        if ($album['error']) {
            echo "<p>Beklager, det oppstod en feil!<br />({$album['message']})</p>";
            exit;
        }
        // Tittel
        echo '<p class="overskrift">' . $album['album']['name'] . '</p>';
        // Bilde
        if ($album['album']['image'][2]['#text']) {
            echo '<p class="albumbilde"><img src="' . $album['album']['image'][2]['#text'] . '" alt="' . $album['album']['name'] . '" title="' . $album['album']['name'] . '" /></p>';
        }
        // Beskrivelse
Example #2
0
along with "Podes musikkmashup".  If not, see <http://www.gnu.org/licenses/>.
Source code available from: 
http://github.com/pode/musikkmashup/
*/
include_once '../config.php';
if (!$config['moduler']['artist']['aktiv']) {
    exit;
}
include_once '../include/functions.php';
include_once '../lastfmapi/lastfmapi.php';
if (!empty($_GET['artist'])) {
    $authVars['apiKey'] = $config['lastfm']['api_key'];
    $auth = new lastfmApiAuth('setsession', $authVars);
    $apiClass = new lastfmApi();
    $artist = $apiClass->getPackage($auth, 'artist');
    $methodVars = array('artist' => avinverter($_GET['artist']));
    if ($art = $artist->getinfo($methodVars)) {
        // Sjekk om det oppstod feil
        if ($artist->error['code']) {
            // Error: show which error and go no further.
            echo '<b>Error ' . $artist->error['code'] . ' - </b><i>' . $artist->error['desc'] . '</i>';
            exit;
        }
        if ($art['name']) {
            echo '<p class="overskrift">' . $art['name'] . '</p>';
            // Bilde
            if ($art['image']['large']) {
                echo '<p class="artistbilde"><img src="' . $art['image']['large'] . '" alt="' . $art['name'] . '" title="' . $art['name'] . '" /></p>';
            }
            // Biografi
            if ($art['bio']['summary']) {