diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-11-21 06:53:20 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-11-21 06:53:20 +0000 |
commit | 8d914e47c9ecb0c99f63ba50936a09e2184eaf84 (patch) | |
tree | 31302f42d5399ed10af3c75c7faad5ed3b0d0bbe /lib/class/xmldata.class.php | |
parent | 794036ac1f462f302ce71e64132d981f69023e09 (diff) | |
download | ampache-8d914e47c9ecb0c99f63ba50936a09e2184eaf84.tar.gz ampache-8d914e47c9ecb0c99f63ba50936a09e2184eaf84.tar.bz2 ampache-8d914e47c9ecb0c99f63ba50936a09e2184eaf84.zip |
additional xml methods songs & album_songs, also implemented catalog add speed improvement from Karl Hungus
Diffstat (limited to 'lib/class/xmldata.class.php')
-rw-r--r-- | lib/class/xmldata.class.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/class/xmldata.class.php b/lib/class/xmldata.class.php index ba1bec3f..d63d9bfc 100644 --- a/lib/class/xmldata.class.php +++ b/lib/class/xmldata.class.php @@ -166,6 +166,39 @@ class xmlData { } // genres /** + * songs + * This returns an xml document from an array of song ids spiffy isn't it! + */ + public static function songs($songs) { + + if (count($songs) > self::$limit) { + $songs = array_slice($songs,0,self::$limit); + } + + // Foreach the ids! + foreach ($songs as $song_id) { + $song = new Song($song_id); + $song->format(); + + $string .= "<song id=\"$song->id\">\n" . + "\t<title><![CDATA[$song->title]]></title>\n" . + "\t<artist id=\"$song->artist\"><![CDATA[$song->f_artist_full]]></artist>\n" . + "\t<album id=\"$song->album\"><![CDATA[$song->f_album_full]]></album>\n" . + "\t<genre id=\"$song->genre\"><![CDATA[$song->genre]]></genre>\n" . + "\t<track>$song->track</track>\n" . + "\t<time>$song->time</time>\n" . + "\t<url></url>\n" . + "</song>\n"; + + } // end foreach + + $final = self::_header() . $string . self::_footer(); + + return $final; + + } // songs + + /** * _header * this returns a standard header, there are a few types * so we allow them to pass a type if they want to |