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


PHP Playlist::update方法代码示例

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


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

示例1: library_metadata

 public static function library_metadata($params)
 {
     $r = Plex_XML_Data::createLibContainer();
     $n = count($params);
     $litem = null;
     $createMode = $_SERVER['REQUEST_METHOD'] == 'POST';
     $editMode = $_SERVER['REQUEST_METHOD'] == 'PUT';
     if ($n > 0) {
         $key = $params[0];
         $id = Plex_XML_Data::getAmpacheId($key);
         if ($editMode) {
             self::check_access(50);
         }
         if ($n == 1) {
             // Should we check that files still exists here?
             $checkFiles = $_REQUEST['checkFiles'];
             $extra = $_REQUEST['includeExtra'];
             if (Plex_XML_Data::isArtist($key)) {
                 $litem = new Artist($id);
                 $litem->format();
                 if ($editMode) {
                     $dmap = array('title' => 'name', 'summary' => null);
                     $litem->update(self::get_data_from_map($dmap));
                 }
                 Plex_XML_Data::addArtist($r, $litem);
             } elseif (Plex_XML_Data::isAlbum($key)) {
                 $litem = new Album($id);
                 $litem->format();
                 if ($editMode) {
                     $dmap = array('title' => 'name', 'year' => null);
                     $litem->update(self::get_data_from_map($dmap));
                 }
                 Plex_XML_Data::addAlbum($r, $litem);
             } elseif (Plex_XML_Data::isTrack($key)) {
                 $litem = new Song($id);
                 $litem->format();
                 if ($editMode) {
                     $dmap = array('title' => null);
                     $litem->update(self::get_data_from_map($dmap));
                 }
                 Plex_XML_Data::addSong($r, $litem);
             } elseif (Plex_XML_Data::isTVShow($key)) {
                 $litem = new TVShow($id);
                 $litem->format();
                 if ($editMode) {
                     $dmap = array('title' => 'name', 'year' => null, 'summary' => null);
                     $litem->update(self::get_data_from_map($dmap));
                 }
                 Plex_XML_Data::addTVShow($r, $litem);
             } elseif (Plex_XML_Data::isTVShowSeason($key)) {
                 $litem = new TVShow_Season($id);
                 $litem->format();
                 Plex_XML_Data::addTVShowSeason($r, $litem);
             } elseif (Plex_XML_Data::isVideo($key)) {
                 $litem = Video::create_from_id($id);
                 if ($editMode) {
                     $dmap = array('title' => null, 'year' => null, 'originallyAvailableAt' => 'release_date', 'originalTitle' => 'original_name', 'summary' => null);
                     $litem->update(self::get_data_from_map($dmap));
                 }
                 $litem->format();
                 $subtype = strtolower(get_class($litem));
                 if ($subtype == 'tvshow_episode') {
                     Plex_XML_Data::addEpisode($r, $litem, true);
                 } elseif ($subtype == 'movie') {
                     Plex_XML_Data::addMovie($r, $litem, true);
                 }
             } elseif (Plex_XML_Data::isPlaylist($key)) {
                 $litem = new Playlist($id);
                 $litem->format();
                 if ($editMode) {
                     $dmap = array('title' => 'name');
                     $litem->update(self::get_data_from_map($dmap));
                 }
                 Plex_XML_Data::addPlaylist($r, $litem);
             }
         } else {
             $subact = $params[1];
             if ($subact == "children") {
                 if (Plex_XML_Data::isArtist($key)) {
                     $litem = new Artist($id);
                     $litem->format();
                     Plex_XML_Data::setArtistRoot($r, $litem);
                 } else {
                     if (Plex_XML_Data::isAlbum($key)) {
                         $litem = new Album($id);
                         $litem->format();
                         Plex_XML_Data::setAlbumRoot($r, $litem);
                     } else {
                         if (Plex_XML_Data::isTVShow($key)) {
                             $litem = new TVShow($id);
                             $litem->format();
                             Plex_XML_Data::setTVShowRoot($r, $litem);
                         } else {
                             if (Plex_XML_Data::isTVShowSeason($key)) {
                                 $litem = new TVShow_Season($id);
                                 $litem->format();
                                 Plex_XML_Data::setTVShowSeasonRoot($r, $litem);
                             }
                         }
                     }
//.........这里部分代码省略.........
开发者ID:cheese1,项目名称:ampache,代码行数:101,代码来源:plex_api.class.php

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

示例3: Artist

     if ($new_id != $_POST['id']) {
         $artist = new Artist($new_id);
     }
     $artist->format();
     break;
 case 'song_row':
     $key = 'song_' . $_POST['id'];
     $song = new Song($_POST['id']);
     $song->update($_POST);
     $song->format();
     break;
 case 'playlist_row':
 case 'playlist_title':
     $key = 'playlist_row_' . $_POST['id'];
     if (isset($playlist)) {
         $playlist->update($_POST);
         $playlist->format();
         $count = $playlist->get_song_count();
     }
     break;
 case 'smartplaylist_row':
 case 'smartplaylist_title':
     $key = 'smartplaylist_row_' . $_POST['id'];
     if (isset($smartpl)) {
         $smartpl->name = $_POST['name'];
         $smartpl->type = $_POST['pl_type'];
         $smartpl->update();
         $smartpl->format();
     }
     break;
 case 'live_stream_row':
开发者ID:axelsimon,项目名称:ampache,代码行数:31,代码来源:ajax.server.php


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