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


PHP Catalog::get_catalogs方法代码示例

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


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

示例1: __construct

 /**
  * constructor
  */
 public function __construct($id = null, $searchtype = 'song')
 {
     $this->searchtype = $searchtype;
     if ($id) {
         $info = $this->get_info($id);
         foreach ($info as $key => $value) {
             $this->{$key} = $value;
         }
         $this->rules = unserialize($this->rules);
     }
     // Define our basetypes
     $this->basetypes['numeric'][] = array('name' => 'gte', 'description' => T_('is greater than or equal to'), 'sql' => '>=');
     $this->basetypes['numeric'][] = array('name' => 'lte', 'description' => T_('is less than or equal to'), 'sql' => '<=');
     $this->basetypes['numeric'][] = array('name' => 'equal', 'description' => T_('is'), 'sql' => '<=>');
     $this->basetypes['numeric'][] = array('name' => 'ne', 'description' => T_('is not'), 'sql' => '<>');
     $this->basetypes['numeric'][] = array('name' => 'gt', 'description' => T_('is greater than'), 'sql' => '>');
     $this->basetypes['numeric'][] = array('name' => 'lt', 'description' => T_('is less than'), 'sql' => '<');
     $this->basetypes['boolean'][] = array('name' => 'true', 'description' => T_('is true'));
     $this->basetypes['boolean'][] = array('name' => 'false', 'description' => T_('is false'));
     $this->basetypes['text'][] = array('name' => 'contain', 'description' => T_('contains'), 'sql' => 'LIKE', 'preg_match' => array('/^/', '/$/'), 'preg_replace' => array('%', '%'));
     $this->basetypes['text'][] = array('name' => 'notcontain', 'description' => T_('does not contain'), 'sql' => 'NOT LIKE', 'preg_match' => array('/^/', '/$/'), 'preg_replace' => array('%', '%'));
     $this->basetypes['text'][] = array('name' => 'start', 'description' => T_('starts with'), 'sql' => 'LIKE', 'preg_match' => '/$/', 'preg_replace' => '%');
     $this->basetypes['text'][] = array('name' => 'end', 'description' => T_('ends with'), 'sql' => 'LIKE', 'preg_match' => '/^/', 'preg_replace' => '%');
     $this->basetypes['text'][] = array('name' => 'equal', 'description' => T_('is'), 'sql' => '=');
     $this->basetypes['text'][] = array('name' => 'sounds', 'description' => T_('sounds like'), 'sql' => 'SOUNDS LIKE');
     $this->basetypes['text'][] = array('name' => 'notsounds', 'description' => T_('does not sound like'), 'sql' => 'NOT SOUNDS LIKE');
     $this->basetypes['boolean_numeric'][] = array('name' => 'equal', 'description' => T_('is'), 'sql' => '<=>');
     $this->basetypes['boolean_numeric'][] = array('name' => 'ne', 'description' => T_('is not'), 'sql' => '<>');
     $this->basetypes['boolean_subsearch'][] = array('name' => 'equal', 'description' => T_('is'), 'sql' => '');
     $this->basetypes['boolean_subsearch'][] = array('name' => 'ne', 'description' => T_('is not'), 'sql' => 'NOT');
     $this->basetypes['date'][] = array('name' => 'lt', 'description' => T_('before'), 'sql' => '<');
     $this->basetypes['date'][] = array('name' => 'gt', 'description' => T_('after'), 'sql' => '>');
     $this->basetypes['multiple'] = array_merge($this->basetypes['text'], $this->basetypes['numeric']);
     switch ($searchtype) {
         case 'song':
             $this->types[] = array('name' => 'anywhere', 'label' => T_('Any searchable text'), 'type' => 'text', 'widget' => array('input', 'text'));
             $this->types[] = array('name' => 'title', 'label' => T_('Title'), 'type' => 'text', 'widget' => array('input', 'text'));
             $this->types[] = array('name' => 'album', 'label' => T_('Album'), 'type' => 'text', 'widget' => array('input', 'text'));
             $this->types[] = array('name' => 'artist', 'label' => T_('Artist'), 'type' => 'text', 'widget' => array('input', 'text'));
             $this->types[] = array('name' => 'composer', 'label' => T_('Composer'), 'type' => 'text', 'widget' => array('input', 'text'));
             $this->types[] = array('name' => 'comment', 'label' => T_('Comment'), 'type' => 'text', 'widget' => array('input', 'text'));
             $this->types[] = array('name' => 'label', 'label' => T_('Label'), 'type' => 'text', 'widget' => array('input', 'text'));
             $this->types[] = array('name' => 'tag', 'label' => T_('Tag'), 'type' => 'text', 'widget' => array('input', 'text'));
             $this->types[] = array('name' => 'album_tag', 'label' => T_('Album tag'), 'type' => 'text', 'widget' => array('input', 'text'));
             $this->types[] = array('name' => 'file', 'label' => T_('Filename'), 'type' => 'text', 'widget' => array('input', 'text'));
             $this->types[] = array('name' => 'year', 'label' => T_('Year'), 'type' => 'numeric', 'widget' => array('input', 'text'));
             $this->types[] = array('name' => 'time', 'label' => T_('Length (in minutes)'), 'type' => 'numeric', 'widget' => array('input', 'text'));
             if (AmpConfig::get('ratings')) {
                 $this->types[] = array('name' => 'rating', 'label' => T_('Rating'), 'type' => 'numeric', 'widget' => array('select', array('1 Star', '2 Stars', '3 Stars', '4 Stars', '5 Stars')));
             }
             if (AmpConfig::get('show_played_times')) {
                 $this->types[] = array('name' => 'played_times', 'label' => T_('# Played'), 'type' => 'numeric', 'widget' => array('input', 'text'));
             }
             $this->types[] = array('name' => 'bitrate', 'label' => T_('Bitrate'), 'type' => 'numeric', 'widget' => array('select', array('32', '40', '48', '56', '64', '80', '96', '112', '128', '160', '192', '224', '256', '320')));
             $this->types[] = array('name' => 'played', 'label' => T_('Played'), 'type' => 'boolean', 'widget' => array('input', 'hidden'));
             $this->types[] = array('name' => 'added', 'label' => T_('Added'), 'type' => 'date', 'widget' => array('input', 'text'));
             $this->types[] = array('name' => 'updated', 'label' => T_('Updated'), 'type' => 'date', 'widget' => array('input', 'text'));
             $catalogs = array();
             foreach (Catalog::get_catalogs() as $catid) {
                 $catalog = Catalog::create_from_id($catid);
                 $catalog->format();
                 $catalogs[$catid] = $catalog->f_name;
             }
             $this->types[] = array('name' => 'catalog', 'label' => T_('Catalog'), 'type' => 'boolean_numeric', 'widget' => array('select', $catalogs));
             $playlists = array();
             foreach (Playlist::get_playlists() as $playlistid) {
                 $playlist = new Playlist($playlistid);
                 $playlist->format();
                 $playlists[$playlistid] = $playlist->f_name;
             }
             $this->types[] = array('name' => 'playlist', 'label' => T_('Playlist'), 'type' => 'boolean_numeric', 'widget' => array('select', $playlists));
             $this->types[] = array('name' => 'playlist_name', 'label' => T_('Playlist Name'), 'type' => 'text', 'widget' => array('input', 'text'));
             $playlists = array();
             foreach (Search::get_searches() as $playlistid) {
                 // Slightly different from the above so we don't instigate
                 // a vicious loop.
                 $playlists[$playlistid] = Search::get_name_byid($playlistid);
             }
             $this->types[] = array('name' => 'smartplaylist', 'label' => T_('Smart Playlist'), 'type' => 'boolean_subsearch', 'widget' => array('select', $playlists));
             $metadataFields = array();
             $metadataFieldRepository = new \Lib\Metadata\Repository\MetadataField();
             foreach ($metadataFieldRepository->findAll() as $metadata) {
                 $metadataFields[$metadata->getId()] = $metadata->getName();
             }
             $this->types[] = array('name' => 'metadata', 'label' => T_('Metadata'), 'type' => 'multiple', 'subtypes' => $metadataFields, 'widget' => array('subtypes', array('input', 'text')));
             $licenses = array();
             foreach (License::get_licenses() as $license_id) {
                 $license = new License($license_id);
                 $licenses[$license_id] = $license->name;
             }
             if (AmpConfig::get('licensing')) {
                 $this->types[] = array('name' => 'license', 'label' => T_('Music License'), 'type' => 'boolean_numeric', 'widget' => array('select', $licenses));
             }
             break;
         case 'album':
             $this->types[] = array('name' => 'title', 'label' => T_('Title'), 'type' => 'text', 'widget' => array('input', 'text'));
             $this->types[] = array('name' => 'artist', 'label' => T_('Artist'), 'type' => 'text', 'widget' => array('input', 'text'));
//.........这里部分代码省略.........
开发者ID:cheese1,项目名称:ampache,代码行数:101,代码来源:search.class.php

示例2: T_

?>
/admin/export.php?action=export" method="post" enctype="multipart/form-data" >
<table class="tableform" cellspacing="0" cellpadding="3">
<tr>
    <td valign="top"><strong><?php 
echo T_('Catalog');
?>
:</strong></td>
    <td>
        <select id="export_catalog" name="export_catalog">
            <option value=""><?php 
echo T_('All');
?>
</option>
<?php 
$catalog_ids = Catalog::get_catalogs();
foreach ($catalog_ids as $catalog_id) {
    $catalog = Catalog::create_from_id($catalog_id);
    $current_name = 'catalog_' . $catalog->id;
    ?>
            <option value="<?php 
    echo $catalog->id;
    ?>
"<?php 
    echo ${$current_name};
    ?>
><?php 
    echo scrub_out($catalog->name);
    ?>
</option>
<?php 
开发者ID:cheese1,项目名称:ampache,代码行数:31,代码来源:show_export.inc.php

示例3: createpodcastchannel

 /**
  * createPodcastChannel
  * Add a new podcast channel.
  * Takes the podcast url in parameter.
  */
 public static function createpodcastchannel($input)
 {
     self::check_version($input, "1.9.0");
     $url = self::check_parameter($input, 'url');
     if (AmpConfig::get('podcast') && Access::check('interface', 75)) {
         $catalogs = Catalog::get_catalogs('podcast');
         if (count($catalogs) > 0) {
             $data = array();
             $data['feed'] = $url;
             $data['catalog'] = $catalogs[0];
             if (Podcast::create($data)) {
                 $r = Subsonic_XML_Data::createSuccessResponse();
             } else {
                 $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_GENERIC);
             }
         } else {
             $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_UNAUTHORIZED);
         }
     } else {
         $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_UNAUTHORIZED);
     }
     self::apiOutput($input, $r);
 }
