Skip to content

Instantly share code, notes, and snippets.

@GoodChancer
Created March 28, 2017 19:08
Show Gist options
  • Save GoodChancer/0f62cdea0644071b2afd422ccac5b23c to your computer and use it in GitHub Desktop.
Save GoodChancer/0f62cdea0644071b2afd422ccac5b23c to your computer and use it in GitHub Desktop.
/* Get Artist */
$stmt = $pdo->prepare('SELECT name FROM artist WHERE id = ?');
$stmt->execute([$albumCurrent['artist_id']]);
$artist = $stmt->fetchColumn();
$stmt = $pdo->prepare('SELECT itunes_url FROM artist WHERE id = ?');
$stmt->execute([$albumCurrent['artist_id']]);
$itunesURL = $stmt->fetchColumn();
$stmt = $pdo->prepare('SELECT allmusic_url FROM artist WHERE id = ?');
$stmt->execute([$albumCurrent['artist_id']]);
$allmusicURL = $stmt->fetchColumn();
if (!is_null($itunesURL)) {
$params = '&ls=1&mt=1';
$artistURL = $itunesURL.$params;
}else {
$artistURL = $allmusicURL;
}
if (!is_null($albumCurrent['itunes_url'])) {
if($albumCurrent['streamable']) {
$params = '&ls=1&mt=1';
}else {
$params = '&ls=1&mt=10';
}
$albumURL = $albumCurrent['itunes_url'].$params;
}else {
$albumURL = $albumCurrent['allmusic_url'];
}
if (!is_null($albumCurrent['art_itunes'])) {
$albumArt = str_replace('100','300',$albumCurrent['art_itunes']);
}else if (!is_null($albumCurrent['art'])) {
$albumArt = '/music/images/art/'.$albumCurrent['art'];
}else {
$albumArt = '/music/images/art/album_300x300.png';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment