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 | |
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)
-rw-r--r-- | vdr-vdrmanager/.cproject | 19 | ||||
-rw-r--r-- | vdr-vdrmanager/helpers.cpp | 78 | ||||
-rw-r--r-- | vdr-vdrmanager/helpers.h | 7 | ||||
-rw-r--r-- | vdrmanager/src/de/bjusystems/vdrmanager/data/Event.java | 4 | ||||
-rw-r--r-- | vdrmanager/src/de/bjusystems/vdrmanager/data/Timer.java | 18 | ||||
-rw-r--r-- | vdrmanager/src/de/bjusystems/vdrmanager/data/TimerMatch.java | 3 | ||||
-rw-r--r-- | vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventAdapter.java | 11 | ||||
-rw-r--r-- | vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java | 18 | ||||
-rw-r--r-- | vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java | 22 | ||||
-rw-r--r-- | vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/TimerClient.java | 7 |
10 files changed, 150 insertions, 37 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(); }; diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/Event.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/Event.java index 03de2a2..a1aace4 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/data/Event.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/Event.java @@ -138,4 +138,8 @@ public abstract class Event { } return String.valueOf(channelNumber); } + + public boolean isConflict() { + return false; + } } diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/Timer.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/Timer.java index 89f1089..bf2f048 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/data/Timer.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/Timer.java @@ -32,6 +32,7 @@ public class Timer extends Event implements Timerable { private int priority; private int lifetime; private String weekdays = "-------"; + private boolean conflict; public void setPriority(int priority) { this.priority = priority; @@ -58,8 +59,6 @@ public class Timer extends Event implements Timerable { * * @param timerData * result line - * @param channels - * list of channels */ public Timer(final String timerData) { @@ -103,6 +102,10 @@ public class Timer extends Event implements Timerable { this.weekdays = values[13]; } + if (values.length > 14) { + this.conflict = values[14].equals("1"); + } + description = Utils.mapSpecialChars(description); } @@ -118,6 +121,7 @@ public class Timer extends Event implements Timerable { t.stop = new Date(stop.getTime()); t.title = title; t.weekdays = weekdays; + t.conflict = conflict; return t; } @@ -216,6 +220,10 @@ public class Timer extends Event implements Timerable { return (flags & RECORDING) == RECORDING; } + public boolean isConflict() { + return conflict; + } + public void setStart(final Date start) { this.start = start; } @@ -251,7 +259,11 @@ public class Timer extends Event implements Timerable { @Override public TimerMatch getTimerMatch() { - return TimerMatch.Full; + + if (isConflict()) + return TimerMatch.Conflict; + + return TimerMatch.Full; } diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/TimerMatch.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/TimerMatch.java index 72cc52c..b8126ab 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/data/TimerMatch.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/TimerMatch.java @@ -3,5 +3,6 @@ package de.bjusystems.vdrmanager.data; public enum TimerMatch { Full, // Begin, // - End// + End, // + Conflict, // } diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventAdapter.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventAdapter.java index b022311..f670951 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventAdapter.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventAdapter.java @@ -169,26 +169,29 @@ abstract class BaseEventAdapter<T extends EventListItem> extends ArrayAdapter<T> } else { itemHolder.state.setImageResource(R.drawable.timer_none); } - } else if (item.getEvent() instanceof Timerable == true) { + } else if (item.getEvent() instanceof Timerable) { TimerMatch match = ((Timerable) item.getEvent()).getTimerMatch(); switch (((Timerable) item.getEvent()).getTimerState()) { case Active: itemHolder.state.setImageResource(Utils.getTimerStateDrawable( match, R.drawable.timer_active, R.drawable.timer_active_begin, - R.drawable.timer_active_end)); + R.drawable.timer_active_end, + R.drawable.timer_active_conflict)); break; case Inactive: itemHolder.state.setImageResource(Utils.getTimerStateDrawable( match, R.drawable.timer_inactive, R.drawable.timer_inactive_begin, - R.drawable.timer_inactive_end)); + R.drawable.timer_inactive_end, + R.drawable.timer_inactive)); break; case Recording: itemHolder.state.setImageResource(Utils.getTimerStateDrawable( match, R.drawable.timer_recording, R.drawable.timer_recording_begin, - R.drawable.timer_recording_end)); + R.drawable.timer_recording_end, + R.drawable.timer_recording_conflict)); break; case None: itemHolder.state.setImageResource(R.drawable.timer_none); diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java index b9d6be3..e639355 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java @@ -273,20 +273,24 @@ public class EpgDetailsActivity extends ICSBaseActivity implements switch (timerable.getTimerState()) { case Active: setState(state, Utils.getTimerStateDrawable(match, - R.drawable.timer_active, R.drawable.timer_active_begin, - R.drawable.timer_active_end)); + R.drawable.timer_active, + R.drawable.timer_active_begin, + R.drawable.timer_active_end, + R.drawable.timer_active_conflict)); break; case Inactive: setState(state, Utils.getTimerStateDrawable(match, R.drawable.timer_inactive, R.drawable.timer_inactive_begin, - R.drawable.timer_inactive_end)); + R.drawable.timer_inactive_end, + R.drawable.timer_inactive)); break; case Recording: setState(state, Utils.getTimerStateDrawable(match, R.drawable.timer_recording, R.drawable.timer_recording_begin, - R.drawable.timer_recording_end)); + R.drawable.timer_recording_end, + R.drawable.timer_recording_conflict)); break; default: setState(state, R.drawable.timer_none); @@ -611,12 +615,14 @@ public class EpgDetailsActivity extends ICSBaseActivity implements res = Utils.getTimerStateDrawable(match, R.drawable.timer_inactive, R.drawable.timer_inactive_begin, - R.drawable.timer_inactive_end); + R.drawable.timer_inactive_end, + R.drawable.timer_inactive); } else if (state == TimerState.Inactive) { Utils.getTimerStateDrawable(match, R.drawable.timer_active, R.drawable.timer_active_begin, - R.drawable.timer_active_end); + R.drawable.timer_active_end, + R.drawable.timer_active_conflict); res = R.drawable.timer_active; } if (res != -1) { diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java index c95e759..8d2fca8 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java @@ -445,16 +445,18 @@ public class Utils { } public static int getTimerStateDrawable(final TimerMatch match, - final int full, final int begin, final int end) { - if (match == TimerMatch.Full) { - return full; - } - - if (match == TimerMatch.Begin) { - return begin; - } - - return end; + final int full, final int begin, final int end, final int conflict) { + + switch (match) { + case Begin: + return begin; + case End: + return end; + case Conflict: + return conflict; + default: + return full; + } } public static String formatAudio(final Context context, diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/TimerClient.java b/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/TimerClient.java index 4983745..1f55750 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/TimerClient.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/TimerClient.java @@ -19,9 +19,7 @@ public class TimerClient extends SvdrpClient<Timer> { /** * Constructor - * @param host host - * @param port port - * @param ssl use ssl + * @param certificateProblemListener CertificateProblemListener */ public TimerClient(final CertificateProblemListener certificateProblemListener) { super(certificateProblemListener); @@ -30,11 +28,10 @@ public class TimerClient extends SvdrpClient<Timer> { /** * Starts the EPG request - * @param parameter parameter for lste */ @Override public synchronized void run() { - runCommand("timers"); + runCommand("timers conflicts"); } @Override |