summaryrefslogtreecommitdiff
path: root/global.cpp
diff options
context:
space:
mode:
authorJochen Dolze <vdr@dolze.de>2009-02-06 23:11:28 +0100
committerJochen Dolze <vdr@dolze.de>2009-02-06 23:11:28 +0100
commit7d0c10a7e07a075d464364df7c1e75c444ced316 (patch)
tree2e491e85649bb14f409cd8e7b894422ee4783120 /global.cpp
parent210b6ab3d8a5367e116afefe31cea1d83fa094b9 (diff)
downloadvdr-plugin-infosatepg-7d0c10a7e07a075d464364df7c1e75c444ced316.tar.gz
vdr-plugin-infosatepg-7d0c10a7e07a075d464364df7c1e75c444ced316.tar.bz2
Improved processing
Diffstat (limited to 'global.cpp')
-rw-r--r--global.cpp47
1 files changed, 45 insertions, 2 deletions
diff --git a/global.cpp b/global.cpp
index c3ca300..0ba2b8c 100644
--- a/global.cpp
+++ b/global.cpp
@@ -22,7 +22,7 @@ bool cGlobalInfosatdata::NeverSeen(int Day,int Month,int Packetcount)
void cGlobalInfosatdata::Init(char *File,int Day,int Month,int Packetcount)
{
- if (access(file,R_OK)==0)
+ if (access(file,R_OK | W_OK)==0)
{
dsyslog("infosatepg: deleting old %s",file);
unlink(file);
@@ -79,7 +79,17 @@ int cGlobalInfosatdata::Load(int fd)
if (ret!=sizeof (bitfield)) return -1;
ret=read (fd,&file,sizeof (file));
if (ret!=sizeof (file)) return -1;
- if (file[0]!=0) dsyslog ("infosatepg: loaded file=%s",file);
+ // check file
+ if (file[0]!=0)
+ {
+ if (access(file,R_OK | W_OK)==-1)
+ {
+ // file doesnt exist -> receive it again
+ esyslog("infosatepg: cannot access %s",file);
+ Init(file,day,month,pktcnt);
+ }
+ }
+
return ret;
}
@@ -412,6 +422,7 @@ bool cGlobalInfosatepg::FindReceiverChannel()
cChannel *chan;
int source = cSource::FromString("S19.2E"); // only from astra 19.2E
+ // Try to find a channel with the exact frequency
for (int i=0; i<=Channels.MaxNumber(); i++)
{
chan = Channels.GetByNumber(i,0);
@@ -425,6 +436,38 @@ bool cGlobalInfosatepg::FindReceiverChannel()
return true;
}
}
+
+ // None found? Then try to find a channel with frequency + 1
+ for (int i=0; i<=Channels.MaxNumber(); i++)
+ {
+ chan = Channels.GetByNumber(i,0);
+ if (chan)
+ {
+ if (chan->Source()!=source) continue;
+ if (chan->Srate()!=Srate) continue;
+ if (chan->Frequency()!=(Frequency+1)) continue;
+ if (chan->Polarization()!=Polarization) continue;
+ channel=i;
+ return true;
+ }
+ }
+
+ // Still none found? Then try to find a channel with frequency - 1
+ for (int i=0; i<=Channels.MaxNumber(); i++)
+ {
+ chan = Channels.GetByNumber(i,0);
+ if (chan)
+ {
+ if (chan->Source()!=source) continue;
+ if (chan->Srate()!=Srate) continue;
+ if (chan->Frequency()!=(Frequency-1)) continue;
+ if (chan->Polarization()!=Polarization) continue;
+ channel=i;
+ return true;
+ }
+ }
+
+ // No channel available
channel=-1;
return false;
}