From 9bbb74b7fd15cecd3256ce9035b3c2505baded5c Mon Sep 17 00:00:00 2001 From: Frank Schmirler Date: Sat, 2 Feb 2013 23:28:55 +0100 Subject: [PATCH] Added RSS format for HTTP menus --- HISTORY | 1 + server/connectionHTTP.c | 34 +++++++++++++------- server/menuHTTP.c | 70 ++++++++++++++++++++++++++++++++++++++--- server/menuHTTP.h | 20 +++++++++++- 4 files changed, 109 insertions(+), 16 deletions(-) diff --git a/HISTORY b/HISTORY index 830df27..8ffced2 100644 --- a/HISTORY +++ b/HISTORY @@ -1,6 +1,7 @@ VDR Plugin 'streamdev' Revision History --------------------------------------- +- Added RSS format for HTTP menus - Recordings can now also be selected by struct stat "st_dev:st_ino.rec" - Implemented multi-device support for streamdev client (suggested by johns) - Basic support for HTTP streaming of recordings diff --git a/server/connectionHTTP.c b/server/connectionHTTP.c index 48febe7..940517b 100644 --- a/server/connectionHTTP.c +++ b/server/connectionHTTP.c @@ -417,23 +417,35 @@ cChannelList* cConnectionHTTP::ChannelListFromString(const std::string& Path, co } if (iterator) { + // assemble base url: http://host/path/ + std::string base; + const static std::string HOST("HTTP_HOST"); + tStrStrMap::const_iterator it = Headers().find(HOST); + if (it != Headers().end()) + base = "http://" + it->second + "/"; + else + base = (std::string) "http://" + LocalIp() + ":" + + (const char*) itoa(StreamdevServerSetup.HTTPServerPort) + "/"; + base += Path; + if (Filebase.empty() || Fileext.compare(".htm") == 0 || Fileext.compare(".html") == 0) { std::string self = Filebase + Fileext; + std::string rss = Filebase + ".rss"; tStrStrMap::const_iterator it = Headers().find("QUERY_STRING"); - if (it != Headers().end() && !it->second.empty()) + if (it != Headers().end() && !it->second.empty()) { self += '?' + it->second; - return new cHtmlChannelList(iterator, m_StreamType, self.c_str(), groupTarget.c_str()); + rss += '?' + it->second; + } + return new cHtmlChannelList(iterator, m_StreamType, self.c_str(), rss.c_str(), groupTarget.c_str()); } else if (Fileext.compare(".m3u") == 0) { - std::string base; - const static std::string HOST("HTTP_HOST"); - tStrStrMap::const_iterator it = Headers().find(HOST); - if (it != Headers().end()) - base = "http://" + it->second + "/"; - else - base = (std::string) "http://" + LocalIp() + ":" + - (const char*) itoa(StreamdevServerSetup.HTTPServerPort) + "/"; - base += Path; return new cM3uChannelList(iterator, base.c_str()); + } else if (Fileext.compare(".rss") == 0) { + std::string html = Filebase + ".html"; + tStrStrMap::const_iterator it = Headers().find("QUERY_STRING"); + if (it != Headers().end() && !it->second.empty()) { + html += '?' + it->second; + } + return new cRssChannelList(iterator, base.c_str(), html.c_str()); } else { delete iterator; } diff --git a/server/menuHTTP.c b/server/menuHTTP.c index d7fb817..7839527 100644 --- a/server/menuHTTP.c +++ b/server/menuHTTP.c @@ -119,8 +119,8 @@ const cChannel* cChannelList::GetGroup(int Index) const char* cHtmlChannelList::menu = "[Home (no script)] " "[Tree View] " - "[Groups (Playlist)] " - "[Channels (Playlist)] "; + "[Groups (Playlist | RSS)] " + "[Channels (Playlist | RSS)] "; const char* cHtmlChannelList::css = "