mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-03 09:49:30 +02:00
commit
624a2f0717
2 changed files with 55 additions and 21 deletions
|
@ -305,7 +305,6 @@ class Api
|
||||||
* artists
|
* artists
|
||||||
* This takes a collection of inputs and returns
|
* This takes a collection of inputs and returns
|
||||||
* artist objects. This function is deprecated!
|
* artist objects. This function is deprecated!
|
||||||
* //DEPRECATED
|
|
||||||
* @param array $input
|
* @param array $input
|
||||||
*/
|
*/
|
||||||
public static function artists($input)
|
public static function artists($input)
|
||||||
|
@ -332,7 +331,6 @@ class Api
|
||||||
/**
|
/**
|
||||||
* artist
|
* artist
|
||||||
* This returns a single artist based on the UID of said artist
|
* This returns a single artist based on the UID of said artist
|
||||||
* //DEPRECATED
|
|
||||||
* @param array $input
|
* @param array $input
|
||||||
*/
|
*/
|
||||||
public static function artist($input)
|
public static function artist($input)
|
||||||
|
|
|
@ -72,8 +72,11 @@ class XML_Data
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$limit = intval($limit);
|
if (strtolower($limit) == "none") {
|
||||||
self::$limit = $limit;
|
self::$limit = null;
|
||||||
|
} else {
|
||||||
|
self::$limit = intval($limit);
|
||||||
|
}
|
||||||
} // set_limit
|
} // set_limit
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -257,11 +260,15 @@ class XML_Data
|
||||||
*/
|
*/
|
||||||
public static function tags($tags)
|
public static function tags($tags)
|
||||||
{
|
{
|
||||||
if (count($tags) > self::$limit or self::$offset > 0) {
|
$string = '<total_count>' . count($tags) . '</total_count>\n';
|
||||||
$tags = array_splice($tags, self::$offset, self::$limit);
|
|
||||||
}
|
|
||||||
|
|
||||||
$string = '';
|
if (count($tags) > self::$limit or self::$offset > 0) {
|
||||||
|
if (null !== self::$limit) {
|
||||||
|
$tags = array_splice($tags, self::$offset, self::$limit);
|
||||||
|
} else {
|
||||||
|
$tags = array_splice($tags, self::$offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($tags as $tag_id) {
|
foreach ($tags as $tag_id) {
|
||||||
$tag = new Tag($tag_id);
|
$tag = new Tag($tag_id);
|
||||||
|
@ -293,11 +300,18 @@ class XML_Data
|
||||||
*/
|
*/
|
||||||
public static function artists($artists, $include=[], $full_xml=true)
|
public static function artists($artists, $include=[], $full_xml=true)
|
||||||
{
|
{
|
||||||
if (count($artists) > self::$limit or self::$offset > 0) {
|
if (null == $include) {
|
||||||
$artists = array_splice($artists, self::$offset, self::$limit);
|
$include = array();
|
||||||
}
|
}
|
||||||
|
$string = '<total_count>' . count($artists) . '</total_count>\n';
|
||||||
|
|
||||||
$string = '';
|
if (count($artists) > self::$limit or self::$offset > 0) {
|
||||||
|
if (null !== self::$limit) {
|
||||||
|
$artists = array_splice($artists, self::$offset, self::$limit);
|
||||||
|
} else {
|
||||||
|
$artists = array_splice($artists, self::$offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rating::build_cache('artist', $artists);
|
Rating::build_cache('artist', $artists);
|
||||||
|
|
||||||
|
@ -354,13 +368,21 @@ class XML_Data
|
||||||
*/
|
*/
|
||||||
public static function albums($albums, $include=[], $full_xml=true)
|
public static function albums($albums, $include=[], $full_xml=true)
|
||||||
{
|
{
|
||||||
|
if (null == $include) {
|
||||||
|
$include = array();
|
||||||
|
}
|
||||||
|
$string = '<total_count>' . count($albums) . '</total_count>\n';
|
||||||
|
|
||||||
if (count($albums) > self::$limit or self::$offset > 0) {
|
if (count($albums) > self::$limit or self::$offset > 0) {
|
||||||
|
if (null !== self::$limit) {
|
||||||
$albums = array_splice($albums, self::$offset, self::$limit);
|
$albums = array_splice($albums, self::$offset, self::$limit);
|
||||||
|
} else {
|
||||||
|
$albums = array_splice($albums, self::$offset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rating::build_cache('album', $albums);
|
Rating::build_cache('album', $albums);
|
||||||
|
|
||||||
$string = "";
|
|
||||||
foreach ($albums as $album_id) {
|
foreach ($albums as $album_id) {
|
||||||
$album = new Album($album_id);
|
$album = new Album($album_id);
|
||||||
$album->format();
|
$album->format();
|
||||||
|
@ -412,11 +434,15 @@ class XML_Data
|
||||||
*/
|
*/
|
||||||
public static function playlists($playlists)
|
public static function playlists($playlists)
|
||||||
{
|
{
|
||||||
if (count($playlists) > self::$limit or self::$offset > 0) {
|
$string = '<total_count>' . count($playlists) . '</total_count>\n';
|
||||||
$playlists = array_slice($playlists, self::$offset, self::$limit);
|
|
||||||
}
|
|
||||||
|
|
||||||
$string = '';
|
if (count($playlists) > self::$limit or self::$offset > 0) {
|
||||||
|
if (null !== self::$limit) {
|
||||||
|
$playlists = array_slice($playlists, self::$offset, self::$limit);
|
||||||
|
} else {
|
||||||
|
$playlists = array_slice($playlists, self::$offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Foreach the playlist ids
|
// Foreach the playlist ids
|
||||||
foreach ($playlists as $playlist_id) {
|
foreach ($playlists as $playlist_id) {
|
||||||
|
@ -444,14 +470,19 @@ class XML_Data
|
||||||
*/
|
*/
|
||||||
public static function songs($songs, $playlist_data='', $full_xml=true)
|
public static function songs($songs, $playlist_data='', $full_xml=true)
|
||||||
{
|
{
|
||||||
|
$string = '<total_count>' . count($songs) . '</total_count>\n';
|
||||||
|
|
||||||
if (count($songs) > self::$limit or self::$offset > 0) {
|
if (count($songs) > self::$limit or self::$offset > 0) {
|
||||||
|
if (null !== self::$limit) {
|
||||||
$songs = array_slice($songs, self::$offset, self::$limit);
|
$songs = array_slice($songs, self::$offset, self::$limit);
|
||||||
|
} else {
|
||||||
|
$songs = array_slice($songs, self::$offset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Song::build_cache($songs);
|
Song::build_cache($songs);
|
||||||
Stream::set_session($_REQUEST['auth']);
|
Stream::set_session($_REQUEST['auth']);
|
||||||
|
|
||||||
$string = "";
|
|
||||||
// Foreach the ids!
|
// Foreach the ids!
|
||||||
foreach ($songs as $song_id) {
|
foreach ($songs as $song_id) {
|
||||||
$song = new Song($song_id);
|
$song = new Song($song_id);
|
||||||
|
@ -531,11 +562,16 @@ class XML_Data
|
||||||
*/
|
*/
|
||||||
public static function videos($videos)
|
public static function videos($videos)
|
||||||
{
|
{
|
||||||
|
$string = '<total_count>' . count($videos) . '</total_count>\n';
|
||||||
|
|
||||||
if (count($videos) > self::$limit or self::$offset > 0) {
|
if (count($videos) > self::$limit or self::$offset > 0) {
|
||||||
|
if (null !== self::$limit) {
|
||||||
$videos = array_slice($videos, self::$offset, self::$limit);
|
$videos = array_slice($videos, self::$offset, self::$limit);
|
||||||
|
} else {
|
||||||
|
$videos = array_slice($videos, self::$offset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$string = '';
|
|
||||||
foreach ($videos as $video_id) {
|
foreach ($videos as $video_id) {
|
||||||
$video = new Video($video_id);
|
$video = new Video($video_id);
|
||||||
$video->format();
|
$video->format();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue