summaryrefslogtreecommitdiff
path: root/svdrp.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2005-08-07 18:00:00 +0200
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2005-08-07 18:00:00 +0200
commit4c5de2888331fb4372eba0b0f4364fd9a0197b17 (patch)
treefbacaa13bb20870db03ad49516713c3f00ec3b0e /svdrp.c
parentfef3aa3a7fff0e3b4745532a6b1a157b45cb9643 (diff)
downloadvdr-patch-lnbsharing-4c5de2888331fb4372eba0b0f4364fd9a0197b17.tar.gz
vdr-patch-lnbsharing-4c5de2888331fb4372eba0b0f4364fd9a0197b17.tar.bz2
Version 1.3.28vdr-1.3.28
- Added a sleep in cDvbPlayer::Action() in case there is no data to send to the device, which avoids a busy loop on very fast machines (thanks to Martin Wache). - Modified the description of cDevice::Poll() to avoid misunderstandings. - Updated Croatian language texts (thanks to Drazen Dupor). - cDvbPlayer::Goto() now appends a Sequence End Code to get the image shown immediately with softdevices (thanks to Reinhard Nissl). - Reactivated cVideoRepacker in remux.c after some fixes (thanks to Reinhard Nissl). - Removed the fix for handling VPS timers, so that they only record if the event they are assigned to actually has the given VPS time. This has caused repeating VPS timers to stop recording prematurely. - Avoiding duplicate components in EPG events when reading epg.data or in the PUTE SVDRP command (thanks to Olaf Titz for reporting this one). - Added the command line options '--lirc', '--rcu' and '--no-kbd' to allow setting the remote control at runtime (based on a patch by Darren Salt). - Now checking whether timers or channels are currently being edited via the menu before making changes through SVDRP (thanks to Andreas Brugger for reporting a problem with this). - Files and directories are now created with rights according to the shell's umask settings (thanks to Andreas Brachold). - Fixed the cChannel copy constructor (thanks to Marcel Wiesweg for pointing out a problem with it). - Fixed an out-of-bounds memory access with audio language ids (thanks to Matthias Lenk for reporting, and Udo Richter for suggesting a fix). - Updated the Finnish OSD texts (thanks to Rolf Ahrenberg). - Added missing storing of the MenuScrollPage parameter (thanks to Frank Krömmelbein). - Added cRemux::SetTimeouts() for better use of cRemux in a single thread (thanks to Udo Richter for reporting a problem with this). - Modified cEITScanner::Process() so that it uses the primary device if it is replaying and is the only device that provides the given transponder, and that a forced EPG scan works even if EPG scan timeout is set to 0 (thanks to Bernhard Stegmaier for reporting a problem with this). - Fixed cDvbSpuBitmap::putPixel() (thanks to Reinhard Nissl). - Fixed setting system time to avoid time jumps in case of faulty data (thanks to Andreas Böttger). - Fixed a memory leak in the SVDRP command LSTE (thanks to Stefan Huelswitt).
Diffstat (limited to 'svdrp.c')
-rw-r--r--svdrp.c177
1 files changed, 102 insertions, 75 deletions
diff --git a/svdrp.c b/svdrp.c
index a63a575..093bd99 100644
--- a/svdrp.c
+++ b/svdrp.c
@@ -10,7 +10,7 @@
* and interact with the Video Disk Recorder - or write a full featured
* graphical interface that sits on top of an SVDRP connection.
*
- * $Id: svdrp.c 1.72 2005/05/26 09:59:09 kls Exp $
+ * $Id: svdrp.c 1.74 2005/08/07 14:20:41 kls Exp $
*/
#include "svdrp.h"
@@ -209,7 +209,7 @@ const char *HelpPages[] = {
" containing the given string as part of their name are listed.",
"LSTE [ <channel> ] [ now | next | at <time> ]\n"
" List EPG data. Without any parameters all data of all channels is\n"
- " listed. If a channel is given (either by number of by channel ID),\n"
+ " listed. If a channel is given (either by number or by channel ID),\n"
" only data for that channel is listed. 'now', 'next', or 'at <time>'\n"
" restricts the returned data to present events, following events, or\n"
" events at the given time (which must be in time_t form).",
@@ -476,22 +476,26 @@ void cSVDRP::CmdDELC(const char *Option)
{
if (*Option) {
if (isnumber(Option)) {
- cChannel *channel = Channels.GetByNumber(strtol(Option, NULL, 10));
- if (channel) {
- for (cTimer *timer = Timers.First(); timer; timer = Timers.Next(timer)) {
- if (timer->Channel() == channel) {
- Reply(550, "Channel \"%s\" is in use by timer %d", Option, timer->Index() + 1);
- return;
+ if (!Channels.BeingEdited()) {
+ cChannel *channel = Channels.GetByNumber(strtol(Option, NULL, 10));
+ if (channel) {
+ for (cTimer *timer = Timers.First(); timer; timer = Timers.Next(timer)) {
+ if (timer->Channel() == channel) {
+ Reply(550, "Channel \"%s\" is in use by timer %d", Option, timer->Index() + 1);
+ return;
+ }
}
- }
- Channels.Del(channel);
- Channels.ReNumber();
- Channels.SetModified(true);
- isyslog("channel %s deleted", Option);
- Reply(250, "Channel \"%s\" deleted", Option);
+ Channels.Del(channel);
+ Channels.ReNumber();
+ Channels.SetModified(true);
+ isyslog("channel %s deleted", Option);
+ Reply(250, "Channel \"%s\" deleted", Option);
+ }
+ else
+ Reply(501, "Channel \"%s\" not defined", Option);
}
else
- Reply(501, "Channel \"%s\" not defined", Option);
+ Reply(550, "Channels are being edited - try again later");
}
else
Reply(501, "Error in channel number \"%s\"", Option);
@@ -532,19 +536,23 @@ void cSVDRP::CmdDELT(const char *Option)
{
if (*Option) {
if (isnumber(Option)) {
- cTimer *timer = Timers.Get(strtol(Option, NULL, 10) - 1);
- if (timer) {
- if (!timer->Recording()) {
- isyslog("deleting timer %s", *timer->ToDescr());
- Timers.Del(timer);
- Timers.SetModified();
- Reply(250, "Timer \"%s\" deleted", Option);
+ if (!Timers.BeingEdited()) {
+ cTimer *timer = Timers.Get(strtol(Option, NULL, 10) - 1);
+ if (timer) {
+ if (!timer->Recording()) {
+ isyslog("deleting timer %s", *timer->ToDescr());
+ Timers.Del(timer);
+ Timers.SetModified();
+ Reply(250, "Timer \"%s\" deleted", Option);
+ }
+ else
+ Reply(550, "Timer \"%s\" is recording", Option);
}
else
- Reply(550, "Timer \"%s\" is recording", Option);
+ Reply(501, "Timer \"%s\" not defined", Option);
}
else
- Reply(501, "Timer \"%s\" not defined", Option);
+ Reply(550, "Timers are being edited - try again later");
}
else
Reply(501, "Error in timer number \"%s\"", Option);
@@ -782,18 +790,25 @@ void cSVDRP::CmdLSTE(const char *Option)
p = strtok_r(NULL, delim, &strtok_next);
}
}
- FILE *f = fdopen(file, "w");
- if (f) {
- if (Schedule)
- Schedule->Dump(f, "215-", DumpMode, AtTime);
- else
- Schedules->Dump(f, "215-", DumpMode, AtTime);
- fflush(f);
- Reply(215, "End of EPG data");
- // don't 'fclose(f)' here!
+ int fd = dup(file);
+ if (fd) {
+ FILE *f = fdopen(fd, "w");
+ if (f) {
+ if (Schedule)
+ Schedule->Dump(f, "215-", DumpMode, AtTime);
+ else
+ Schedules->Dump(f, "215-", DumpMode, AtTime);
+ fflush(f);
+ Reply(215, "End of EPG data");
+ fclose(f);
+ }
+ else {
+ Reply(451, "Can't open file connection");
+ close(fd);
+ }
}
else
- Reply(451, "Can't open file connection");
+ Reply(451, "Can't dup stream descriptor");
}
else
Reply(451, "Can't get EPG data");
@@ -880,25 +895,29 @@ void cSVDRP::CmdMODC(const char *Option)
int n = strtol(Option, &tail, 10);
if (tail && tail != Option) {
tail = skipspace(tail);
- cChannel *channel = Channels.GetByNumber(n);
- if (channel) {
- cChannel ch;
- if (ch.Parse(tail)) {
- if (Channels.HasUniqueChannelID(&ch, channel)) {
- *channel = ch;
- Channels.ReNumber();
- Channels.SetModified(true);
- isyslog("modifed channel %d %s", channel->Number(), *channel->ToText());
- Reply(250, "%d %s", channel->Number(), *channel->ToText());
+ if (!Channels.BeingEdited()) {
+ cChannel *channel = Channels.GetByNumber(n);
+ if (channel) {
+ cChannel ch;
+ if (ch.Parse(tail)) {
+ if (Channels.HasUniqueChannelID(&ch, channel)) {
+ *channel = ch;
+ Channels.ReNumber();
+ Channels.SetModified(true);
+ isyslog("modifed channel %d %s", channel->Number(), *channel->ToText());
+ Reply(250, "%d %s", channel->Number(), *channel->ToText());
+ }
+ else
+ Reply(501, "Channel settings are not unique");
}
else
- Reply(501, "Channel settings are not unique");
+ Reply(501, "Error in channel settings");
}
else
- Reply(501, "Error in channel settings");
+ Reply(501, "Channel \"%d\" not defined", n);
}
else
- Reply(501, "Channel \"%d\" not defined", n);
+ Reply(550, "Channels are being edited - try again later");
}
else
Reply(501, "Error in channel number");
@@ -914,24 +933,28 @@ void cSVDRP::CmdMODT(const char *Option)
int n = strtol(Option, &tail, 10);
if (tail && tail != Option) {
tail = skipspace(tail);
- cTimer *timer = Timers.Get(n - 1);
- if (timer) {
- cTimer t = *timer;
- if (strcasecmp(tail, "ON") == 0)
- t.SetFlags(tfActive);
- else if (strcasecmp(tail, "OFF") == 0)
- t.ClrFlags(tfActive);
- else if (!t.Parse(tail)) {
- Reply(501, "Error in timer settings");
- return;
+ if (!Timers.BeingEdited()) {
+ cTimer *timer = Timers.Get(n - 1);
+ if (timer) {
+ cTimer t = *timer;
+ if (strcasecmp(tail, "ON") == 0)
+ t.SetFlags(tfActive);
+ else if (strcasecmp(tail, "OFF") == 0)
+ t.ClrFlags(tfActive);
+ else if (!t.Parse(tail)) {
+ Reply(501, "Error in timer settings");
+ return;
+ }
+ *timer = t;
+ Timers.SetModified();
+ isyslog("timer %s modified (%s)", *timer->ToDescr(), timer->HasFlags(tfActive) ? "active" : "inactive");
+ Reply(250, "%d %s", timer->Index() + 1, *timer->ToText());
}
- *timer = t;
- Timers.SetModified();
- isyslog("timer %s modified (%s)", *timer->ToDescr(), timer->HasFlags(tfActive) ? "active" : "inactive");
- Reply(250, "%d %s", timer->Index() + 1, *timer->ToText());
+ else
+ Reply(501, "Timer \"%d\" not defined", n);
}
else
- Reply(501, "Timer \"%d\" not defined", n);
+ Reply(550, "Timers are being edited - try again later");
}
else
Reply(501, "Error in timer number");
@@ -1054,20 +1077,24 @@ void cSVDRP::CmdUPDT(const char *Option)
if (*Option) {
cTimer *timer = new cTimer;
if (timer->Parse(Option)) {
- cTimer *t = Timers.GetTimer(timer);
- if (t) {
- t->Parse(Option);
- delete timer;
- timer = t;
- isyslog("timer %s updated", *timer->ToDescr());
- }
- else {
- Timers.Add(timer);
- isyslog("timer %s added", *timer->ToDescr());
+ if (!Timers.BeingEdited()) {
+ cTimer *t = Timers.GetTimer(timer);
+ if (t) {
+ t->Parse(Option);
+ delete timer;
+ timer = t;
+ isyslog("timer %s updated", *timer->ToDescr());
+ }
+ else {
+ Timers.Add(timer);
+ isyslog("timer %s added", *timer->ToDescr());
+ }
+ Timers.SetModified();
+ Reply(250, "%d %s", timer->Index() + 1, *timer->ToText());
+ return;
}
- Timers.SetModified();
- Reply(250, "%d %s", timer->Index() + 1, *timer->ToText());
- return;
+ else
+ Reply(550, "Timers are being edited - try again later");
}
else
Reply(501, "Error in timer settings");