本文整理汇总了PHP中Album::setArtistId方法的典型用法代码示例。如果您正苦于以下问题:PHP Album::setArtistId方法的具体用法?PHP Album::setArtistId怎么用?PHP Album::setArtistId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Album
的用法示例。
在下文中一共展示了Album::setArtistId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createAlbum
protected function createAlbum()
{
$album = new Album();
$album->setName('Test Album');
$album->setArtistId(3);
return $album;
}
示例2: 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();
}
示例3: Album
// *************************
// OBTENGO DATOS DEL ALBUM
$log->add("getting album id...");
if ($artistId != NULL) {
$album = new Album("brasil");
$log->add("searching db for icpn=" . $track->getIcpn());
$album->loadFromIcpn($dbc, $track->getIcpn());
// veo si ya esta ingresado en la db
if ($album->getMaches() == "1") {
// ya esta ingresado, obtengo id
$albumId = $album->getId();
$log->add("found album={$albumId}");
} else {
$log->add("album not found");
$log->add("fetching album info for icpn=" . $track->getIcpn());
$album->setArtistId($artistId);
$album->fetchXML($track->getIcpn(), $log);
$savedAlbum = $album->save($dbc, "albums");
if ($savedAlbum === TRUE) {
$albumId = $album->getId();
} else {
$albumId = NULL;
$log->add("ERROR saving album");
}
}
}
// *************************
// *************************
// ASOCIO ALBUM con GENERO
$log->add("linking album={$albumId} to group={$genreData->id}...");
$album->assocGroup($dbc, $genreData->id);