当前位置: 首页>>代码示例>>PHP>>正文


PHP Artist::get_albums方法代码示例

本文整理汇总了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;
 }
开发者ID:cheese1,项目名称:ampache,代码行数:88,代码来源:wanted.class.php

示例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);
 }
开发者ID:axelsimon,项目名称:ampache,代码行数:14,代码来源:api.class.php

示例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
//.........这里部分代码省略.........
开发者ID:nioc,项目名称:ampache,代码行数:101,代码来源:upnp_api.class.php

示例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';
开发者ID:nioc,项目名称:ampache,代码行数:31,代码来源:artists.php

示例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&amp;artist=" . $object_id;
        require_once AmpConfig::get('prefix') . '/templates/show_update_items.inc.php';
开发者ID:axelsimon,项目名称:ampache,代码行数:31,代码来源:artists.php


注:本文中的Artist::get_albums方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。