本文整理汇总了PHP中Artist::get_albums方法的典型用法代码示例。如果您正苦于以下问题:PHP Artist::get_albums方法的具体用法?PHP Artist::get_albums怎么用?PHP Artist::get_albums使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Artist
的用法示例。
在下文中一共展示了Artist::get_albums方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_missing_albums
/**
* get_missing_albums
* Get list of library's missing albums from MusicBrainz
* @param Artist|null $artist
* @param string $mbid
* @return array
*/
public static function get_missing_albums($artist, $mbid = '')
{
$mb = new MusicBrainz(new RequestsHttpAdapter());
$includes = array('release-groups');
$types = explode(',', AmpConfig::get('wanted_types'));
try {
$martist = $mb->lookup('artist', $artist ? $artist->mbid : $mbid, $includes);
} catch (Exception $e) {
return null;
}
$owngroups = array();
$wartist = array();
if ($artist) {
$albums = $artist->get_albums();
foreach ($albums as $id) {
$album = new Album($id);
if (trim($album->mbid_group)) {
$owngroups[] = $album->mbid_group;
} else {
if (trim($album->mbid)) {
$malbum = $mb->lookup('release', $album->mbid, array('release-groups'));
if ($malbum->{'release-group'}) {
if (!in_array($malbum->{'release-group'}->id, $owngroups)) {
$owngroups[] = $malbum->{'release-group'}->id;
}
}
}
}
}
} else {
$wartist['mbid'] = $mbid;
$wartist['name'] = $martist->name;
parent::add_to_cache('missing_artist', $mbid, $wartist);
$wartist = self::get_missing_artist($mbid);
}
$results = array();
foreach ($martist->{'release-groups'} as $group) {
if (in_array(strtolower($group->{'primary-type'}), $types)) {
$add = true;
for ($i = 0; $i < count($group->{'secondary-types'}) && $add; ++$i) {
$add = in_array(strtolower($group->{'secondary-types'}[$i]), $types);
}
if ($add) {
if (!in_array($group->id, $owngroups)) {
$wantedid = self::get_wanted($group->id);
$wanted = new Wanted($wantedid);
if ($wanted->id) {
$wanted->format();
} else {
$wanted->mbid = $group->id;
if ($artist) {
$wanted->artist = $artist->id;
} else {
$wanted->artist_mbid = $mbid;
}
$wanted->name = $group->title;
if (!empty($group->{'first-release-date'})) {
if (strlen($group->{'first-release-date'}) == 4) {
$wanted->year = $group->{'first-release-date'};
} else {
$wanted->year = date("Y", strtotime($group->{'first-release-date'}));
}
}
$wanted->accepted = false;
$wanted->link = AmpConfig::get('web_path') . "/albums.php?action=show_missing&mbid=" . $group->id;
if ($artist) {
$wanted->link .= "&artist=" . $wanted->artist;
} else {
$wanted->link .= "&artist_mbid=" . $mbid;
}
$wanted->f_link = "<a href=\"" . $wanted->link . "\" title=\"" . $wanted->name . "\">" . $wanted->name . "</a>";
$wanted->f_artist_link = $artist ? $artist->f_link : $wartist['link'];
$wanted->f_user = $GLOBALS['user']->f_name;
}
$results[] = $wanted;
}
}
}
}
return $results;
}
示例2: artist_albums
/**
* artist_albums
* This returns the albums of an artist
*/
public static function artist_albums($input)
{
$artist = new Artist($input['filter']);
$albums = $artist->get_albums(null, true);
// Set the offset
XML_Data::set_offset($input['offset']);
XML_Data::set_limit($input['limit']);
ob_end_clean();
echo XML_Data::albums($albums);
}
示例3: _musicChilds
public static function _musicChilds($prmPath, $prmQuery, $start, $count)
{
$mediaItems = array();
$maxCount = 0;
$queryData = array();
parse_str($prmQuery, $queryData);
$parent = 'amp://music' . $prmPath;
$pathreq = explode('/', $prmPath);
if ($pathreq[0] == '' && count($pathreq) > 0) {
array_shift($pathreq);
}
switch ($pathreq[0]) {
case 'artists':
switch (count($pathreq)) {
case 1:
// Get artists list
//$artists = Catalog::get_artists();
//list($maxCount, $artists) = self::_slice($artists, $start, $count);
$artists = Catalog::get_artists(null, $count, $start);
list($maxCount, $artists) = array(999999, $artists);
foreach ($artists as $artist) {
$artist->format();
$mediaItems[] = self::_itemArtist($artist, $parent);
}
break;
case 2:
// Get artist's albums list
$artist = new Artist($pathreq[1]);
if ($artist->id) {
$album_ids = $artist->get_albums();
list($maxCount, $album_ids) = self::_slice($album_ids, $start, $count);
foreach ($album_ids as $album_id) {
$album = new Album($album_id);
$album->format();
$mediaItems[] = self::_itemAlbum($album, $parent);
}
}
break;
}
break;
case 'albums':
switch (count($pathreq)) {
case 1:
// Get albums list
//!!$album_ids = Catalog::get_albums();
//!!list($maxCount, $album_ids) = self::_slice($album_ids, $start, $count);
$album_ids = Catalog::get_albums($count, $start);
list($maxCount, $album_ids) = array(999999, $album_ids);
foreach ($album_ids as $album_id) {
$album = new Album($album_id);
$album->format();
$mediaItems[] = self::_itemAlbum($album, $parent);
}
break;
case 2:
// Get album's songs list
$album = new Album($pathreq[1]);
if ($album->id) {
$song_ids = $album->get_songs();
list($maxCount, $song_ids) = self::_slice($song_ids, $start, $count);
foreach ($song_ids as $song_id) {
$song = new Song($song_id);
$song->format();
$mediaItems[] = self::_itemSong($song, $parent);
}
}
break;
}
break;
case 'songs':
switch (count($pathreq)) {
case 1:
// Get songs list
$catalogs = Catalog::get_catalogs();
foreach ($catalogs as $catalog_id) {
$catalog = Catalog::create_from_id($catalog_id);
$songs = $catalog->get_songs();
list($maxCount, $songs) = self::_slice($songs, $start, $count);
foreach ($songs as $song) {
$song->format();
$mediaItems[] = self::_itemSong($song, $parent);
}
}
break;
}
break;
case 'playlists':
switch (count($pathreq)) {
case 1:
// Get playlists list
$pl_ids = Playlist::get_playlists();
list($maxCount, $pl_ids) = self::_slice($pl_ids, $start, $count);
foreach ($pl_ids as $pl_id) {
$playlist = new Playlist($pl_id);
$playlist->format();
$mediaItems[] = self::_itemPlaylist($playlist, $parent);
}
break;
case 2:
// Get playlist's songs list
//.........这里部分代码省略.........
示例4: Artist
if (!Catalog::can_remove($artist)) {
debug_event('artist', 'Unauthorized to remove the artist `.' . $artist->id . '`.', 1);
UI::access_denied();
exit;
}
if ($artist->remove_from_disk()) {
show_confirmation(T_('Artist Deletion'), T_('Artist has been deleted.'), AmpConfig::get('web_path'));
} else {
show_confirmation(T_('Artist Deletion'), T_('Cannot delete this artist.'), AmpConfig::get('web_path'));
}
break;
case 'show':
$artist = new Artist($_REQUEST['artist']);
$artist->format();
if (AmpConfig::get('album_release_type')) {
$multi_object_ids = $artist->get_albums($_REQUEST['catalog'], false, true);
} else {
$object_ids = $artist->get_albums($_REQUEST['catalog']);
}
$object_type = 'album';
require_once AmpConfig::get('prefix') . '/templates/show_artist.inc.php';
break;
case 'show_all_songs':
$artist = new Artist($_REQUEST['artist']);
$artist->format();
$object_type = 'song';
$object_ids = $artist->get_songs();
require_once AmpConfig::get('prefix') . '/templates/show_artist.inc.php';
break;
case 'update_from_tags':
$type = 'artist';
示例5: Artist
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
require_once 'lib/init.php';
UI::show_header();
/**
* Display Switch
*/
switch ($_REQUEST['action']) {
case 'show':
$artist = new Artist($_REQUEST['artist']);
$artist->format();
$object_ids = $artist->get_albums($_REQUEST['catalog']);
$object_type = 'album';
require_once AmpConfig::get('prefix') . '/templates/show_artist.inc.php';
break;
case 'show_all_songs':
$artist = new Artist($_REQUEST['artist']);
$artist->format();
$object_type = 'song';
$object_ids = $artist->get_songs();
require_once AmpConfig::get('prefix') . '/templates/show_artist.inc.php';
break;
case 'update_from_tags':
$type = 'artist';
$object_id = intval($_REQUEST['artist']);
$target_url = AmpConfig::get('web_path') . "/artists.php?action=show&artist=" . $object_id;
require_once AmpConfig::get('prefix') . '/templates/show_update_items.inc.php';