--- /dev/null
+------------------------------------------------------------------------
+r427 | philipp | 2007-03-03 14:11:23 +0100 (Sat, 03 Mar 2007) | 3 lines
+Changed paths:
+ M /teleschorsch/trunk/main.cpp
+ M /teleschorsch/trunk/maindialog.ui
+ M /teleschorsch/trunk/options.cpp
+ M /teleschorsch/trunk/options.h
+ M /teleschorsch/trunk/options.ui
+ M /teleschorsch/trunk/qteleschorsch.pro
+ M /teleschorsch/trunk/teleschorschrc
+
+Removed the timeout from waitForFinished (I assume the user wants to watch more than 30 seconds ;-) )
+Removed minsize of the dialogs
+
+------------------------------------------------------------------------
+r426 | gregoa | 2007-03-03 01:51:18 +0100 (Sat, 03 Mar 2007) | 1 line
+Changed paths:
+ M /teleschorsch/trunk/main.cpp
+
+minor fixes to inline documentation
+------------------------------------------------------------------------
+r425 | philipp | 2007-03-02 18:07:22 +0100 (Fri, 02 Mar 2007) | 2 lines
+Changed paths:
+ M /teleschorsch/trunk/main.cpp
+ M /teleschorsch/trunk/maindialog.ui
+ M /teleschorsch/trunk/options.cpp
+ M /teleschorsch/trunk/options.ui
+
+Implemented error handling in substitution. Not tested.
+
+------------------------------------------------------------------------
+r424 | gregoa | 2007-03-02 16:14:20 +0100 (Fri, 02 Mar 2007) | 1 line
+Changed paths:
+ M /teleschorsch/trunk/teleschorschrc
+
+new url for M6-1250
+------------------------------------------------------------------------
+r423 | gregoa | 2007-03-02 16:03:41 +0100 (Fri, 02 Mar 2007) | 1 line
+Changed paths:
+ M /teleschorsch/trunk/main.cpp
+
+eval staticUrl in a shell
+------------------------------------------------------------------------
+r422 | gregoa | 2007-03-02 00:38:46 +0100 (Fri, 02 Mar 2007) | 1 line
+Changed paths:
+ M /teleschorsch/trunk/main.cpp
+
+remove %1 in appendPlayerOffsetOption
+------------------------------------------------------------------------
+r421 | philipp | 2007-03-02 00:01:52 +0100 (Fri, 02 Mar 2007) | 2 lines
+Changed paths:
+ M /teleschorsch/trunk/main.cpp
+ M /teleschorsch/trunk/options.cpp
+
+Further working... This times on the offset as parameter for the player. Not tested.
+
+------------------------------------------------------------------------
+r420 | philipp | 2007-03-01 00:33:17 +0100 (Thu, 01 Mar 2007) | 2 lines
+Changed paths:
+ M /teleschorsch/trunk/main.cpp
+ M /teleschorsch/trunk/options.cpp
+ M /teleschorsch/trunk/options.ui
+
+Further development of starting a specified program. Not tested. Offset ignored.
+
+------------------------------------------------------------------------
+r419 | gregoa | 2007-02-28 23:18:40 +0100 (Wed, 28 Feb 2007) | 1 line
+Changed paths:
+ M /teleschorsch/trunk/makedist
+
+add make distclean to makedist
+------------------------------------------------------------------------
+r418 | gregoa | 2007-02-28 23:17:57 +0100 (Wed, 28 Feb 2007) | 1 line
+Changed paths:
+ M /teleschorsch/trunk/teleschorsch.pl
+
+quote in perl version when calling player
+------------------------------------------------------------------------
+r417 | philipp | 2007-02-26 20:22:35 +0100 (Mon, 26 Feb 2007) | 2 lines
+Changed paths:
+ M /teleschorsch/trunk/main.cpp
+ M /teleschorsch/trunk/main.h
+ M /teleschorsch/trunk/options.cpp
+ M /teleschorsch/trunk/options.h
+ M /teleschorsch/trunk/options.ui
+ M /teleschorsch/trunk/teleschorschrc
+
+Basic option file editing works now.
+
+------------------------------------------------------------------------
+r416 | philipp | 2007-02-26 19:30:49 +0100 (Mon, 26 Feb 2007) | 3 lines
+Changed paths:
+ M /teleschorsch/trunk/main.cpp
+ M /teleschorsch/trunk/main.h
+ M /teleschorsch/trunk/options.cpp
+ M /teleschorsch/trunk/options.h
+
+Slightly re-structured to make config file editing easy from the program point-of-view.
+The editing itself does not work yet.
+
+------------------------------------------------------------------------
+r415 | gregoa | 2007-02-25 23:16:48 +0100 (Sun, 25 Feb 2007) | 1 line
+Changed paths:
+ M /teleschorsch/trunk/main.cpp
+ M /teleschorsch/trunk/main.h
+
+started to work on 'start' button but ...
+------------------------------------------------------------------------
+r414 | gregoa | 2007-02-25 22:03:03 +0100 (Sun, 25 Feb 2007) | 1 line
+Changed paths:
+ M /teleschorsch/trunk/teleschorschrc
+
+teleschorschrc: cleanup and additions
+------------------------------------------------------------------------
+r413 | gregoa | 2007-02-25 17:39:59 +0100 (Sun, 25 Feb 2007) | 1 line
+Changed paths:
+ M /teleschorsch/trunk/teleschorschrc
+
+changed descriptions for ö1-journals in teleschorschrc
+------------------------------------------------------------------------
+r412 | gregoa | 2007-02-25 17:31:40 +0100 (Sun, 25 Feb 2007) | 1 line
+Changed paths:
+ M /teleschorsch/trunk/main.cpp
+
+only show fullname in maindialog's lwChannels
+------------------------------------------------------------------------
+r411 | gregoa | 2007-02-25 17:21:07 +0100 (Sun, 25 Feb 2007) | 1 line
+Changed paths:
+ M /teleschorsch/trunk/teleschorschrc
+
+add ö1-journals to teleschorschrc (currently only the last broadcast, date selection is ignored)
+------------------------------------------------------------------------
+r410 | gregoa | 2007-02-25 17:19:21 +0100 (Sun, 25 Feb 2007) | 1 line
+Changed paths:
+ M /teleschorsch/trunk/teleschorsch.sh
+
+change separator in arrays in teleschorsch.sh from | to ~ in order to allow pipes in URL
+------------------------------------------------------------------------
+r409 | gregoa | 2007-02-25 15:52:13 +0100 (Sun, 25 Feb 2007) | 1 line
+Changed paths:
+ A /teleschorsch/trunk/makedist
+
+add script makedist (creates tarball with qt, perl, and bash version)
+------------------------------------------------------------------------
+r408 | gregoa | 2007-02-24 23:23:24 +0100 (Sat, 24 Feb 2007) | 1 line
+Changed paths:
+ M /teleschorsch/trunk/teleschorsch.pl
+
+add newline to error messages
+------------------------------------------------------------------------
+r407 | philipp | 2007-02-24 22:58:12 +0100 (Sat, 24 Feb 2007) | 2 lines
+Changed paths:
+ M /teleschorsch/trunk/main.cpp
+ M /teleschorsch/trunk/main.h
+ A /teleschorsch/trunk/options.cpp
+ A /teleschorsch/trunk/options.h (from /teleschorsch/trunk/main.h:406)
+ M /teleschorsch/trunk/options.ui
+ M /teleschorsch/trunk/qteleschorsch.pro
+
+The options window opens when "Options" is clicked.
+
+------------------------------------------------------------------------
+r406 | gregoa | 2007-02-24 22:13:46 +0100 (Sat, 24 Feb 2007) | 1 line
+Changed paths:
+ A /teleschorsch/trunk/teleschorsch.pl
+
+first commit of teleschorsch.pl
+------------------------------------------------------------------------
+r405 | gregoa | 2007-02-24 20:44:40 +0100 (Sat, 24 Feb 2007) | 1 line
+Changed paths:
+ M /teleschorsch/trunk/main.cpp
+ M /teleschorsch/trunk/teleschorsch.sh
+
+add/change copyright statement
+------------------------------------------------------------------------
+r404 | gregoa | 2007-02-24 20:24:01 +0100 (Sat, 24 Feb 2007) | 1 line
+Changed paths:
+ M /teleschorsch/trunk/README
+ M /teleschorsch/trunk/teleschorsch.sh
+
+s/TIME/OFFSET/ in teleschorsch.sh
+------------------------------------------------------------------------
+r403 | gregoa | 2007-02-24 17:52:57 +0100 (Sat, 24 Feb 2007) | 1 line
+Changed paths:
+ M /teleschorsch/trunk/README
+ D /teleschorsch/trunk/teleschorsch
+ A /teleschorsch/trunk/teleschorsch.sh (from /teleschorsch/trunk/teleschorsch:402)
+
+mv teleschorsch teleschorsch.sh (to allow teleschorsch as alternatives and maybe teleschorsch.pl
+------------------------------------------------------------------------
+r402 | gregoa | 2007-02-24 17:44:57 +0100 (Sat, 24 Feb 2007) | 1 line
+Changed paths:
+ M /teleschorsch/trunk/teleschorsch
+
+add command line options -xdialog (default) and -dialog to teleschorsch
+------------------------------------------------------------------------
+r401 | philipp | 2007-02-24 15:14:42 +0100 (Sat, 24 Feb 2007) | 2 lines
+Changed paths:
+ M /teleschorsch/trunk/main.cpp
+
+$HOME bug fixed.
+
+------------------------------------------------------------------------
+r400 | gregoa | 2007-02-24 01:22:09 +0100 (Sat, 24 Feb 2007) | 1 line
+Changed paths:
+ M /teleschorsch/trunk/maindialog.ui
+ M /teleschorsch/trunk/options.ui
+
+minor changes to dialogs
+------------------------------------------------------------------------
+r399 | gregoa | 2007-02-24 01:09:39 +0100 (Sat, 24 Feb 2007) | 1 line
+Changed paths:
+ M /teleschorsch/trunk/main.cpp
+
+read config from /etc/teleschorschrc or /home/gregoa/.teleschorschrc
+------------------------------------------------------------------------
+r398 | gregoa | 2007-02-24 00:19:04 +0100 (Sat, 24 Feb 2007) | 1 line
+Changed paths:
+ M /teleschorsch/trunk/options.ui
+
+minor tweaks to options dialog
+------------------------------------------------------------------------
+r397 | gregoa | 2007-02-24 00:05:32 +0100 (Sat, 24 Feb 2007) | 1 line
+Changed paths:
+ M /teleschorsch/trunk/options.ui
+
+extend help in options dialog
+------------------------------------------------------------------------
+r396 | gregoa | 2007-02-22 23:01:40 +0100 (Thu, 22 Feb 2007) | 1 line
+Changed paths:
+ M /teleschorsch/trunk/teleschorsch
+
+bash version 0.1.0: use config file
+------------------------------------------------------------------------
+r395 | gregoa | 2007-02-22 22:52:32 +0100 (Thu, 22 Feb 2007) | 1 line
+Changed paths:
+ M /teleschorsch/trunk/teleschorschrc
+
+change ini file to new
+------------------------------------------------------------------------
+r394 | gregoa | 2007-02-22 17:39:55 +0100 (Thu, 22 Feb 2007) | 1 line
+Changed paths:
+ M /teleschorsch/trunk/teleschorschrc
+
+TF1 descriptions
+------------------------------------------------------------------------
+r393 | gregoa | 2007-02-22 16:56:52 +0100 (Thu, 22 Feb 2007) | 2 lines
+Changed paths:
+ M /teleschorsch/trunk/main.cpp
+ M /teleschorsch/trunk/teleschorschrc
+
+ini file: changed keynames, added "FULLNAME", adapted main.cpp accordingly
+
+------------------------------------------------------------------------
+r392 | gregoa | 2007-02-22 16:44:34 +0100 (Thu, 22 Feb 2007) | 1 line
+Changed paths:
+ A /teleschorsch/trunk/README
+
+add README (comments for development)
+------------------------------------------------------------------------
+r391 | gregoa | 2007-02-22 16:20:52 +0100 (Thu, 22 Feb 2007) | 1 line
+Changed paths:
+ M /teleschorsch/trunk/teleschorsch
+
+0.0.6 minor fixes
+------------------------------------------------------------------------
+r390 | philipp | 2007-02-22 00:27:04 +0100 (Thu, 22 Feb 2007) | 2 lines
+Changed paths:
+ A /teleschorsch/trunk/main.cpp
+ A /teleschorsch/trunk/main.h
+ A /teleschorsch/trunk/maindialog.ui
+ A /teleschorsch/trunk/options.ui
+ A /teleschorsch/trunk/qteleschorsch.pro
+ A /teleschorsch/trunk/teleschorschrc
+
+Started to program qteleschorsch
+
+------------------------------------------------------------------------
+r389 | philipp | 2007-02-21 19:41:59 +0100 (Wed, 21 Feb 2007) | 2 lines
+Changed paths:
+ A /teleschorsch/trunk
+ A /teleschorsch/trunk/teleschorsch
+
+Initial check-in of Gregors teleschorsch 0.0.5
+
+------------------------------------------------------------------------
}
-QString substitudeVar(const QString& var, QDate date) {
- if (var == "d") return date.toString("dd");
- if (var == "m") return date.toString("MM");
- if (var == "y") return date.toString("yy");
- if (var == "Y") return date.toString("yyyy");
+/// \brief Finds a value for a specified variable and appends it to a string.
+///
+/// \param[in] var variable to substitute. These are the possibilities:
+/// - d day of month (01-31)
+/// - m month (01-12)
+/// - y year (last two digits)
+/// - Y year (4 digits)
+/// - dow_DE day of week in German (Montag, ...)
+/// \param[in] date date that should be used when replacing the date dependend variables
+/// \param[out] result The determined value of the variable is _appended_.
+/// \param[out] error error message in error cases
+/// \returns true in case of success.
+bool substituteVar(const QString& var, QDate date, QString& result, QString& errorMsg) {
+ if (var == "d") {result += date.toString("dd"); return true;}
+ if (var == "m") {result += date.toString("MM"); return true;}
+ if (var == "y") {result += date.toString("yy"); return true;}
+ if (var == "Y") {result += date.toString("yyyy"); return true;}
if (var == "dow_DE") {
int dow = date.dayOfWeek() - 1;
- static const char dow_de[][20] = {"Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"};
- if (dow >= 0 && dow < 7) return dow_de[dow];
+ static const char dow_de[][16] = {"Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"};
+ if (dow >= 0 && dow < 7) {result += dow_de[dow]; return true;}
}
- return "{no match}"; // maybe do some error handling here...
+ errorMsg = QObject::tr("No match for variable %1").arg(var);
+ return false;
}
-QString substitudeStaticUrl(const QString& staticUrl, QDate date) {
- QString result;
+/// \brief Finds a string, where variables of the form <code>${var}</code> are substituted in input (normally a staticUrl).
+///
+/// - ${d} day of month (01-31)
+/// - ${m} month (01-12)
+/// - ${y} year (last two digits)
+/// - ${Y} year (4 digits)
+/// - ${dow_DE} day of week in German (Montag, ...)
+///
+/// \param[in] input string where the substitution should be done.
+/// \param[in] date date that should be used when replacing the date dependend variables
+/// \param[out] result The result string with the variables substituted is appended here
+/// \param[out] error error message in error cases
+/// \returns true in case of success.
+bool substituteVars(const QString& input, QDate date, QString& result, QString& errorMsg) {
int pos = 0;
int lastPos = 0;
while (pos != -1) {
- pos = staticUrl.indexOf("${", lastPos);
- if (pos == -1) result += staticUrl.mid(lastPos);
- else result += staticUrl.mid(lastPos, pos-lastPos);
+ pos = input.indexOf("${", lastPos);
+ if (pos == -1) result += input.mid(lastPos);
+ else result += input.mid(lastPos, pos-lastPos);
lastPos = pos;
// Match?
if (pos != -1) {
- pos = staticUrl.indexOf("}", lastPos);
- if (pos == -1) return ""; // ${ not closed with }. Some day we should report the error somehow...
- QString var = staticUrl.mid(lastPos+2, pos-lastPos-2);
- result += substitudeVar(var, date);
+ pos = input.indexOf("}", lastPos);
+ if (pos == -1) {
+ errorMsg = QObject::tr("${ not closed with }.");
+ return false;
+ }
+ QString var = input.mid(lastPos+2, pos-lastPos-2);
+ if (!substituteVar(var, date, result, errorMsg)) return false;
lastPos = pos+1;
}
}
+ return true;
+}
+
+
+/// \brief Calls the /bin/sh shell with the specified command and appends the result to a string variable.
+///
+/// \param[in] command command to execute with <code>/bin/sh -c "command"</code>
+/// \param[out] result The result string where the output is appended at.
+/// \param[out] error error message in error cases
+/// \returns true in case of success.
+bool executeShellCommand(const QString& command, QString& result, QString& errorMsg) {
+ QProcess evalUrl(0);
+ QString cmd = "/bin/sh -c \"" + command + "\"";
+ evalUrl.start(cmd);
+ if (evalUrl.waitForFinished(3000)) {
+ QByteArray newResult = evalUrl.readAllStandardOutput();
+ if (result != newResult) {result += newResult.trimmed();}
+ return true;
+ }
+ errorMsg = QObject::tr("Shell command executed when substituting URL (%1) timed out.").arg(command);
+ return false;
+}
+
+
+/// \brief Evaluates the staticUrl
+///
+/// - Variables of the form ${var} are substituted according the the function ::substituteVars
+/// - If the staticUrl is enclosed by backticks it is evaluated by a shell command (after the substitution mentioned above)
+///
+/// \param[in] staticUrl string where the substitution should be done.
+/// \param[in] date date that should be used when replacing the date dependend variables
+/// \param[out] result The result string is appended here
+/// \param[out] error error message in error cases
+/// \returns true in case of success.
+bool evaluateStaticUrl(const QString& staticUrl, QDate date, QString& result, QString& errorMsg) {
+ QString subst;
+ bool success = substituteVars(staticUrl, date, subst, errorMsg);
+ if (!success) return false;
// Evaluate staticUrl - it might be dynamic despite its name :-)
- if (result.left(1) == "`" && result.right(1) == "`") {
- QProcess evalUrl(0);
- QString command = "/bin/sh -c \"echo " + result + "\"";
- evalUrl.start(command);
- if (evalUrl.waitForFinished()) {
- QByteArray newResult = evalUrl.readAllStandardOutput();
- if (result != newResult) {result = newResult.trimmed();}
- }
- }
- return result;
+ QString cmdres;
+ if (subst.left(1) == "`" && subst.right(1) == "`") {
+ success = executeShellCommand(subst.mid(1, subst.size()-2), cmdres, errorMsg);
+ if (!success) return false;
+ result = cmdres;
+ } else result = subst;
+ return true;
}
if (row > 0) {
Channel channel = channelVec[row];
QDate date = calDate->selectedDate();
+ QString substUrl;
+ QString errorMsg;
+ if (!evaluateStaticUrl(channel.staticUrl, date, substUrl, errorMsg)) {
+ QMessageBox::warning(this, tr("Problem when substituting URL"), errorMsg);
+ return false;
+ }
QStringList arguments;
- arguments.append(substitudeStaticUrl(channel.staticUrl, date));
+ arguments.append(substUrl);
appendPlayerOffsetOption(channel.player, teOffset->time(), arguments);
QProcess player(this);
qDebug() << channel.player << arguments;
player.start(channel.player, arguments);
- player.waitForFinished();
+ player.waitForFinished(-1);
return true;
}
return false;