summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--i18n.cpp44
-rw-r--r--livefeatures.cpp35
-rw-r--r--livefeatures.h70
-rw-r--r--pages/pageelems.ecpp23
5 files changed, 160 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index 981e52d..b26662b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
#
# Makefile for a Video Disk Recorder plugin
#
-# $Id: Makefile,v 1.40 2007/06/01 13:48:21 lordjaxom Exp $
+# $Id: Makefile,v 1.41 2007/06/01 19:57:29 lordjaxom Exp $
# The official name of this plugin.
# This name will be used in the '-P...' option of VDR to load the plugin.
@@ -63,7 +63,7 @@ SUBDIRS = httpd pages css images javascript
PLUGINOBJS = $(PLUGIN).o thread.o tntconfig.o setup.o i18n.o timers.o \
tools.o recordings.o tasks.o status.o epg_events.o epgsearch.o \
- grab.o md5.o filecache.o
+ grab.o md5.o filecache.o livefeatures.o
WEBLIBS = pages/libpages.a css/libcss.a images/libimages.a \
javascript/libjavascript.a
diff --git a/i18n.cpp b/i18n.cpp
index 4457f74..c98a363 100644
--- a/i18n.cpp
+++ b/i18n.cpp
@@ -4055,6 +4055,50 @@ const tI18nPhrase Phrases[] = {
"", // Dansk
"", // Czech
},
+ { "active", // English
+ "aktiv", // Deutsch
+ "", // Slovenski
+ "", // Italiano
+ "", // Nederlands
+ "", // Português
+ "", // Français
+ "", // Norsk
+ "", // Finnish
+ "", // Polski
+ "", // Español
+ "", // Greek
+ "", // Svenska
+ "", // Românã
+ "", // Magyar
+ "", // Català
+ "", // Russian
+ "", // Hrvatski
+ "", // Eesti
+ "", // Dansk
+ "", // Czech
+ },
+ { "required", // English
+ "erforderlich", // Deutsch
+ "", // Slovenski
+ "", // Italiano
+ "", // Nederlands
+ "", // Português
+ "", // Français
+ "", // Norsk
+ "", // Finnish
+ "", // Polski
+ "", // Español
+ "", // Greek
+ "", // Svenska
+ "", // Românã
+ "", // Magyar
+ "", // Català
+ "", // Russian
+ "", // Hrvatski
+ "", // Eesti
+ "", // Dansk
+ "", // Czech
+ },
/*
{ "", // English
"", // Deutsch
diff --git a/livefeatures.cpp b/livefeatures.cpp
new file mode 100644
index 0000000..385430f
--- /dev/null
+++ b/livefeatures.cpp
@@ -0,0 +1,35 @@
+#include "livefeatures.h"
+#include "tools.h"
+
+namespace vdrlive {
+
+using namespace std;
+
+SplitVersion::SplitVersion( string version )
+ : m_version( 0 )
+{
+ static const int factors[] = { 100000000, 1000000, 1000, 1 };
+
+ size_t pos = version.find('-');
+ if ( pos != string::npos ) {
+ m_suffix = version.substr( pos + 1 );
+ version.erase( pos );
+ }
+ vector< string > parts = StringSplit( version, '.' );
+ for ( size_t i = 0; i < parts.size() && i < sizeof(factors)/sizeof(factors[0]); ++i ) {
+ m_version += atoi( parts[ i ].c_str() ) * factors[ i ];
+ }
+}
+
+bool SplitVersion::operator<( const SplitVersion& right ) const
+{
+ dsyslog( "vdrlive::SplitVersion::operator<( %d-%s, %d-%s )", m_version, m_suffix.c_str(), right.m_version, right.m_suffix.c_str() );
+ if ( m_version == right.m_version ) {
+ if ( m_suffix.empty() ) return false;
+ if ( right.m_suffix.empty() ) return true;
+ return m_suffix < right.m_suffix;
+ }
+ return m_version < right.m_version;
+}
+
+} // namespace vdrlive
diff --git a/livefeatures.h b/livefeatures.h
new file mode 100644
index 0000000..a94cc90
--- /dev/null
+++ b/livefeatures.h
@@ -0,0 +1,70 @@
+#ifndef VDR_LIVE_FEATURES_H
+#define VDR_LIVE_FEATURES_H
+
+#include <string>
+#include <vdr/plugin.h>
+
+namespace vdrlive {
+
+//LiveFeatures<EpgsearchFeature>().Available();
+
+class SplitVersion
+{
+public:
+ explicit SplitVersion( std::string version );
+
+ bool operator<( const SplitVersion& right ) const;
+
+private:
+ int m_version;
+ std::string m_suffix;
+};
+
+template< typename Feat >
+class Features;
+
+template< typename Feat >
+Features< Feat >& LiveFeatures();
+
+template< typename Feat >
+class Features
+{
+ friend Features< Feat >& LiveFeatures<>();
+
+public:
+ bool Loaded() const { return m_plugin != 0; }
+ bool Recent() const { return !(m_version < m_minVersion); }
+ char const* Version() const { return m_plugin ? m_plugin->Version() : ""; }
+ char const* MinVersion() const { return Feat::MinVersion(); }
+
+private:
+ cPlugin* m_plugin;
+ SplitVersion m_version;
+ SplitVersion m_minVersion;
+
+ Features()
+ : m_plugin( cPluginManager::GetPlugin( Feat::Plugin() ) )
+ , m_version( Version() )
+ , m_minVersion( Feat::MinVersion() ) {}
+};
+
+template< typename Feat >
+Features< Feat >& LiveFeatures()
+{
+ static Features< Feat > instance;
+ return instance;
+}
+
+namespace features
+{
+ struct epgsearch
+ {
+ static const char* Plugin() { return "epgsearch"; }
+ static const char* MinVersion() { return "0.9.22"; }
+ };
+
+} // namespace features
+
+} // namespace vdrlive
+
+#endif // VDR_LIVE_FEATURES_H
diff --git a/pages/pageelems.ecpp b/pages/pageelems.ecpp
index 6e03ca8..928e7b5 100644
--- a/pages/pageelems.ecpp
+++ b/pages/pageelems.ecpp
@@ -2,8 +2,8 @@
#include <string>
#include <vdr/menu.h>
#include <vdr/epg.h>
-#include "epgsearch.h"
#include "exception.h"
+#include "livefeatures.h"
#include "i18n.h"
#include "setup.h"
#include "timers.h"
@@ -12,16 +12,6 @@
using namespace std;
using namespace vdrlive;
-static bool HasEpgsearch()
-{
- bool result = false;
- try {
- result = CheckEpgsearchVersion();
- } catch (HtmlError const& ex) {
- }
- return result;
-}
-
</%pre>
<# ---------------------------------------------------------------------- #>
@@ -213,10 +203,15 @@ static bool HasEpgsearch()
<div class="about_left"><$ tr("Features") $>:</div>
<div class="about_right">
<{
- bool hasEpgsearch = HasEpgsearch();
- string epgsearchVersion = hasEpgsearch ? string( cPluginManager::GetPlugin("epgsearch")->Version() ) + " " : "";
+ Features< features::epgsearch >& epgsearch = LiveFeatures< features::epgsearch >();
}>
- <img align="center" src="<$ hasEpgsearch ? "" : "in" $>active.png"/> EPGsearch <$ epgsearchVersion $>(<a href="http://winni.vdr-developer.org/epgsearch/index.html" target="_blank"><$ tr("Homepage") $></a>)<br/>
+ <img align="center" src="<$ epgsearch.Recent() ? "" : "in" $>active.png"/> EPGsearch
+% if ( epgsearch.Recent() ) {
+ (<$ tr("active") $>: <$ epgsearch.Version() $>)
+% } else {
+ (<$ tr("required") $>: <$ epgsearch.MinVersion() $>)
+% }
+ (<a href="http://winni.vdr-developer.org/epgsearch/index.html" target="_blank"><$ tr("Homepage") $></a>)<br/>
</div>
<div class="about_head"><div><div><$ tr("Bugs and suggestions") $></div></div></div>
<div class="about_line"><$ tr("If you encounter any bugs or would like to suggest new features, please use our bugtracker") $>:<br/>