开发者ID:bl00m,项目名称:ampache,代码行数:28,代码来源:subsonic_api.class.php

示例4: system_library_sections

 public static function system_library_sections($params)
 {
     $r = Plex_XML_Data::createSysContainer();
     Plex_XML_Data::setSysSections($r, Catalog::get_catalogs());
     Plex_XML_Data::setContainerSize($r);
     self::apiOutputXml($r->asXML());
 }
开发者ID:cheese1,项目名称:ampache,代码行数:7,代码来源:plex_api.class.php

示例5: array

 */
if (!defined('AJAX_INCLUDE')) {
    exit;
}
$results = array();
switch ($_REQUEST['action']) {
    case 'random_albums':
        $albums = Album::get_random(6);
        if (count($albums) and is_array($albums)) {
            ob_start();
            require_once AmpConfig::get('prefix') . UI::find_template('show_random_albums.inc.php');
            $results['random_selection'] = ob_get_clean();
        } else {
            $results['random_selection'] = '<!-- None found -->';
            if (Access::check('interface', '100')) {
                $catalogs = Catalog::get_catalogs();
                if (count($catalogs) == 0) {
                    $results['random_selection'] = sprintf(T_('No catalog configured yet. To start streaming your media, you now need to %s add a catalog %s'), '<a href="' . AmpConfig::get('web_path') . '/admin/catalog.php?action=show_add_catalog">', '</a>.<br /><br />');
                }
            }
        }
        break;
    case 'random_videos':
        $videos = Video::get_random(6);
        if (count($videos) and is_array($videos)) {
            ob_start();
            require_once AmpConfig::get('prefix') . UI::find_template('show_random_videos.inc.php');
            $results['random_video_selection'] = ob_get_clean();
        } else {
            $results['random_video_selection'] = '<!-- None found -->';
        }
开发者ID:ivan801,项目名称:ampache,代码行数:31,代码来源:index.ajax.php

示例6: process_action

 public static function process_action($action, $catalogs, $options = null)
 {
     if (!$options || !is_array($options)) {
         $options = array();
     }
     switch ($action) {
         case 'add_to_all_catalogs':
             $catalogs = Catalog::get_catalogs();
         case 'add_to_catalog':
             if ($catalogs) {
                 foreach ($catalogs as $catalog_id) {
                     $catalog = Catalog::create_from_id($catalog_id);
                     if ($catalog !== null) {
                         $catalog->add_to_catalog($options);
                     }
                 }
                 if (!defined('SSE_OUTPUT')) {
                     AmpError::display('catalog_add');
                 }
             }
             break;
         case 'update_all_catalogs':
             $catalogs = Catalog::get_catalogs();
         case 'update_catalog':
             if ($catalogs) {
                 foreach ($catalogs as $catalog_id) {
                     $catalog = Catalog::create_from_id($catalog_id);
                     if ($catalog !== null) {
                         $catalog->verify_catalog();
                     }
                 }
             }
             break;
         case 'full_service':
             if (!$catalogs) {
                 $catalogs = Catalog::get_catalogs();
             }
             /* This runs the clean/verify/add in that order */
             foreach ($catalogs as $catalog_id) {
                 $catalog = Catalog::create_from_id($catalog_id);
                 if ($catalog !== null) {
                     $catalog->clean_catalog();
                     $catalog->verify_catalog();
                     $catalog->add_to_catalog();
                 }
             }
             Dba::optimize_tables();
             break;
         case 'clean_all_catalogs':
             $catalogs = Catalog::get_catalogs();
         case 'clean_catalog':
             if ($catalogs) {
                 foreach ($catalogs as $catalog_id) {
                     $catalog = Catalog::create_from_id($catalog_id);
                     if ($catalog !== null) {
                         $catalog->clean_catalog();
                     }
                 }
                 // end foreach catalogs
                 Dba::optimize_tables();
             }
             break;
         case 'update_from':
             $catalog_id = 0;
             // First see if we need to do an add
             if ($options['add_path'] != '/' && strlen($options['add_path'])) {
                 if ($catalog_id = Catalog_local::get_from_path($options['add_path'])) {
                     $catalog = Catalog::create_from_id($catalog_id);
                     if ($catalog !== null) {
                         $catalog->add_to_catalog(array('subdirectory' => $options['add_path']));
                     }
                 }
             }
             // end if add
             // Now check for an update
             if ($options['update_path'] != '/' && strlen($options['update_path'])) {
                 if ($catalog_id = Catalog_local::get_from_path($options['update_path'])) {
                     $songs = Song::get_from_path($options['update_path']);
                     foreach ($songs as $song_id) {
                         Catalog::update_single_item('song', $song_id);
                     }
                 }
             }
             // end if update
             if ($catalog_id <= 0) {
                 AmpError::add('general', T_("This subdirectory is not part of an existing catalog. Update cannot be processed."));
             }
             break;
         case 'gather_media_art':
             if (!$catalogs) {
                 $catalogs = Catalog::get_catalogs();
             }
             // Iterate throught the catalogs and gather as needed
             foreach ($catalogs as $catalog_id) {
                 $catalog = Catalog::create_from_id($catalog_id);
                 if ($catalog !== null) {
                     require AmpConfig::get('prefix') . UI::find_template('show_gather_art.inc.php');
                     flush();
                     $catalog->gather_art();
                 }
//.........这里部分代码省略.........
开发者ID:bl00m,项目名称:ampache,代码行数:101,代码来源:catalog.class.php

示例7: getartists

 /**
  * getArtists
  * Get all artists.
  * Takes no parameter.
  */
 public static function getartists($input)
 {
     self::check_version($input, "1.7.0");
     $r = Subsonic_XML_Data::createSuccessResponse();
     $artists = Catalog::get_artists(Catalog::get_catalogs());
     Subsonic_XML_Data::addArtistsRoot($r, $artists, true);
     self::apiOutput($input, $r);
 }
开发者ID:cheese1,项目名称:ampache,代码行数:13,代码来源:subsonic_api.class.php

示例8: get_catalog_all_pts

 protected function get_catalog_all_pts($fct, pData $MyData, $catalog = 0, $object_type = null, $object_id = 0, $start_date = null, $end_date = null, $zoom = 'day')
 {
     $values = $this->get_all_pts($fct, $MyData, $catalog, $object_type, $object_id, $start_date, $end_date, $zoom, false);
     // Only display other users if the graph is not for a specific catalog
     if (!$catalog) {
         $catalog_ids = Catalog::get_catalogs();
         foreach ($catalog_ids as $catalog_id) {
             $c = Catalog::create_from_id($catalog_id);
             $catalog_values = $this->get_all_type_pts($fct, $catalog_id, $object_type, $object_id, $start_date, $end_date, $zoom);
             $pv = 0;
             foreach ($values as $date => $value) {
                 if (array_key_exists($date, $catalog_values)) {
                     $value = $catalog_values[$date];
                     $pv = $value;
                 } else {
                     $value = $pv;
                 }
                 $MyData->addPoints($value, $c->name);
             }
         }
     }
 }
开发者ID:nioc,项目名称:ampache,代码行数:22,代码来源:graph.class.php

示例9: T_

             Error::add('general', T_("This subdirectory is not part of an existing catalog. Update cannot be processed."));
         }
         break;
     case 'add_catalog':
         $catalog_id = intval($_REQUEST['catalog_id']);
         $catalog = Catalog::create_from_id($catalog_id);
         if ($catalog !== null) {
             // Run our initial add
             $catalog->add_to_catalog($options);
             if (!defined('SSE_OUTPUT')) {
                 Error::display('catalog_add');
             }
         }
         break;
     case 'gather_media_art':
         $catalogs = $_REQUEST['catalogs'] ? $_REQUEST['catalogs'] : Catalog::get_catalogs();
         // Iterate throught the catalogs and gather as needed
         foreach ($catalogs as $catalog_id) {
             $catalog = Catalog::create_from_id($catalog_id);
             if ($catalog !== null) {
                 require AmpConfig::get('prefix') . '/templates/show_gather_art.inc.php';
                 flush();
                 $catalog->gather_art();
             }
         }
         break;
 }
 if (defined('SSE_OUTPUT')) {
     echo "data: toggleVisible('ajax-loading')\n\n";
     ob_flush();
     flush();
开发者ID:nioc,项目名称:ampache,代码行数:31,代码来源:sse.server.php

示例10: catalog_songs

 private static function catalog_songs()
 {
     // $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));
     return $o;
 }
开发者ID:cheese1,项目名称:ampache,代码行数:17,代码来源:daap_api.class.php

示例11: _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

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


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