summaryrefslogtreecommitdiff
path: root/vdr-vdrmanager/helpers.cpp
diff options
context:
space:
mode:
authorlado <herrlado@gmail.com>2011-10-24 13:17:16 +0200
committerlado <herrlado@gmail.com>2011-10-24 13:17:16 +0200
commitdab4548643729a218f83b59fa489bd5e2f39fb84 (patch)
tree48673389628a1a8053475cc57f5acda2135e2906 /vdr-vdrmanager/helpers.cpp
parent913cff1fdc75512c99c22cf2f89a20fbdbd729f0 (diff)
downloadvdr-manager-dab4548643729a218f83b59fa489bd5e2f39fb84.tar.gz
vdr-manager-dab4548643729a218f83b59fa489bd5e2f39fb84.tar.bz2
UnMapSpecialChars for unescape special chars + handling : in timer title and description
Diffstat (limited to 'vdr-vdrmanager/helpers.cpp')
-rw-r--r--vdr-vdrmanager/helpers.cpp40
1 files changed, 35 insertions, 5 deletions
diff --git a/vdr-vdrmanager/helpers.cpp b/vdr-vdrmanager/helpers.cpp
index a20fc98..4d7422e 100644
--- a/vdr-vdrmanager/helpers.cpp
+++ b/vdr-vdrmanager/helpers.cpp
@@ -224,7 +224,7 @@ string cHelpers::DelRecordingIntern(string args) {
}
string cHelpers::SetTimerIntern(string args) {
-
+
// separete timer number
size_t sep = args.find(':');
if (sep == string::npos) {
@@ -232,14 +232,25 @@ string cHelpers::SetTimerIntern(string args) {
}
char c = args[0];
-
+
string numberstr = args.substr(sep-1,1);
-
+
int number = atoi(numberstr.c_str());
string params = args.substr(sep+1);
-
-
+
+ // Use StringReplace here because if ':' are characters in the
+ // title or aux string it breaks parsing of timer definition
+ // in VDRs cTimer::Parse method. The '|' will be replaced
+ // back to ':' by the cTimer::Parse() method.
+
+ // Fix was submitted by rofafor: see
+ // http://www.vdr-portal.de/board/thread.php?threadid=100398
+ params = replaceAll(params, "|##", "|");
+
+ //replace also newlines
+ params = replaceAll(params, "||#", "\n");
+
// parse timer
cTimer * timer = new cTimer;
if (!timer->Parse(params.c_str())) {
@@ -658,3 +669,22 @@ string cHelpers::MapSpecialChars(string text) {
}
return result;
}
+
+string cHelpers::replaceAll(string where, string what, string replacement){
+ int position = where.find(what);
+ int size = what.size();
+ while ( position != string::npos )
+ {
+ where.replace( position, size, replacement );
+ position = where.find(what, position + 1 );
+ }
+ return where;
+}
+
+string cHelpers::UnMapSpecialChars(string text) {
+
+ string ntext = replaceAll(text, "|##", ":");
+ ntext = replaceAll(ntext, "||#", "\n");
+
+ return ntext;
+}