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


PHP Playlist::get_items方法代码示例

本文整理汇总了PHP中Playlist::get_items方法的典型用法代码示例。如果您正苦于以下问题:PHP Playlist::get_items方法的具体用法?PHP Playlist::get_items怎么用?PHP Playlist::get_items使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Playlist的用法示例。


在下文中一共展示了Playlist::get_items方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Artist

     }
     $artist = new Artist($artist_id);
     $songs = $artist->get_songs();
     foreach ($songs as $song_id) {
         $GLOBALS['user']->playlist->add_object($song_id, 'song');
     }
     $results['rightbar'] = UI::ajax_include('rightbar.inc.php');
     break;
 case 'playlist':
     $playlist_id = Random::playlist();
     if (!$playlist_id) {
         $results['rfc3514'] = '0x1';
         break;
     }
     $playlist = new Playlist($playlist_id);
     $items = $playlist->get_items();
     foreach ($items as $item) {
         $GLOBALS['user']->playlist->add_object($item['object_id'], $item['object_type']);
     }
     $results['rightbar'] = UI::ajax_include('rightbar.inc.php');
     break;
 case 'advanced_random':
     $object_ids = Random::advanced('song', $_POST);
     // First add them to the active playlist
     if (is_array($object_ids)) {
         foreach ($object_ids as $object_id) {
             $GLOBALS['user']->playlist->add_object($object_id, 'song');
         }
     }
     $results['rightbar'] = UI::ajax_include('rightbar.inc.php');
     // Now setup the browse and show them below!
开发者ID:cheese1,项目名称:ampache,代码行数:31,代码来源:random.ajax.php

示例2: Playlist

 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
