本文整理汇总了PHP中Catalog::count_medias方法的典型用法代码示例。如果您正苦于以下问题:PHP Catalog::count_medias方法的具体用法?PHP Catalog::count_medias怎么用?PHP Catalog::count_medias使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Catalog
的用法示例。
在下文中一共展示了Catalog::count_medias方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _musicMetadata
public static function _musicMetadata($prmPath, $prmQuery = '')
{
$root = 'amp://music';
$pathreq = explode('/', $prmPath);
if ($pathreq[0] == '' && count($pathreq) > 0) {
array_shift($pathreq);
}
$meta = null;
switch ($pathreq[0]) {
case 'artists':
switch (count($pathreq)) {
case 1:
$counts = Catalog::count_medias();
$meta = array('id' => $root . '/artists', 'parentID' => $root, 'restricted' => '1', 'childCount' => $counts['artists'], 'dc:title' => T_('Artists'), 'upnp:class' => 'object.container');
break;
case 2:
$artist = new Artist($pathreq[1]);
if ($artist->id) {
$artist->format();
$meta = self::_itemArtist($artist, $root . '/artists');
}
break;
}
break;
case 'albums':
switch (count($pathreq)) {
case 1:
$counts = Catalog::count_medias();
$meta = array('id' => $root . '/albums', 'parentID' => $root, 'restricted' => '1', 'childCount' => $counts['albums'], 'dc:title' => T_('Albums'), 'upnp:class' => 'object.container');
break;
case 2:
$album = new Album($pathreq[1]);
if ($album->id) {
$album->format();
$meta = self::_itemAlbum($album, $root . '/albums');
}
break;
}
break;
case 'songs':
switch (count($pathreq)) {
case 1:
$counts = Catalog::count_medias();
$meta = array('id' => $root . '/songs', 'parentID' => $root, 'restricted' => '1', 'childCount' => $counts['songs'], 'dc:title' => T_('Songs'), 'upnp:class' => 'object.container');
break;
case 2:
$song = new Song($pathreq[1]);
if ($song->id) {
$song->format();
$meta = self::_itemSong($song, $root . '/songs');
}
break;
}
break;
case 'playlists':
switch (count($pathreq)) {
case 1:
$counts = Catalog::count_medias();
$meta = array('id' => $root . '/playlists', 'parentID' => $root, 'restricted' => '1', 'childCount' => $counts['playlists'], 'dc:title' => T_('Playlists'), 'upnp:class' => 'object.container');
break;
case 2:
$playlist = new Playlist($pathreq[1]);
if ($playlist->id) {
$playlist->format();
$meta = self::_itemPlaylist($playlist, $root . '/playlists');
}
break;
}
break;
case 'smartplaylists':
switch (count($pathreq)) {
case 1:
$counts = Catalog::count_medias();
$meta = array('id' => $root . '/smartplaylists', 'parentID' => $root, 'restricted' => '1', 'childCount' => $counts['smartplaylists'], 'dc:title' => T_('Smart Playlists'), 'upnp:class' => 'object.container');
break;
case 2:
$playlist = new Search($pathreq[1], 'song');
if ($playlist->id) {
$playlist->format();
$meta = self::_itemSmartPlaylist($playlist, $root . '/smartplaylists');
}
break;
}
break;
default:
$meta = array('id' => $root, 'parentID' => '0', 'restricted' => '1', 'childCount' => '5', 'dc:title' => T_('Music'), 'upnp:class' => 'object.container');
break;
}
return $meta;
}
示例2: base_library
public static function base_library()
{
$p = self::tlv('dmap.itemid', Daap_Api::BASE_LIBRARY);
$p .= self::tlv('dmap.persistentid', Daap_Api::BASE_LIBRARY);
$p .= self::tlv('dmap.itemname', 'Music');
$p .= self::tlv('daap.baseplaylist', 1);
$stats = Catalog::count_medias();
$p .= self::tlv('dmap.itemcount', $stats['songs']);
return self::tlv('dmap.listingitem', $p);
}
示例3: databases
/**
* update
*
*/
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.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.playlistsongs');
//$type = $_GET['type'];
$meta = explode(',', strtolower($_GET['meta']));
$o = self::tlv('dmap.status', 200);
$o .= self::tlv('dmap.updatetype', 0);
$songs = array();
$catalogs = Catalog::get_catalogs();
foreach ($catalogs as $catalog_id) {
$catalog = Catalog::create_from_id($catalog_id);
$songs = array_merge($songs, $catalog->get_songs());
}
$o .= self::tlv('dmap.specifiedtotalcount', count($songs));
$o .= self::tlv('dmap.returnedcount', count($songs));
$o .= self::tlv('dmap.listing', self::tlv_songs($songs, $meta));
$o = self::tlv('daap.playlistsongs', $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));
$o .= self::tlv('dmap.returnedcount', count($playlists) + count($searches));
$l = '';
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::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();
//.........这里部分代码省略.........