summaryrefslogtreecommitdiffstats
path: root/lib/class/xmldata.class.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2009-02-28 18:13:48 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2009-02-28 18:13:48 +0000
commitdbdd96ed1b3b00a850be001f3dbeea3273739a98 (patch)
treeccd23afffb6a4c2dc185bd6ffc39e13435fc1179 /lib/class/xmldata.class.php
parent3a3e0c6a9f72d5031a4025dedcf2360c497c4953 (diff)
downloadampache-dbdd96ed1b3b00a850be001f3dbeea3273739a98.tar.gz
ampache-dbdd96ed1b3b00a850be001f3dbeea3273739a98.tar.bz2
ampache-dbdd96ed1b3b00a850be001f3dbeea3273739a98.zip
unify how the stream is constructed and played, this is a major change might be some regressions
Diffstat (limited to 'lib/class/xmldata.class.php')
-rw-r--r--lib/class/xmldata.class.php52
1 files changed, 49 insertions, 3 deletions
diff --git a/lib/class/xmldata.class.php b/lib/class/xmldata.class.php
index f4087edf..894ab541 100644
--- a/lib/class/xmldata.class.php
+++ b/lib/class/xmldata.class.php
@@ -103,6 +103,26 @@ class xmlData {
} // single_string
/**
+ * header
+ * This returns the header
+ */
+ public static function header() {
+
+ return self::_header();
+
+ } // header
+
+ /**
+ * footer
+ * This returns the footer
+ */
+ public static function footer() {
+
+ return self::_footer();
+
+ } // header
+
+ /**
* keyed_array
* This will build an xml document from a key'd array,
*/
@@ -261,6 +281,7 @@ class xmlData {
}
Rating::build_cache('song',$songs);
+ Stream::set_session($_REQUEST['auth']);
// Foreach the ids!
foreach ($songs as $song_id) {
@@ -279,7 +300,7 @@ class xmlData {
"\t<track>$song->track</track>\n" .
"\t<time>$song->time</time>\n" .
"\t<mime>$song->mime</mime>\n" .
- "\t<url><![CDATA[" . $song->get_url($_REQUEST['auth']) . "]]></url>\n" .
+ "\t<url><![CDATA[" . Song::play_url($song->id) . "]]></url>\n" .
"\t<size>$song->size</size>\n" .
"\t<art><![CDATA[" . $art_url . "]]></art>\n" .
"\t<preciserating>" . $rating->preciserating . "</preciserating>\n" .
@@ -323,10 +344,29 @@ class xmlData {
switch (self::$type) {
case 'xspf':
-
+ $header = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" .
+ "<!-- XML Generated by Ampache v." . Config::get('version') . " -->";
+ "<playlist version = \"1\" xmlns=\"http://xspf.org/ns/0/\">\n ".
+ "<title>Ampache XSPF Playlist</title>\n" .
+ "<creator>" . Config::get('site_title') . "</creator>\n" .
+ "<annotation>" . Config::get('site_title') . "</annotation>\n" .
+ "<info>". Config::get('web_path') ."</info>\n" .
+ "<trackList>\n\n\n\n";
break;
case 'itunes':
-
+ $header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" .
+ "<!-- XML Generated by Ampache v." . Config::get('version') . " -->";
+ "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\"\n" .
+ "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n" .
+ "<plist version=\"1.0\">\n" .
+ "<dict>\n" .
+ " <key>Major Version</key><integer>1</integer>\n" .
+ " <key>Minor Version</key><integer>1</integer>\n" .
+ " <key>Application Version</key><string>7.0.2</string>\n" .
+ " <key>Features</key><integer>1</integer>\n" .
+ " <key>Show Content Ratings</key><true/>\n" .
+ " <key>Tracks</key>\n" .
+ " <dict>\n";
break;
case 'rss':
$header = "<?xml version=\"1.0\" encoding=\"" . Config::get('site_charset') . "\" ?>\n " .
@@ -349,6 +389,12 @@ class xmlData {
private static function _footer() {
switch (self::$type) {
+ case 'itunes':
+ $footer = "\t\t</dict>\t\n</dict>\n</plist>\n";
+ break;
+ case 'xspf':
+ $footer = "\t</trackList>\n</playlist>\n";
+ break;
case 'rss':
$footer = "\n</channel>\n</rss>\n";
break;