diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2009-05-17 15:51:29 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2009-05-17 15:51:29 +0000 |
commit | 5bd82180f5470c4ce255d02b7aa36c476db1cd99 (patch) | |
tree | 496280c39e1099833da59d8aa95f43c5606bd0ec /lib/class/xmldata.class.php | |
parent | 26b238a464dd6dcf191a76bacff8b0fd46a6b20c (diff) | |
download | ampache-5bd82180f5470c4ce255d02b7aa36c476db1cd99.tar.gz ampache-5bd82180f5470c4ce255d02b7aa36c476db1cd99.tar.bz2 ampache-5bd82180f5470c4ce255d02b7aa36c476db1cd99.zip |
some incomplete work cleaning up the api a bit
Diffstat (limited to 'lib/class/xmldata.class.php')
-rw-r--r-- | lib/class/xmldata.class.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/class/xmldata.class.php b/lib/class/xmldata.class.php index 62267c4b..c9a11112 100644 --- a/lib/class/xmldata.class.php +++ b/lib/class/xmldata.class.php @@ -170,6 +170,40 @@ class xmlData { } // keyed_array /** + * tags + * This returns tags to the user, in a pretty xml document with the information + */ + public static function tags($tags) { + + if (count($tags) > self::$limit) { + $tags = array_splice($tags,self::$offset,self::$limit); + } + + + $string = ''; + + foreach ($tags as $tag_id) { + $tag = new Tag($tag_id); + $counts = $tag->count(); + $string .= "<tag id=\"$tag_id\">\n" . + "\t<name><![CDATA[$tag->name]]></name>\n" . + "\t<albums>" . intval($counts['album']) . "</albums>\n" . + "\t<artists>" . intval($counts['artist']) . "</artists>\n" . + "\t<songs>" . intval($counts['songs']) . "</songs>\n" . + "\t<videos>" . intval($counts['video']) . "</video>\n" . + "\t<playlists>" . intval($count['playlist']) . "</playlists>\n" . + "\t<stream>" . intval($count['live_stream']) . "</stream>\n" . + "</tag>\n"; + } // end foreach + + + $final = self::_header() . $string . self::_footer(); + + return $final; + + } // tags + + /** * artists * This takes an array of artists and then returns a pretty xml document with the information * we want |