mirror of
https://github.com/vdr-projects/vdr.git
synced 2025-03-01 10:50:46 +00:00
Skipping unavailable channels when switching with 'Up' and 'Down' keys
This commit is contained in:
31
svdrp.c
31
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.41 2002/09/04 10:49:42 kls Exp $
|
||||
* $Id: svdrp.c 1.42 2002/09/08 11:22:57 kls Exp $
|
||||
*/
|
||||
|
||||
#include "svdrp.h"
|
||||
@@ -387,6 +387,7 @@ void cSVDRP::CmdCHAN(const char *Option)
|
||||
{
|
||||
if (*Option) {
|
||||
int n = -1;
|
||||
int d = 0;
|
||||
if (isnumber(Option)) {
|
||||
int o = strtol(Option, NULL, 10);
|
||||
if (o >= 1 && o <= Channels.MaxNumber())
|
||||
@@ -394,13 +395,17 @@ void cSVDRP::CmdCHAN(const char *Option)
|
||||
}
|
||||
else if (strcmp(Option, "-") == 0) {
|
||||
n = cDevice::CurrentChannel();
|
||||
if (n > 1)
|
||||
if (n > 1) {
|
||||
n--;
|
||||
d = -1;
|
||||
}
|
||||
}
|
||||
else if (strcmp(Option, "+") == 0) {
|
||||
n = cDevice::CurrentChannel();
|
||||
if (n < Channels.MaxNumber())
|
||||
if (n < Channels.MaxNumber()) {
|
||||
n++;
|
||||
d = 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
int i = 1;
|
||||
@@ -417,17 +422,21 @@ void cSVDRP::CmdCHAN(const char *Option)
|
||||
Reply(501, "Undefined channel \"%s\"", Option);
|
||||
return;
|
||||
}
|
||||
cChannel *channel = Channels.GetByNumber(n);
|
||||
if (channel) {
|
||||
if (!cDevice::PrimaryDevice()->SwitchChannel(channel, true)) {
|
||||
Reply(554, "Error switching to channel \"%d\"", channel->number);
|
||||
if (!d) {
|
||||
cChannel *channel = Channels.GetByNumber(n);
|
||||
if (channel) {
|
||||
if (!cDevice::PrimaryDevice()->SwitchChannel(channel, true)) {
|
||||
Reply(554, "Error switching to channel \"%d\"", channel->number);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Reply(550, "Unable to find channel \"%s\"", Option);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Reply(550, "Unable to find channel \"%s\"", Option);
|
||||
return;
|
||||
}
|
||||
else
|
||||
cDevice::SwitchChannel(d);
|
||||
}
|
||||
cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
|
||||
if (channel)
|
||||
|
||||
Reference in New Issue
Block a user