本文整理汇总了PHP中Catalog::get_albums_by_artist方法的典型用法代码示例。如果您正苦于以下问题:PHP Catalog::get_albums_by_artist方法的具体用法?PHP Catalog::get_albums_by_artist怎么用?PHP Catalog::get_albums_by_artist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Catalog
的用法示例。
在下文中一共展示了Catalog::get_albums_by_artist方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getalbumlist
/**
* getAlbumList
* Get a list of random, newest, highest rated etc. albums.
* Takes the list type with optional size and offset in parameters.
*/
public static function getalbumlist($input, $elementName = "albumList")
{
self::check_version($input, "1.2.0");
$type = self::check_parameter($input, 'type');
$size = $input['size'];
$offset = $input['offset'];
$musicFolderId = $input['musicFolderId'] ?: 0;
// Get albums from all catalogs by default
// Catalog filter is not supported for all request type for now.
$catalogs = null;
if ($musicFolderId > 0) {
$catalogs = array();
$catalogs[] = $musicFolderId;
}
$r = Subsonic_XML_Data::createSuccessResponse();
$errorOccured = false;
$albums = array();
if ($type == "random") {
$albums = Album::get_random($size);
} else {
if ($type == "newest") {
$albums = Stats::get_newest("album", $size, $offset, $musicFolderId);
} else {
if ($type == "highest") {
$albums = Rating::get_highest("album", $size, $offset);
} else {
if ($type == "frequent") {
$albums = Stats::get_top("album", $size, '', $offset);
} else {
if ($type == "recent") {
$albums = Stats::get_recent("album", $size, $offset);
} else {
if ($type == "starred") {
$albums = Userflag::get_latest('album');
} else {
if ($type == "alphabeticalByName") {
$albums = Catalog::get_albums($size, $offset, $catalogs);
} else {
if ($type == "alphabeticalByArtist") {
$albums = Catalog::get_albums_by_artist($size, $offset, $catalogs);
} else {
if ($type == "byYear") {
$fromYear = $input['fromYear'];
$toYear = $input['toYear'];
if ($fromYear || $toYear) {
$search = array();
$search['limit'] = $size;
$search['offset'] = $offset;
$search['type'] = "album";
$i = 0;
if ($fromYear) {
$search['rule_' . $i . '_input'] = $fromYear;
$search['rule_' . $i . '_operator'] = 0;
$search['rule_' . $i . ''] = "year";
++$i;
}
if ($toYear) {
$search['rule_' . $i . '_input'] = $toYear;
$search['rule_' . $i . '_operator'] = 1;
$search['rule_' . $i . ''] = "year";
++$i;
}
$query = new Search(null, 'album');
$albums = $query->run($search);
}
} else {
if ($type == "byGenre") {
$genre = self::check_parameter($input, 'genre');
$tag_id = Tag::tag_exists($genre);
if ($tag_id) {
$albums = Tag::get_tag_objects('album', $tag_id, $size, $offset);
}
} else {
$r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_GENERIC, "Invalid list type: " . scrub_out($type));
$errorOccured = true;
}
}
}
}
}
}
}
}
}
}
if (!$errorOccured) {
Subsonic_XML_Data::addAlbumList($r, $albums, $elementName);
}
self::apiOutput($input, $r);
}
示例2: getalbumlist
/**
* getAlbumList
* Get a list of random, newest, highest rated etc. albums.
* Takes the list type with optional size and offset in parameters.
*/
public static function getalbumlist($input, $elementName = "albumList")
{
self::check_version($input, "1.2.0");
$type = self::check_parameter($input, 'type');
$size = $input['size'];
$offset = $input['offset'];
$albums = array();
if ($type == "random") {
$albums = Album::get_random($size);
} else {
if ($type == "newest") {
$albums = Stats::get_newest("album", $size, $offset);
} else {
if ($type == "highest") {
$albums = Rating::get_highest("album", $size, $offset);
} else {
if ($type == "frequent") {
$albums = Stats::get_top("album", $size, '', $offset);
} else {
if ($type == "recent") {
$albums = Stats::get_recent("album", $size, $offset);
} else {
if ($type == "starred") {
$albums = Userflag::get_latest('album');
} else {
if ($type == "alphabeticalByName") {
$albums = Catalog::get_albums($size, $offset);
} else {
if ($type == "alphabeticalByArtist") {
$albums = Catalog::get_albums_by_artist($size, $offset);
}
}
}
}
}
}
}
}
if (count($albums)) {
$r = Subsonic_XML_Data::createSuccessResponse();
Subsonic_XML_Data::addAlbumList($r, $albums, $elementName);
} else {
$r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_DATA_NOTFOUND);
}
self::apiOutput($input, $r);
}