本文整理汇总了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();
}
}
}
示例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'])) {