summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxgizzmo <xgizzmo@ampache>2006-07-24 22:18:44 +0000
committerxgizzmo <xgizzmo@ampache>2006-07-24 22:18:44 +0000
commitafa1173a19e08606b5f159807bdf93e84896deac (patch)
tree6a8101c67fb8e5fe176d2d2ab3d09610f6150576
parent90c965631e5689052305851b53277a7af01fa668 (diff)
downloadampache-afa1173a19e08606b5f159807bdf93e84896deac.tar.gz
ampache-afa1173a19e08606b5f159807bdf93e84896deac.tar.bz2
ampache-afa1173a19e08606b5f159807bdf93e84896deac.zip
Fix for bug 514 thanks pb1dft
-rw-r--r--lib/class/stream.class.php39
-rw-r--r--lib/preferences.php1
2 files changed, 40 insertions, 0 deletions
diff --git a/lib/class/stream.class.php b/lib/class/stream.class.php
index da918fc2..f1500a35 100644
--- a/lib/class/stream.class.php
+++ b/lib/class/stream.class.php
@@ -176,6 +176,45 @@ class Stream {
} // create_asx
+ /*!
+ @function create_xspf
+ @discussion creates an XSPF playlist (Thx PB1DFT)
+ */
+ function create_xspf() {
+
+ header("Cache-control: public");
+ header("Content-Disposition: filename=playlist.xspf");
+ header("Content-Type: application/xspf+xml;");
+ echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n";
+ echo "<playlist version = \"1\" \n xmlns=\"http://xspf.org/ns/0/\">\n";
+ echo " <title>Ampache XSPF Playlist</title>\n";
+ echo " <creator>" . htmlspecialchars(conf('site_title')) . "</creator>\n";
+ echo " <annotation>" . htmlspecialchars(conf('site_title')) . "</annotation>\n";
+ echo " <info>". conf('web_path') ."</info>\n";
+ echo " <trackList>\n\n\n\n";
+
+ foreach ($this->songs as $song_id) {
+ $song = new Song($song_id);
+ $song->format_song();
+ $url = htmlspecialchars($song->get_url());
+ $song_name = $song->f_artist_full . " - " . $song->title . "." . $song->type;
+ echo " <track>\n";
+ echo " <location>$url</location>\n";
+ echo " <identifier>$url</identifier>\n";
+ echo " <title>" . htmlspecialchars($song->title) . "</title>\n";
+ echo " <creator>" . htmlspecialchars($song->f_artist_full) . "</creator>\n";
+ echo " <annotation></annotation>\n";
+ echo " <info>" . conf('web_path') . htmlspecialchars("/albums.php?action=show&album=") . htmlspecialchars($song->album) . "</info>";
+ echo " <image>" . conf('web_path') . "/albumart.php?id=" . htmlspecialchars($song->album) . htmlspecialchars("&thumb=2") . "</image>\n";
+ echo " <album>" . htmlspecialchars($song->f_album_full) . "</album>\n";
+ echo " <duration>" . $song->time . "</duration>\n";
+ echo " </track>\n\n\n";
+ } // end foreach
+ echo " </trackList>\n";
+ echo "</playlist>\n";
+
+ } // create_xspf
+
/*!
@function create_icecast2
@discussion pushes an icecast stream
diff --git a/lib/preferences.php b/lib/preferences.php
index a94140a6..48430632 100644
--- a/lib/preferences.php
+++ b/lib/preferences.php
@@ -280,6 +280,7 @@ function create_preference_input($name,$value) {
echo "\t<option value=\"pls\" $pls_type>" . _("PLS") . "</option>\n";
echo "\t<option value=\"asx\" $asx_type>" . _("Asx") . "</option>\n";
echo "\t<option value=\"ram\" $ram_type>" . _("RAM") . "</option>\n";
+ echo "\t<option value=\"xspf\" $xspf_type>" . _("XSPF") . "</option>\n";
echo "</select>\n";
break;
case 'lang':