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


PHP Playlist::regenerate_track_numbers方法代码示例

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


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

示例1: _updatePlaylist

 private static function _updatePlaylist($id, $name, $songsIdToAdd = array(), $songIndexToRemove = array(), $public = true)
 {
     $playlist = new Playlist($id);
     $newdata = array();
     $newdata['name'] = !empty($name) ? $name : $playlist->name;
     $newdata['pl_type'] = $public ? "public" : "private";
     $playlist->update($newdata);
     if ($songsIdToAdd) {
         if (!is_array($songsIdToAdd)) {
             $songsIdToAdd = array($songsIdToAdd);
         }
         if (count($songsIdToAdd) > 0) {
             for ($i = 0; $i < count($songsIdToAdd); ++$i) {
                 $songsIdToAdd[$i] = Subsonic_XML_Data::getAmpacheId($songsIdToAdd[$i]);
             }
             $playlist->add_songs($songsIdToAdd);
         }
     }
     if ($songIndexToRemove) {
         if (!is_array($songIndexToRemove)) {
             $songIndexToRemove = array($songIndexToRemove);
         }
         if (count($songIndexToRemove) > 0) {
             foreach ($songIndexToRemove as $track) {
                 $playlist->delete_track_number($track);
             }
             $playlist->regenerate_track_numbers();
         }
     }
 }
开发者ID:bl00m,项目名称:ampache,代码行数:30,代码来源:subsonic_api.class.php

示例2: array

/**
 * Sub-Ajax page, requires AJAX_INCLUDE
 */
if (!defined('AJAX_INCLUDE')) {
    exit;
}
$results = array();
switch ($_REQUEST['action']) {
    case 'delete_track':
        // Create the object and remove the track
        $playlist = new Playlist($_REQUEST['playlist_id']);
        $playlist->format();
        if ($playlist->has_access()) {
            $playlist->delete_track($_REQUEST['track_id']);
            // This could have performance issues
            $playlist->regenerate_track_numbers();
        }
        $object_ids = $playlist->get_items();
        ob_start();
        $browse = new Browse();
        $browse->set_type('playlist_song');
        $browse->add_supplemental_object('playlist', $playlist->id);
        $browse->save_objects($object_ids);
        $browse->show_objects($object_ids);
        $browse->store();
        $results[$browse->get_content_div()] = ob_get_clean();
        break;
    case 'append_item':
        // Only song item are supported with playlists
        debug_event('playlist', 'Appending items to playlist {' . $_REQUEST['playlist_id'] . '}...', '5');
        if (!isset($_REQUEST['playlist_id']) || empty($_REQUEST['playlist_id'])) {
开发者ID:cheese1,项目名称:ampache,代码行数:31,代码来源:playlist.ajax.php


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