summaryrefslogtreecommitdiffstats
path: root/lib/rss.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2005-06-09 16:34:40 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2005-06-09 16:34:40 +0000
commitbcad40a05ab2dc2a341a3227e30b96668bce4500 (patch)
tree6fca27588d53a1b24705bd2834e9e643bb729bd1 /lib/rss.php
downloadampache-bcad40a05ab2dc2a341a3227e30b96668bce4500.tar.gz
ampache-bcad40a05ab2dc2a341a3227e30b96668bce4500.tar.bz2
ampache-bcad40a05ab2dc2a341a3227e30b96668bce4500.zip
New Import
Diffstat (limited to 'lib/rss.php')
-rw-r--r--lib/rss.php64
1 files changed, 64 insertions, 0 deletions
diff --git a/lib/rss.php b/lib/rss.php
new file mode 100644
index 00000000..efb6cba9
--- /dev/null
+++ b/lib/rss.php
@@ -0,0 +1,64 @@
+<?php
+/*
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+/*!
+ @function show_now_playingRSS
+ @discussion creates a RSS fead for the now
+ playing information
+*/
+function show_now_playingRSS () {
+
+ $dbh = dbh();
+ $web_path = conf('web_path');
+ $rss_main_title = conf('rss_main_title');
+ $rss_main_description = conf('rss_main_description');
+ $rss_main_copyright = conf('rss_main_copyright');
+ $rss_main_language = conf('rss_main_language');
+ $rss_song_description = conf('rss_song_description');
+
+ $sql = "SELECT * FROM now_playing ORDER BY start_time DESC";
+
+ $db_result = mysql_query($sql, $dbh);
+ $today = date("d-m-Y");
+
+ echo "<rss version=\"0.91\">";
+ echo "<channel>\n<title>$rss_main_title</title>\n";
+ echo "<link>$web_path</link>\n<description>$rss_main_description</description>\n";
+ echo "<copyright>$rss_main_copyright</copyright>";
+ echo "<pubDate>$today</pubDate>\n<language>$rss_main_language</language>\n";
+
+ while ($r = mysql_fetch_object($db_result)) {
+ $song = new Song($r->song_id);
+ $song->format_song();
+ $user = get_user_byid($r->user_id);
+ if (is_object($song)) {
+ $artist = $song->f_artist;
+ $album = $song->get_album_name();
+ $text = "$artist - $song->f_title";
+ echo "<item> ";
+ echo " <title><![CDATA[$text]]></title> ";
+ echo " <link>$web_path/albums.php?action=show&amp;album=$song->album</link>";
+ echo " <description>$rss_song_description</description>";
+ echo " <pubDate>$today</pubDate>";
+ echo "</item>";
+ }
+ }
+
+ echo "</channel>\n</rss>";
+} // show_now_playingRSS
+?>