define('AJAX_INCLUDE', '1');
require_once '../lib/init.php';
debug_event('refresh_reordered.server.php', 'Called for action: {' . $_REQUEST['action'] . '}', '5');
/* Switch on the action passed in */
switch ($_REQUEST['action']) {
    case 'refresh_playlist_medias':
        $playlist = new Playlist($_REQUEST['id']);
        $playlist->format();
        $object_ids = $playlist->get_items();
        $browse = new Browse();
        $browse->set_type('playlist_media');
        $browse->add_supplemental_object('playlist', $playlist->id);
        $browse->set_static_content(true);
        $browse->show_objects($object_ids);
        $browse->store();
        break;
    case 'refresh_album_songs':
        $browse = new Browse();
        $browse->set_show_header(true);
        $browse->set_type('song');
        $browse->set_simple_browse(true);
        $browse->set_filter('album', $_REQUEST['id']);
        $browse->set_sort('track', 'ASC');
        $browse->get_objects();
开发者ID:bl00m,项目名称:ampache,代码行数:31,代码来源:refresh_reordered.server.php

示例3: playlist_songs

 /**
  * playlist_songs
  * This returns the songs for a playlist
  */
 public static function playlist_songs($input)
 {
     $playlist = new Playlist($input['filter']);
     $items = $playlist->get_items();
     $songs = array();
     foreach ($items as $object) {
         if ($object['object_type'] == 'song') {
             $songs[] = $object['object_id'];
         }
     }
     // end foreach
     XML_Data::set_offset($input['offset']);
     XML_Data::set_limit($input['limit']);
     ob_end_clean();
     echo XML_Data::songs($songs);
 }
开发者ID:axelsimon,项目名称:ampache,代码行数:20,代码来源:api.class.php

示例4: setPlayQueue

 public static function setPlayQueue(SimpleXMLElement $xml, $type, $playlistID, $uri, $key, $shuffle)
 {
     $GLOBALS['user']->playlist->clear();
     $id = 0;
     if (!empty($key)) {
         $id = self::getKeyFromMetadataUri($key);
     } elseif (!empty($uri)) {
         $key = self::getKeyFromFullUri($uri);
         $id = self::getKeyFromMetadataUri($key);
     }
     $plmedias = array();
     if ($id) {
         if ($type == 'audio' || $type == 'video') {
             $item = self::createLibraryItem($id);
             if ($item != null) {
                 $plmedias = $item->get_medias();
             }
         }
     } else {
         // Add complete playlist
         if (self::isPlaylist($playlistID)) {
             $playlist = new Playlist(self::getAmpacheId($playlistID));
             if ($shuffle) {
                 $plmedias = $playlist->get_random_items();
             } else {
                 $plmedias = $playlist->get_items();
             }
         }
     }
     $GLOBALS['user']->playlist->add_medias($plmedias);
     self::setTmpPlayQueue($xml, 1);
 }
开发者ID:bl00m,项目名称:ampache,代码行数:32,代码来源:plex_xml_data.class.php

示例5: databases

 /**
  * databases
  */
 public static function databases($input)
 {
     // $revision = $_GET['revision-number'];
     $o = '';
     // Database list
     if (count($input) == 0) {
         self::check_session('daap.serverdatabases');
         $o = self::tlv('dmap.status', 200);
         $o .= self::tlv('dmap.updatetype', 0);
         $o .= self::tlv('dmap.specifiedtotalcount', 1);
         $o .= self::tlv('dmap.returnedcount', 1);
         $r = self::tlv('dmap.itemid', 1);
         $r .= self::tlv('dmap.persistentid', 1);
         $r .= self::tlv('dmap.itemname', 'Ampache');
         $counts = Catalog::count_medias();
         $r .= self::tlv('dmap.itemcount', $counts['songs']);
         $r .= self::tlv('dmap.containercount', count(Playlist::get_playlists()));
         $r = self::tlv('dmap.listingitem', $r);
         $o .= self::tlv('dmap.listing', $r);
         $o = self::tlv('daap.serverdatabases', $o);
     } elseif (count($input) == 2) {
         if ($input[1] == 'items') {
             // Songs list
             self::check_session('daap.databasesongs');
             $o = self::catalog_songs();
             $o = self::tlv('daap.databasesongs', $o);
         } elseif ($input[1] == 'containers') {
             // Playlist list
             self::check_session('daap.databaseplaylists');
             $o = self::tlv('dmap.status', 200);
             $o .= self::tlv('dmap.updatetype', 0);
             $playlists = Playlist::get_playlists();
             $searches = Search::get_searches();
             $o .= self::tlv('dmap.specifiedtotalcount', count($playlists) + count($searches) + 1);
             $o .= self::tlv('dmap.returnedcount', count($playlists) + count($searches) + 1);
             $l = self::base_library();
             foreach ($playlists as $playlist_id) {
                 $playlist = new Playlist($playlist_id);
                 $playlist->format();
                 $l .= self::tlv_playlist($playlist);
             }
             foreach ($searches as $search_id) {
                 $playlist = new Search($search_id, 'song');
                 $playlist->format();
                 $l .= self::tlv_playlist($playlist);
             }
             $o .= self::tlv('dmap.listing', $l);
             $o = self::tlv('daap.databaseplaylists', $o);
         }
     } elseif (count($input) == 3) {
         // Stream
         if ($input[1] == 'items') {
             $finfo = explode('.', $input[2]);
             if (count($finfo) == 2) {
                 $id = intval($finfo[0]);
                 $type = $finfo[1];
                 $params = '';
                 $headers = apache_request_headers();
                 $client = $headers['User-Agent'];
                 if (!empty($client)) {
                     $params .= '&client=' . $client;
                 }
                 $params .= '&transcode_to=' . $type;
                 $url = Song::play_url($id, $params, 'api', true);
                 self::follow_stream($url);
                 exit;
             }
         }
     } elseif (count($input) == 4) {
         // Playlist
         if ($input[1] == 'containers' && $input[3] == 'items') {
             $id = intval($input[2]);
             self::check_session('daap.playlistsongs');
             if ($id == Daap_Api::BASE_LIBRARY) {
                 $o = self::catalog_songs();
                 $o = self::tlv('daap.playlistsongs', $o);
             } else {
                 if ($id > Daap_Api::AMPACHEID_SMARTPL) {
                     $id -= Daap_Api::AMPACHEID_SMARTPL;
                     $playlist = new Search($id, 'song');
                 } else {
                     $playlist = new Playlist($id);
                 }
                 if ($playlist->id) {
                     $meta = explode(',', strtolower($_GET['meta']));
                     $o = self::tlv('dmap.status', 200);
                     $o .= self::tlv('dmap.updatetype', 0);
                     $items = $playlist->get_items();
                     $song_ids = array();
                     foreach ($items as $item) {
                         if ($item['object_type'] == 'song') {
                             $song_ids[] = $item['object_id'];
                         }
                     }
                     if (AmpConfig::get('memory_cache')) {
                         Song::build_cache($song_ids);
                     }
//.........这里部分代码省略.........
开发者ID:cheese1,项目名称:ampache,代码行数:101,代码来源:daap_api.class.php

示例6: _musicChilds


//.........这里部分代码省略.........
                     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
                     $playlist = new Playlist($pathreq[1]);
                     if ($playlist->id) {
                         $items = $playlist->get_items();
                         list($maxCount, $items) = self::_slice($items, $start, $count);
                         foreach ($items as $item) {
                             if ($item['object_type'] == 'song') {
                                 $song = new Song($item['object_id']);
                                 $song->format();
                                 $mediaItems[] = self::_itemSong($song, $parent);
                             }
                         }
                     }
                     break;
             }
             break;
         case 'smartplaylists':
             switch (count($pathreq)) {
                 case 1:
                     // Get playlists list
                     $pl_ids = Search::get_searches();
                     list($maxCount, $pl_ids) = self::_slice($pl_ids, $start, $count);
                     foreach ($pl_ids as $pl_id) {
                         $playlist = new Search($pl_id, 'song');
                         $playlist->format();
                         $mediaItems[] = self::_itemPlaylist($playlist, $parent);
                     }
                     break;
                 case 2:
                     // Get playlist's songs list
                     $playlist = new Search($pathreq[1], 'song');
                     if ($playlist->id) {
                         $items = $playlist->get_items();
                         list($maxCount, $items) = self::_slice($items, $start, $count);
                         foreach ($items as $item) {
                             if ($item['object_type'] == 'song') {
                                 $song = new Song($item['object_id']);
                                 $song->format();
                                 $mediaItems[] = self::_itemSong($song, $parent);
                             }
                         }
                     }
                     break;
             }
             break;
         default:
             $mediaItems[] = self::_musicMetadata('artists');
             $mediaItems[] = self::_musicMetadata('albums');
             $mediaItems[] = self::_musicMetadata('songs');
             $mediaItems[] = self::_musicMetadata('playlists');
             $mediaItems[] = self::_musicMetadata('smartplaylists');
             break;
     }
     if ($maxCount == 0) {
         $maxCount = count($mediaItems);
     }
     return array($maxCount, $mediaItems);
 }
开发者ID:nioc,项目名称:ampache,代码行数:101,代码来源:upnp_api.class.php


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