diff options
author | Frank Schmirler <vdr@schmirler.de> | 2013-02-03 12:40:46 +0100 |
---|---|---|
committer | Frank Schmirler <vdr@schmirler.de> | 2013-02-03 12:40:46 +0100 |
commit | f58086a83acb6801372985bf98980a35ae960be7 (patch) | |
tree | 209422e9bb0521e4fff5b232fa132863b3706493 /server | |
parent | d3dd72072c88c83271aae98f5f1a695f802feefa (diff) | |
download | vdr-plugin-streamdev-f58086a83acb6801372985bf98980a35ae960be7.tar.gz vdr-plugin-streamdev-f58086a83acb6801372985bf98980a35ae960be7.tar.bz2 |
Added simple recordings menu in HTTP server
Diffstat (limited to 'server')
-rw-r--r-- | server/connectionHTTP.c | 2 | ||||
-rw-r--r-- | server/menuHTTP.c | 34 | ||||
-rw-r--r-- | server/menuHTTP.h | 20 |
3 files changed, 54 insertions, 2 deletions
diff --git a/server/connectionHTTP.c b/server/connectionHTTP.c index a8a8c8f..ec10824 100644 --- a/server/connectionHTTP.c +++ b/server/connectionHTTP.c @@ -408,6 +408,8 @@ cMenuList* cConnectionHTTP::MenuListFromString(const std::string& Path, const st } else if (Filebase.compare("all") == 0 || (Filebase.empty() && Fileext.empty())) { iterator = new cListAll(); + } else if (Filebase.compare("recordings") == 0) { + iterator = new cRecordingsIterator(); } if (iterator) { diff --git a/server/menuHTTP.c b/server/menuHTTP.c index ca44579..de46f00 100644 --- a/server/menuHTTP.c +++ b/server/menuHTTP.c @@ -1,6 +1,37 @@ +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> + #include <vdr/channels.h> #include "server/menuHTTP.h" +//**************************** cRecordingIterator ************** +cRecordingsIterator::cRecordingsIterator(): RecordingsLock(&Recordings) +{ + first = Recordings.First(); + current = NULL; +} + +bool cRecordingsIterator::Next() +{ + if (first) + { + current = first; + first = NULL; + } + else + current = Recordings.Next(current); + return current; +} + +const cString cRecordingsIterator::ItemRessource() const +{ + struct stat st; + if (stat(current->FileName(), &st) == 0) + return cString::sprintf("%lu:%lu.rec", st.st_dev, st.st_ino); + return ""; +} + //**************************** cChannelIterator ************** cChannelIterator::cChannelIterator(const cChannel *First) { @@ -144,7 +175,8 @@ const char* cHtmlMenuList::menu = "[<a href=\"/\">Home</a> (<a href=\"all.html\" tvid=\"RED\">no script</a>)] " "[<a href=\"tree.html\" tvid=\"GREEN\">Tree View</a>] " "[<a href=\"groups.html\" tvid=\"YELLOW\">Groups</a> (<a href=\"groups.m3u\">Playlist</a> | <a href=\"groups.rss\">RSS</a>)] " - "[<a href=\"channels.html\" tvid=\"BLUE\">Channels</a> (<a href=\"channels.m3u\">Playlist</a> | <a href=\"channels.rss\">RSS</a>)] "; + "[<a href=\"channels.html\" tvid=\"BLUE\">Channels</a> (<a href=\"channels.m3u\">Playlist</a> | <a href=\"channels.rss\">RSS</a>)] " + "[<a href=\"recordings.html\">Recordings</a> (<a href=\"recordings.m3u\">Playlist</a> | <a href=\"recordings.rss\">RSS</a>)] "; const char* cHtmlMenuList::css = "<style type=\"text/css\">\n" diff --git a/server/menuHTTP.h b/server/menuHTTP.h index ec759e9..e6141e0 100644 --- a/server/menuHTTP.h +++ b/server/menuHTTP.h @@ -3,6 +3,7 @@ #include <string> #include "../common.h" +#include <vdr/recording.h> class cChannel; @@ -19,6 +20,24 @@ class cItemIterator virtual const char* Dlang(int i) const = 0; }; +class cRecordingsIterator: public cItemIterator +{ + private: + const cRecording *first; + const cRecording *current; + cThreadLock RecordingsLock; + public: + virtual bool Next(); + virtual bool IsGroup() const { return false; } + virtual const cString ItemId() const { return current ? itoa(current->Index() + 1) : "0"; } + virtual const char* ItemTitle() const { return current ? current->Title() : ""; } + virtual const cString ItemRessource() const; + virtual const char* Alang(int i) const { return NULL; } + virtual const char* Dlang(int i) const { return NULL; } + cRecordingsIterator(); + virtual ~cRecordingsIterator() {}; +}; + class cChannelIterator: public cItemIterator { private: @@ -30,7 +49,6 @@ class cChannelIterator: public cItemIterator // Helper which returns the group by its index static const cChannel* GetGroup(const char* GroupId); public: - virtual bool Next(); virtual bool IsGroup() const { return current && current->GroupSep(); } virtual const cString ItemId() const; |