summaryrefslogtreecommitdiffstats
path: root/lib/class/xmldata.class.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-11-20 08:32:15 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-11-20 08:32:15 +0000
commit8c99cc87702cd47f62e6356be98dc874b051abe9 (patch)
treeb7139544ebe83cba68ce405691f3223055cf4316 /lib/class/xmldata.class.php
parent5869da3fe58876644364941fa7216caee09adbf5 (diff)
downloadampache-8c99cc87702cd47f62e6356be98dc874b051abe9.tar.gz
ampache-8c99cc87702cd47f62e6356be98dc874b051abe9.tar.bz2
ampache-8c99cc87702cd47f62e6356be98dc874b051abe9.zip
added genres as a new xml method, and improved logging
Diffstat (limited to 'lib/class/xmldata.class.php')
-rw-r--r--lib/class/xmldata.class.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/class/xmldata.class.php b/lib/class/xmldata.class.php
index 655a65f3..ba1bec3f 100644
--- a/lib/class/xmldata.class.php
+++ b/lib/class/xmldata.class.php
@@ -133,6 +133,39 @@ class xmlData {
} // albums
/**
+ * genres
+ * This takes an array of genre ids and returns a nice little pretty xml doc
+ */
+ public static function genres($genres) {
+
+ if (count($genres) > self::$limit) {
+ $genres = array_slice($genres,0,self::$limit);
+ }
+
+ // Foreach the ids
+ foreach ($genres as $genre_id) {
+ $genre = new Genre($genre_id);
+ $genre->format();
+ $song_count = $genre->get_song_count();
+ $album_count = $genre->get_album_count();
+ $artist_count = $genre->get_artist_count();
+
+ $string .= "<genre id=\"$genre->id\">\n" .
+ "\t<name><![CDATA[$genre->name]]></name>\n" .
+ "\t<songs>$song_count</songs>\n" .
+ "\t<albums>$album_count</albums>\n" .
+ "\t<artists>$artist_count</artists>\n" .
+ "</genre>\n";
+
+ } // end foreach
+
+ $final = self::_header() . $string . self::_footer();
+
+ return $final;
+
+ } // genres
+
+ /**
* _header
* this returns a standard header, there are a few types
* so we allow them to pass a type if they want to