本文整理汇总了PHP中Album::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Album::update方法的具体用法?PHP Album::update怎么用?PHP Album::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Album
的用法示例。
在下文中一共展示了Album::update方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: switch
//Находим объект и тип действия
try {
switch ($section) {
case 'files':
//Создаем и инициализируем экземпляр класса для работы с файлами
$sql = new Sql('fotorama');
$album = new Album($_REQUEST, array('tableName' => 'fotorama', 'files' => array(array('field' => 'full', 'dir' => 'files_original/', 'fit' => true, 'width' => 1200, 'height' => 1200, 'ext' => 'jpg'), array('field' => 'img', 'dir' => 'files_image/', 'fit' => 'contain', 'width' => 800, 'height' => 800, 'ext' => 'jpg'), array('field' => 'thumb', 'dir' => 'files_thumb/', 'fit' => 'cover', 'width' => 160, 'height' => 160, 'ext' => 'png')), 'maxSize' => '4M', 'maxSpace' => '100M', 'maxNumberOfFiles' => 100, 'allowedType' => array('jpeg', 'jpg', 'png', 'gif', 'bmp', 'psd', 'psp', 'ai', 'eps', 'cdr', 'mp3', 'mp4', 'wav', 'aac', 'aiff', 'midi', 'avi', 'mov', 'mpg', 'flv', 'mpa', 'pdf', 'txt', 'rtf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'djvu', 'djv', 'bat', 'cmd', 'dll', 'inf', 'ini', 'ocx', 'sys', 'htm', 'html', 'write', 'none', 'zip', 'rar', 'dmg', 'sitx')));
switch ($method) {
case 'GET':
$res = isset($id) ? $album->getOne($id) : $album->get();
break;
case 'PUT':
$res = $album->add();
break;
case 'POST':
$res = isset($id) ? $album->update($id, $r) : $sql->savesort($r['sort']);
break;
case 'DELETE':
$res = $album->delete($id);
break;
}
break;
default:
throw new Exception('Не получен тип действия', 15);
}
if (isset($res)) {
echo json_encode($res);
}
} catch (Exception $e) {
Header('HTTP/1.1 503 Service Unavailable');
echo json_encode(array('error' => array('msg' => $e->getMessage(), 'code' => $e->getCode())));
示例2: 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);
}
}
}
//.........这里部分代码省略.........
示例3: switch
if ($GLOBALS['user']->id == $smartpl->user) {
$level = '25';
}
}
// Make sure we've got them rights
if (!Access::check('interface', $level) || AmpConfig::get('demo_mode')) {
$results['rfc3514'] = '0x1';
break;
}
$new_id = '';
switch ($_POST['type']) {
case 'album_row':
$key = 'album_' . $_POST['id'];
$album = new Album($_POST['id']);
$songs = $album->get_songs();
$new_id = $album->update($_POST);
if ($new_id != $_POST['id']) {
$album = new Album($new_id);
}
$album->format();
break;
case 'artist_row':
$key = 'artist_' . $_POST['id'];
$artist = new Artist($_POST['id']);
$songs = $artist->get_songs();
$new_id = $artist->update($_POST);
if ($new_id != $_POST['id']) {
$artist = new Artist($new_id);
}
$artist->format();
break;
示例4: run
public function run()
{
// first of all - try to guess if this dir should be
// treated as an album or as a bunch of loose tracks
// further this method is adding score to several attributes which will be migrated to production db-table
$this->setHandleAsAlbum();
#print_r($this->r);
cliLog("handleAsAlbumScore " . $this->handleAsAlbumScore, 3, 'purple');
#die();
#if($this->tracks[0]['relativePath'] == 'newroot/crse002cd--Calibre-Musique_Concrete-2CD-CRSE002CD-2001-sour/101-calibre-deep_everytime.mp3') {
#print_r($this->r); die();
#}
// extract some attributes from tracks
// those will be used for album stuff
$mergedFromTracks = array('artist' => array(), 'genre' => array(), 'label' => array(), 'catalogNr' => array());
foreach (array_keys($mergedFromTracks) as $what) {
foreach ($this->tracks as $idx => $rawTagData) {
$mergedFromTracks[$what][] = $this->getMostScored($idx, $what);
}
$mergedFromTracks[$what][] = $this->getMostScored('album', $what);
$mergedFromTracks[$what] = join(',', array_unique($mergedFromTracks[$what]));
}
$albumArtists = count(trimExplode(",", $mergedFromTracks['artist'])) > 3 ? 'Various Artists' : $mergedFromTracks['artist'];
$a = new Album();
$a->setArtistId(join(",", Artist::getIdsByString($albumArtists)));
$a->setGenreId(join(",", Genre::getIdsByString($mergedFromTracks['genre'])));
#$a->setLabelId(join(",", Label::getIdsByString($mergedFromTracks['label'])));
$a->setCatalogNr($this->mostScored['album']['catalogNr']);
$a->setRelativePath($this->getRelativeDirectoryPath());
$a->setRelativePathHash($this->getRelativeDirectoryPathHash());
$a->setAdded($this->getDirectoryMtime());
$a->setFilemtime($this->getDirectoryMtime());
$a->setTitle($this->mostScored['album']['title']);
$a->setYear($this->mostScored['album']['year']);
$a->setIsJumble($this->handleAsAlbum === TRUE ? 0 : 1);
$a->setTrackCount(count($this->tracks));
#print_r($a); die();
$a->update();
$albumId = $a->getId();
// add the whole bunch of valid and indvalid attributes to albumindex table
$this->updateAlbumIndex($albumId);
foreach ($this->tracks as $idx => $rawTagData) {
$t = $this->migrateNonGuessableData($rawTagData);
$t->setArtistId($this->mostScored[$idx]['artist']);
// currently the string insted of an artistId
$t->setTitle($this->mostScored[$idx]['title']);
$t->setFeaturedArtistsAndRemixers();
# setFeaturedArtistsAndRemixers() is processing:
# $t->setArtistId();
# $t->setFeaturingId();
# $t->setRemixerId();
$t->setGenreId(join(",", Genre::getIdsByString($this->getMostScored($idx, 'genre'))));
$t->setLabelId(join(",", Label::getIdsByString($this->getMostScored($idx, 'label'))));
$t->setCatalogNr($this->mostScored[$idx]['catalogNr']);
$t->setDisc($this->mostScored[$idx]['disc']);
$t->setNumber($this->mostScored[$idx]['number']);
$t->setComment($this->mostScored[$idx]['comment']);
$t->setYear($this->mostScored[$idx]['year']);
$t->setAlbumId($albumId);
// make sure to use identical ids in table:rawtagdata and table:track
\Slimpd\Track::ensureRecordIdExists($t->getId());
$t->update();
// make sure extracted images will be referenced to an album
\Slimpd\Bitmap::addAlbumIdToTrackId($t->getId(), $albumId);
#
// add the whole bunch of valid and indvalid attributes to trackindex table
$this->updateTrackIndex($t->getId(), $idx);
}
unset($this->r['album']);
if ($this->handleAsAlbum === TRUE) {
// try to guess if all tracks of this album has obviously invalid fixable attributes
}
return;
print_r($this->r);
#die();
}
示例5: Album
}
$album = new Album($id);
if (!$album->populate(['id' => $id])) {
$api->output(404, 'Album not found');
//indicate the album was not found
return;
}
//store previous MBID
$previousMBID = $album->mbid;
//adapt and validate object received
$updatedAlbum = $api->query['body'];
if (!$album->validateModel($updatedAlbum, $errorMessage)) {
$api->output(400, 'Album is not valid: ' . $errorMessage);
//provided album is not valid
return;
}
if (!$album->update($errorMessage)) {
$api->output(500, 'Error during album update' . $errorMessage);
//something gone wrong :(
return;
}
//if MBID has changed, update cover
if ($previousMBID !== $album->mbid) {
$album->deleteCoverImage();
$album->getCoverImage();
}
$album->populate(['id' => $id]);
$album->getTracks();
$api->output(200, $album->structureData());
break;
}