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


PHP Song::generic_play_url方法代码示例

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


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

示例1: jukeboxcontrol

 /**
  * jukeboxControl
  * Control the jukebox.
  * Takes the action with optional index, offset, song id and volume gain in parameters.
  * Not supported.
  */
 public static function jukeboxcontrol($input)
 {
     self::check_version($input, "1.2.0");
     $action = self::check_parameter($input, 'action');
     $id = $input['id'];
     $gain = $input['gain'];
     $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_DATA_NOTFOUND);
     debug_event('subsonic', 'Using Localplay controller: ' . AmpConfig::get('localplay_controller'), 5);
     $localplay = new Localplay(AmpConfig::get('localplay_controller'));
     if ($localplay->connect()) {
         $ret = false;
         switch ($action) {
             case 'get':
             case 'status':
                 $ret = true;
                 break;
             case 'start':
                 $ret = $localplay->play();
                 break;
             case 'stop':
                 $ret = $localplay->stop();
                 break;
             case 'skip':
                 if (isset($input['index'])) {
                     if ($localplay->skip($input['index'])) {
                         $ret = $localplay->play();
                     }
                 } elseif (isset($input['offset'])) {
                     debug_event('subsonic', 'Skip with offset is not supported on JukeboxControl.', 5);
                 } else {
                     $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_MISSINGPARAM);
                 }
                 break;
             case 'set':
                 $localplay->delete_all();
             case 'add':
                 if ($id) {
                     if (!is_array($id)) {
                         $rid = array();
                         $rid[] = $id;
                         $id = $rid;
                     }
                     foreach ($id as $i) {
                         $url = null;
                         if (Subsonic_XML_Data::isSong($i)) {
                             $url = Song::generic_play_url('song', Subsonic_XML_Data::getAmpacheId($i), '', 'api');
                         } elseif (Subsonic_XML_Data::isVideo($i)) {
                             $url = Song::generic_play_url('video', Subsonic_XML_Data::getAmpacheId($i), '', 'api');
                         }
                         if ($url) {
                             debug_event('subsonic', 'Adding ' . $url, 5);
                             $stream = array();
                             $stream['url'] = $url;
                             $ret = $localplay->add_url(new Stream_URL($stream));
                         }
                     }
                 }
                 break;
             case 'clear':
                 $ret = $localplay->delete_all();
                 break;
             case 'remove':
                 if (isset($input['index'])) {
                     $ret = $localplay->delete_track($input['index']);
                 } else {
                     $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_MISSINGPARAM);
                 }
                 break;
             case 'shuffle':
                 $ret = $localplay->random(true);
                 break;
             case 'setGain':
                 $ret = $localplay->volume_set($gain * 100);
                 break;
         }
         if ($ret) {
             $r = Subsonic_XML_Data::createSuccessResponse();
             if ($action == 'get') {
                 Subsonic_XML_Data::addJukeboxPlaylist($r, $localplay);
             } else {
                 Subsonic_XML_Data::createJukeboxStatus($r, $localplay);
             }
         }
     }
     self::apiOutput($input, $r);
 }
开发者ID:bl00m,项目名称:ampache,代码行数:92,代码来源:subsonic_api.class.php

示例2: play_url

 /**
  * play_url
  * This function takes all the song information and correctly formats a
  * a stream URL taking into account the downsmapling mojo and everything
  * else, this is the true function
  * @param int $oid
  * @param string $additional_params
  * @param boolean $local
  * @return string
  */
 public static function play_url($oid, $additional_params = '', $player = null, $local = false)
 {
     return Song::generic_play_url('podcast_episode', $oid, $additional_params, $player, $local);
 }
开发者ID:bl00m,项目名称:ampache,代码行数:14,代码来源:podcast_episode.class.php


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