diff options
author | Christian Wieninger <cwieninger (at) gmx (dot) de> | 2008-10-21 22:44:45 +0200 |
---|---|---|
committer | Christian Wieninger <cwieninger (at) gmx (dot) de> | 2008-10-21 22:44:45 +0200 |
commit | 73393d5bde0f6a3c1ee3b855d7535d7e688c2287 (patch) | |
tree | 1816508a7a12b08360a3510a11be5922253728a8 | |
parent | 8f23e11f853946651c8821d02b014d861b6c0986 (diff) | |
download | vdr-plugin-live-73393d5bde0f6a3c1ee3b855d7535d7e688c2287.tar.gz vdr-plugin-live-73393d5bde0f6a3c1ee3b855d7535d7e688c2287.tar.bz2 |
some fixes for the directory entry within the edit timer menu, requires
epgsearch-0.9.25.beta6
-rw-r--r-- | doc/ChangeLog | 6 | ||||
-rw-r--r-- | epgsearch.cpp | 33 | ||||
-rw-r--r-- | epgsearch.h | 8 | ||||
-rw-r--r-- | epgsearch/services.h | 20 | ||||
-rw-r--r-- | livefeatures.h | 2 | ||||
-rw-r--r-- | pages/edit_timer.ecpp | 15 |
6 files changed, 68 insertions, 16 deletions
diff --git a/doc/ChangeLog b/doc/ChangeLog index c92167a..1f9b3f4 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,9 @@ +2008-10-21 Christian Wieninger <cwieninger at gmx dot de> + * edit_timer.ecpp: new menu entry to select a recording directory. + requires epgsearch plugin. + * epgsearch.h/cpp: read the directory list via epgsearch's + service interface version 1.2 + 2008-08-04 Christian Wieninger <cwieninger at gmx dot de> * italian translation update, thanks to Diego Pierotto diff --git a/epgsearch.cpp b/epgsearch.cpp index de0d63b..352a3f0 100644 --- a/epgsearch.cpp +++ b/epgsearch.cpp @@ -614,13 +614,24 @@ std::string SearchResults::PopQuery(std::string const& md5) return query; } -RecordingDirs::RecordingDirs() +RecordingDirs::RecordingDirs(bool shortList) { - Epgsearch_services_v1_0 service; - if ( !CheckEpgsearchVersion() || cPluginManager::CallFirstService(ServiceInterface, &service) == 0 ) - throw HtmlError( tr("EPGSearch version outdated! Please update.") ); - - m_set = service.handler->DirectoryList(); + if (shortList) + { + Epgsearch_services_v1_2 service; + if ( !CheckEpgsearchVersion() || cPluginManager::CallFirstService(ServiceInterface, &service) == 0 ) + throw HtmlError( tr("EPGSearch version outdated! Please update.") ); + + m_set = service.handler->ShortDirectoryList(); + } + else + { + Epgsearch_services_v1_0 service; + if ( !CheckEpgsearchVersion() || cPluginManager::CallFirstService(ServiceInterface, &service) == 0 ) + throw HtmlError( tr("EPGSearch version outdated! Please update.") ); + + m_set = service.handler->DirectoryList(); + } } std::string EPGSearchSetupValues::ReadValue(const std::string& entry) @@ -641,4 +652,14 @@ bool EPGSearchSetupValues::WriteValue(const std::string& entry, const std::strin return service.handler->WriteSetupValue(entry, value); } +std::string EPGSearchExpr::EvaluateExpr(const std::string& expr, const cEvent* event) +{ + Epgsearch_services_v1_2 service; + if ( !CheckEpgsearchVersion() || cPluginManager::CallFirstService(ServiceInterface, &service) == 0 ) + throw HtmlError( tr("EPGSearch version outdated! Please update.") ); + + return service.handler->Evaluate(expr, event); +} + + } // namespace vdrlive diff --git a/epgsearch.h b/epgsearch.h index 39ee564..6cb3cec 100644 --- a/epgsearch.h +++ b/epgsearch.h @@ -393,7 +393,7 @@ public: typedef recordingdirs::iterator iterator; typedef recordingdirs::const_iterator const_iterator; - RecordingDirs(); + RecordingDirs(bool shortList=false); iterator begin() { return m_set.begin(); } const_iterator begin() const { return m_set.begin(); } @@ -411,6 +411,12 @@ public: static bool WriteValue(const std::string& entry, const std::string& value); }; +class EPGSearchExpr +{ +public: + static std::string EvaluateExpr(const std::string& expr, const cEvent* event); +}; + } // namespace vdrlive diff --git a/epgsearch/services.h b/epgsearch/services.h index 91b1d5b..35cca9b 100644 --- a/epgsearch/services.h +++ b/epgsearch/services.h @@ -1,5 +1,5 @@ /* -Copyright (C) 2004-2007 Christian Wieninger +Copyright (C) 2004-2008 Christian Wieninger This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -160,7 +160,7 @@ struct Epgsearch_services_v1_0 std::auto_ptr<cServiceHandler> handler; }; -// Data structures for service "Epgsearch-services-v1.0" +// Data structures for service "Epgsearch-services-v1.1" class cServiceHandler_v1_1 : public cServiceHandler { public: @@ -176,4 +176,20 @@ struct Epgsearch_services_v1_1 std::auto_ptr<cServiceHandler_v1_1> handler; }; +// Data structures for service "Epgsearch-services-v1.2" +class cServiceHandler_v1_2 : public cServiceHandler_v1_1 +{ + public: + // List of all recording directories used in recordings, timers (and optionally search timers or in epgsearchdirs.conf) + virtual std::set<std::string> ShortDirectoryList() = 0; + // Evaluate an expression against an event + virtual std::string Evaluate(const std::string& expr, const cEvent* event) = 0; +}; + +struct Epgsearch_services_v1_2 +{ +// in/out + std::auto_ptr<cServiceHandler_v1_2> handler; +}; + #endif diff --git a/livefeatures.h b/livefeatures.h index bef2b1a..2f246cc 100644 --- a/livefeatures.h +++ b/livefeatures.h @@ -60,7 +60,7 @@ namespace features struct epgsearch { static const char* Plugin() { return "epgsearch"; } - static const char* MinVersion() { return "0.9.24.beta20"; } + static const char* MinVersion() { return "0.9.25.beta6"; } }; struct streamdev_server diff --git a/pages/edit_timer.ecpp b/pages/edit_timer.ecpp index bd74801..47a6766 100644 --- a/pages/edit_timer.ecpp +++ b/pages/edit_timer.ecpp @@ -131,7 +131,7 @@ cTimer* timer; title = timer->File() ? timer->File() : ""; if ( LiveFeatures< features::epgsearch >().Recent() ) { vector< string > directories = StringSplit( title, '~' ); - if (directories.size() > 0) + if (directories.size() > 1) { directory = directories[0]; title = title.substr(directory.size()+1); @@ -212,18 +212,21 @@ cTimer* timer; </tr> <%cpp> if ( LiveFeatures< features::epgsearch >().Recent() ) { - RecordingDirs recordingdirs; + RecordingDirs recordingdirs(true); </%cpp> <tr> <td class="label leftcol"><div class="withmargin"><$ tr("Directory" ) $>:</div></td> - <td class="rightcol"><select onchange="changeddirselection(this)" name="directory" size="1" id="directory" style="margin-top: 5px"> + <td class="rightcol"><select name="directory" size="1" id="directory" style="margin-top: 5px"> <option/> -% for (RecordingDirs::iterator rdir = recordingdirs.begin(); rdir != recordingdirs.end(); ++rdir) { - <option value="<$ *rdir $>" +<%cpp> + for (RecordingDirs::iterator rdir = recordingdirs.begin(); rdir != recordingdirs.end(); ++rdir) { + std::string dir = *rdir; +</%cpp> + <option value="<$ dir $>" % if (*rdir == directory) { selected="selected" % } - ><$ *rdir $></option> + ><$ dir $></option> % } </select> </td> |