Added simple recordings menu in HTTP server

This commit is contained in:
Frank Schmirler 2013-02-03 12:40:46 +01:00
parent d3dd72072c
commit f58086a83a
4 changed files with 55 additions and 2 deletions

View File

@ -1,6 +1,7 @@
VDR Plugin 'streamdev' Revision History
---------------------------------------
- Added simple recordings menu in HTTP server
- Restructured menuHTTP classes
- Added RSS format for HTTP menus
- Recordings can now also be selected by struct stat "st_dev:st_ino.rec"

View File

@ -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) {

View File

@ -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"

View File

@ -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;