summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/ChangeLog6
-rw-r--r--epg_events.cpp27
-rw-r--r--epg_events.h3
-rw-r--r--pages/content.ecpp9
-rw-r--r--pages/pageelems.ecpp27
-rw-r--r--setup.cpp17
-rw-r--r--setup.h3
-rw-r--r--tntconfig.cpp3
8 files changed, 71 insertions, 24 deletions
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 1eb4787..ade99b5 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,9 @@
+2007-07-20 Christian Wieninger <cwieninger at gmx dot de>
+ Added support for EPG images: Specify the directory with your
+ EPG images via the new commandline option '-e <dir>' or
+ '--epgimages=<dir> like
+ -P'live -e /video/epgimages'
+
2007-07-12 Dieter Hametner <dh+vdr at gekrumbel dot de>
Changed the javascript base of live. We now use the 'mootools'
diff --git a/epg_events.cpp b/epg_events.cpp
index 049e27f..89c1347 100644
--- a/epg_events.cpp
+++ b/epg_events.cpp
@@ -1,9 +1,11 @@
#include <time.h>
+#include <glob.h>
#include "tools.h"
#include "recordings.h"
#include "epg_events.h"
+#include "setup.h"
using namespace std;
@@ -275,4 +277,29 @@ namespace vdrlive
{
return EpgInfoPtr(new EpgString(id, caption, info));
}
+
+ list<string> EpgEvents::EpgImages(const std::string& epgid)
+ {
+ list<string> images;
+
+ size_t delimPos = epgid.find_last_of('_');
+ string imageId = epgid.substr(delimPos+1);
+ imageId = imageId.substr(0, imageId.size()-1); // tvm2vdr seems always to use one digit less
+
+ const string filemask(LiveSetup().GetEpgImageDir() + "/" + imageId + "*.*");
+ glob_t globbuf;
+ globbuf.gl_offs = 0;
+ if (!LiveSetup().GetEpgImageDir().empty() && glob(filemask.c_str(), GLOB_DOOFFS, NULL, &globbuf) == 0)
+ {
+ for(int i=0; i<(int)globbuf.gl_pathc; i++)
+ {
+ const string imagefile(globbuf.gl_pathv[i]);
+ size_t delimPos = imagefile.find_last_of('/');
+ images.push_back(imagefile.substr(delimPos+1));
+ }
+ globfree(&globbuf);
+ }
+ return images;
+ }
+
}; // namespace vdrlive
diff --git a/epg_events.h b/epg_events.h
index 8536463..f055045 100644
--- a/epg_events.h
+++ b/epg_events.h
@@ -2,6 +2,7 @@
#define VDR_LIVE_WHATS_ON_H
#include <ctime>
+#include <list>
#include <vdr/plugin.h>
#include <vdr/channels.h>
@@ -179,6 +180,8 @@ namespace vdrlive
* passed string informations
*/
static EpgInfoPtr CreateEpgInfo(const std::string& id, const std::string& caption, const std::string& info);
+
+ static std::list<std::string> EpgImages(const std::string& epgid);
private:
};
}; // namespace vdrlive
diff --git a/pages/content.ecpp b/pages/content.ecpp
index 1438790..f95dd4c 100644
--- a/pages/content.ecpp
+++ b/pages/content.ecpp
@@ -26,8 +26,15 @@ reply.setContentType(mime);
// FileCache::ptr_type f = LiveFileCache().get("/tmp/live/" + request.getPathInfo());
string path(request.getPathInfo());
-FileCache::ptr_type f = LiveFileCache().get(Plugin::GetConfigDirectory() + "/" + path);
+FileCache::ptr_type f;
+
+if (path.find(LiveSetup().GetEpgImageDir()) != 0)
+ f = LiveFileCache().get(Plugin::GetConfigDirectory() + "/" + path);
+else
+ f = LiveFileCache().get(path);
+
if (f.get() == 0) {
+cout << "declined" << endl;
return DECLINED;
}
string ctime = tnt::HttpMessage::htdate(f->ctime());
diff --git a/pages/pageelems.ecpp b/pages/pageelems.ecpp
index 6de3bfc..1116d51 100644
--- a/pages/pageelems.ecpp
+++ b/pages/pageelems.ecpp
@@ -8,6 +8,7 @@
#include "setup.h"
#include "timers.h"
#include "tools.h"
+#include "epg_events.h"
using namespace std;
using namespace vdrlive;
@@ -34,25 +35,12 @@ int update_status(1);
<# ---------------------------------------------------------------------- #>
<%def logo>
-<%cpp>
- if (LiveSetup().GetShowLogo()
- || (LiveSetup().GetUseAjax() && LiveSetup().GetShowInfoBox())) {
-</%cpp>
<div class="page_header">
-<%cpp>
- if (LiveSetup().GetShowLogo()) {
-</%cpp>
<a href="<$ LiveSetup().GetStartScreenLink()$>">
<img src="<$ LiveSetup().GetThemedLink("img", "logo.png") $>" alt="VDR Live!" class="logo"></img></a>
-<%cpp>
- }
-</%cpp>
-<%cpp>if (LiveSetup().GetUseAjax() && LiveSetup().GetShowInfoBox()) { </%cpp><& infobox &><%cpp> } </%cpp>
+<%cpp>if (LiveSetup().GetShowInfoBox()) { </%cpp><& infobox &><%cpp> } </%cpp>
</div>
<div style="clear: both"></div>
-<%cpp>
- }
-</%cpp>
</%def>
<# ---------------------------------------------------------------------- #>
@@ -136,7 +124,6 @@ int update_status(1);
<# ---------------------------------------------------------------------- #>
<%def ajax_js>
-<%cpp>if (LiveSetup().GetUseAjax()) { </%cpp>
<script type="text/javascript" src="js/mootools/mootools.v1.11.js"></script>
<script type="text/javascript" src="js/live/liveajax.js"></script>
<script type="text/javascript" src="js/live/infowin.js"></script>
@@ -153,7 +140,6 @@ int update_status(1);
});
--></script>
<%cpp> } </%cpp>
-<%cpp> } </%cpp>
</%def>
<# ---------------------------------------------------------------------- #>
@@ -202,6 +188,15 @@ int update_status(1);
<div class="description">
<%cpp> reply.out() << StringEscapeAndBreak(long_descr); </%cpp>
</div>
+ <br/>
+ <div>
+<%cpp> list<string> images = EpgEvents::EpgImages(boxId);
+ for(std::list<std::string>::iterator it = images.begin(); it != images.end(); ++it ) {
+</%cpp>
+ <img src="/epgimages/<$ *it $>">
+<%cpp> }
+</%cpp>
+ </div>
</div>
</div>
</div>
diff --git a/setup.cpp b/setup.cpp
index 930a111..5565ddd 100644
--- a/setup.cpp
+++ b/setup.cpp
@@ -44,15 +44,17 @@ bool Setup::ParseCommandLine( int argc, char* argv[] )
{ "port", required_argument, NULL, 'p' },
{ "ip", required_argument, NULL, 'i' },
{ "log", required_argument, NULL, 'l' },
+ { "epgimages", required_argument, NULL, 'e' },
{ 0 }
};
int optchar, optind = 0;
- while ( ( optchar = getopt_long( argc, argv, "p:i:l:", opts, &optind ) ) != -1 ) {
+ while ( ( optchar = getopt_long( argc, argv, "p:i:l:e:", opts, &optind ) ) != -1 ) {
switch ( optchar ) {
case 'p': m_serverPort = atoi( optarg ); break;
case 'i': m_serverIps.push_back( optarg ); break;
case 'l': m_tntnetloglevel = optarg; break;
+ case 'e': m_epgimagedir = optarg; break;
default: return false;
}
}
@@ -65,12 +67,13 @@ char const* Setup::CommandLineHelp() const
{
if ( m_helpString.empty() ) {
ostringstream builder;
- builder << " -p PORT, --port=PORT use PORT to listen for incoming connections\n"
- " (default: " << m_serverPort << ")\n"
- << " -i IP, --ip=IP bind server only to specified IP, may appear\n"
- " multiple times\n"
- " (default: 0.0.0.0)\n"
- << " -l level, --log=level log level for tntnet (values: INFO, DEBUG,...)\n";
+ builder << " -p PORT, --port=PORT use PORT to listen for incoming connections\n"
+ " (default: " << m_serverPort << ")\n"
+ << " -i IP, --ip=IP bind server only to specified IP, may appear\n"
+ " multiple times\n"
+ " (default: 0.0.0.0)\n"
+ << " -l level, --log=level log level for tntnet (values: INFO, DEBUG,...)\n"
+ << " -e <dir>, --epgimages=<dir> directory for epgimages\n";
m_helpString = builder.str();
}
return m_helpString.c_str();
diff --git a/setup.h b/setup.h
index 2ac7f06..73d825c 100644
--- a/setup.h
+++ b/setup.h
@@ -48,6 +48,7 @@ class Setup
bool GetShowLogo() const { return m_showLogo != 0; }
bool GetUseAjax() const { return m_useAjax != 0; }
bool GetShowInfoBox() const { return m_showInfoBox != 0; }
+ std::string GetEpgImageDir() { return m_epgimagedir; }
void SetLastChannel(int lastChannel) { m_lastChannel = lastChannel; }
void SetAdminLogin(std::string login) { m_adminLogin = login; }
@@ -85,6 +86,8 @@ class Setup
// commandline options
int m_serverPort;
IpList m_serverIps;
+ std::string m_epgimagedir;
+
// setup options
int m_lastChannel;
int m_screenshotInterval;
diff --git a/tntconfig.cpp b/tntconfig.cpp
index 1094b8a..286ada7 100644
--- a/tntconfig.cpp
+++ b/tntconfig.cpp
@@ -49,6 +49,9 @@ void TntConfig::WriteConfig()
file << "MapUrl ^/themes/([^/]*)/img.*/(.+)\\.(.+) content@ common/img/$2.$3 image/$3" << endl;
file << "MapUrl ^/themes/([^/]*)/img.*/(.+)\\.(.+) $2@" << endl;
+ // Epg images
+ file << "MapUrl ^/epgimages/(.*)\\.(.+) content@ " << LiveSetup().GetEpgImageDir() << "/$1.$2 image/$2" << endl;
+
// select additional (not build in) javascript.
file << "MapUrl ^/js([^.]*/)(.*\\.js) content@ js$1$2 text/javascript" << endl;