diff options
author | bju <bju@maxi.fritz.box> | 2014-01-11 05:03:11 +0100 |
---|---|---|
committer | bju <bju@maxi.fritz.box> | 2014-01-11 05:03:11 +0100 |
commit | 2676b99b3a7cae3ea8ebe827ac20684a90a84d07 (patch) | |
tree | f9fe3565bba7a77f7e75535ca6516bfd01438aa8 /vdr-vdrmanager | |
parent | f8ef6e8fbb2865ce53e3deee6015bef97c6125a1 (diff) | |
download | vdr-manager-2676b99b3a7cae3ea8ebe827ac20684a90a84d07.tar.gz vdr-manager-2676b99b3a7cae3ea8ebe827ac20684a90a84d07.tar.bz2 |
http://projects.vdr-developer.org/issues/1674 (mark conflicting timers in list)
Diffstat (limited to 'vdr-vdrmanager')
-rw-r--r-- | vdr-vdrmanager/.cproject | 19 | ||||
-rw-r--r-- | vdr-vdrmanager/helpers.cpp | 78 | ||||
-rw-r--r-- | vdr-vdrmanager/helpers.h | 7 |
3 files changed, 96 insertions, 8 deletions
diff --git a/vdr-vdrmanager/.cproject b/vdr-vdrmanager/.cproject index ea9fb6f..27812e3 100644 --- a/vdr-vdrmanager/.cproject +++ b/vdr-vdrmanager/.cproject @@ -24,10 +24,22 @@ <option id="gnu.cpp.compiler.option.include.paths.1164198959" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath"> <listOptionValue builtIn="false" value="/usr/lib64/oracle/11.2.0.2/client/include"/> <listOptionValue builtIn="false" value="/usr/include/vdr"/> + <listOptionValue builtIn="false" value="/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/include"/> + <listOptionValue builtIn="false" value="/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/include-fixed"/> + <listOptionValue builtIn="false" value="/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/include/g++-v4"/> + <listOptionValue builtIn="false" value="/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/include/g++-v4/x86_64-pc-linux-gnu"/> + <listOptionValue builtIn="false" value="/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/include/g++-v4/backward"/> </option> <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.938487798" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/> </tool> <tool id="cdt.managedbuild.tool.gnu.c.compiler.base.2050235224" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.base"> + <option id="gnu.c.compiler.option.include.paths.1088145882" superClass="gnu.c.compiler.option.include.paths" valueType="includePath"> + <listOptionValue builtIn="false" value="/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/include"/> + <listOptionValue builtIn="false" value="/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/include-fixed"/> + <listOptionValue builtIn="false" value="/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/include/g++-v4"/> + <listOptionValue builtIn="false" value="/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/include/g++-v4/x86_64-pc-linux-gnu"/> + <listOptionValue builtIn="false" value="/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/include/g++-v4/backward"/> + </option> <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.2005963507" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> </tool> <tool id="cdt.managedbuild.tool.gnu.c.linker.base.410295810" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.base"/> @@ -38,6 +50,13 @@ </inputType> </tool> <tool id="cdt.managedbuild.tool.gnu.assembler.base.1996757503" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.base"> + <option id="gnu.both.asm.option.include.paths.644695978" superClass="gnu.both.asm.option.include.paths" valueType="includePath"> + <listOptionValue builtIn="false" value="/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/include"/> + <listOptionValue builtIn="false" value="/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/include-fixed"/> + <listOptionValue builtIn="false" value="/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/include/g++-v4"/> + <listOptionValue builtIn="false" value="/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/include/g++-v4/x86_64-pc-linux-gnu"/> + <listOptionValue builtIn="false" value="/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/include/g++-v4/backward"/> + </option> <inputType id="cdt.managedbuild.tool.gnu.assembler.input.324509035" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> </tool> </toolChain> diff --git a/vdr-vdrmanager/helpers.cpp b/vdr-vdrmanager/helpers.cpp index 57dab9b..108ca85 100644 --- a/vdr-vdrmanager/helpers.cpp +++ b/vdr-vdrmanager/helpers.cpp @@ -18,18 +18,21 @@ #include <vdr/cutter.h> #include <vdr/sources.h> #include <fstream> +#include "epgsearch/services.h" #define TIMER_SEP "#|#|#" // Taken from vdr-ive #define INDEXFILESUFFIX "/index.vdr" #define LENGTHFILESUFFIX "/length.vdr" +static char ServiceInterface[] = "Epgsearch-services-v1.1"; + string cHelpers::GetRecordings(string args) { return SafeCall(GetRecordingsIntern); } string cHelpers::GetTimers(string args) { - return SafeCall(GetTimersIntern); + return SafeCall(GetTimersIntern, args); } string cHelpers::GetChannels(string args) { @@ -86,13 +89,22 @@ string cHelpers::SearchEvents(string args) { return SafeCall(SearchEventsIntern, Trim(wantedChannels), Trim(pattern)); } -string cHelpers::GetTimersIntern() { +string cHelpers::GetTimersIntern(string options) { + + // timer conflicts wanted? + set<string> conflicts; + if (options.find("conflicts") != string::npos) { + conflicts = GetTimerConflicts(); + if (conflicts.empty()) { + conflicts.insert(""); + } + } string result = "START\r\n"; // iterate through all timers for (cTimer * timer = Timers.First(); timer; timer = Timers.Next(timer)) { - result += ToText(timer); + result += ToText(timer, conflicts); } return result + "END\r\n"; @@ -740,7 +752,7 @@ string cHelpers::ToText(cRecording * recording) { return result; } -string cHelpers::ToText(cTimer * timer) { +string cHelpers::ToText(cTimer * timer, set<string> conflicts) { const cChannel * channel = timer->Channel(); const char * channelName = channel->Name(); @@ -835,6 +847,16 @@ string cHelpers::ToText(cTimer * timer) { result += ConvertWeekdays(timer->WeekDays()); + if (!conflicts.empty()) { + ostringstream index; + index << timer->Index()+1; + if (conflicts.find(index.str()) != conflicts.end()) { + result += ":1"; + } else { + result += ":0"; + } + } + result += "\r\n"; return result; @@ -900,7 +922,7 @@ string cHelpers::ToText(const cEvent * event) { result += "\r\n"; if (eventTimer) { - result += ToText(eventTimer); + result += ToText(eventTimer, set<string>()); } return result; @@ -1178,3 +1200,49 @@ int cHelpers::ConvertWeekdays(std::string v) { res += 1; return res; } + +set<string> cHelpers::GetTimerConflicts() { + + Epgsearch_services_v1_1 service; + set<string> timers; + if (cPluginManager::CallFirstService(ServiceInterface, &service)) { + cServiceHandler_v1_1* handler = dynamic_cast<cServiceHandler_v1_1*>(service.handler.get()); + if (handler) { + list< string > conflicts = service.handler->TimerConflictList(); + for (list<string>::iterator it = conflicts.begin(); it != conflicts.end(); it++) { + string line = *it; + size_t sep = line.find(':'); + line = line.substr(sep+1); + + while (!line.empty()) { + sep = line.find(':'); + string conflict; + if (sep == string::npos) { + conflict = line; + line = ""; + } else { + conflict = line.substr(0, sep); + line = line.substr(sep+1); + } + + sep = conflict.rfind('|'); + conflict = conflict.substr(sep+1); + while(!conflict.empty()) { + sep = conflict.find('#'); + string timer; + if (sep == string::npos) { + timer = conflict; + conflict = ""; + } else { + timer = conflict.substr(0, sep); + conflict = conflict.substr(sep+1); + } + timers.insert(timer); + } + } + } + } + } + + return timers; +} diff --git a/vdr-vdrmanager/helpers.h b/vdr-vdrmanager/helpers.h index 18576be..d6e2a14 100644 --- a/vdr-vdrmanager/helpers.h +++ b/vdr-vdrmanager/helpers.h @@ -12,6 +12,7 @@ #include <iomanip> #include <sstream> #include <queue> +#include <set> using namespace std; @@ -36,7 +37,7 @@ private: static string SafeCall(string (*)()); static string SafeCall(string (*)(string), string arg); static string SafeCall(string (*)(string, string), string arg1, string arg2); - static string GetTimersIntern(); + static string GetTimersIntern(string options); static string GetRecordingsIntern(); static string GetChannelsIntern(string wantedChannels); static string SetChannelIntern(string wantedChannel); @@ -51,7 +52,7 @@ private: static string MapSpecialChars(const cString text); static string MapSpecialChars(const string text); static string ToText(const cEvent * event); - static string ToText(cTimer * timer); + static string ToText(cTimer * timer, set<string> conflicts); static string ToText(cRecording * recording); static string GetAudioTracks(const cChannel* channel); static string replaceAll(const string& where, const string& what, const string& replacement); @@ -63,5 +64,5 @@ private: static int ConvertWeekdays(string v); static queue<int> ConvertToBinary(int v); static string DelRecording(cRecording * r); - + static set<string> GetTimerConflicts(); }; |