summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave <vdr@pickles.me.uk>2012-01-16 12:55:53 +0000
committerDave <vdr@pickles.me.uk>2012-01-16 12:55:53 +0000
commitbf302580e9e60b263b0dcdc82b4a324484991465 (patch)
tree97c8a3f74d649222ac36d361d6d68f2a3ff1d5b7
parentb558c7698348c084e6399afb7888f71c201d061f (diff)
downloadvdrtva-0.0.7.tar.gz
vdrtva-0.0.7.tar.bz2
Reorganised to stress 'patch' version is obsolete.v0.0.7
Added collection of 'Suggested CRIDS. Added notification of split events.
-rw-r--r--HISTORY (renamed from plugin/HISTORY)7
-rw-r--r--Makefile (renamed from plugin/Makefile)0
-rw-r--r--README (renamed from plugin/README)23
-rw-r--r--README - vps (renamed from plugin/README - vps)6
-rw-r--r--TODO13
-rw-r--r--obsolete-patch/HISTORY (renamed from patch/HISTORY)0
-rw-r--r--obsolete-patch/README (renamed from patch/README)0
-rw-r--r--obsolete-patch/README - series (renamed from patch/README - series)0
-rw-r--r--obsolete-patch/README - vps (renamed from patch/README - vps)0
-rw-r--r--obsolete-patch/TODO (renamed from patch/TODO)0
-rwxr-xr-xobsolete-patch/series.pl (renamed from patch/series.pl)0
-rw-r--r--obsolete-patch/vdrtva-1.6.0-2.diff (renamed from patch/vdrtva-1.6.0-2.diff)0
-rw-r--r--obsolete-patch/vdrtva-1.7.18.diff (renamed from patch/vdrtva-1.7.18.diff)0
-rw-r--r--obsolete-patch/vdrtva-1.7.20.diff (renamed from patch/vdrtva-1.7.20.diff)0
-rw-r--r--plugin/TODO10
-rw-r--r--vdrtva.c (renamed from plugin/vdrtva.c)115
-rw-r--r--vdrtva.h (renamed from plugin/vdrtva.h)30
-rw-r--r--vdrvps-1.7.22.diff (renamed from plugin/vdrvps-1.7.22.diff)0
18 files changed, 175 insertions, 29 deletions
diff --git a/plugin/HISTORY b/HISTORY
index 93a7782..fa65d43 100644
--- a/plugin/HISTORY
+++ b/HISTORY
@@ -25,7 +25,12 @@ VDR Plugin 'vdrtva' Revision History
- Added check for series links whenever a new timer is added.
- Added setup menu (not fully tested).
-2012-01-05 Version 0.0.6
+2012-01-05: Version 0.0.6
- Configuration of update time changed.
- Fixed bug in processing of updates.
- Patch version is now deprecated.
+
+2012-01-15: Version 0.0.7
+- Added collection of 'Suggested' CRIDs and SVDRP command to display them.
+- Added notification of split events.
+- Fixed (again) expiration of links.
diff --git a/plugin/Makefile b/Makefile
index 421a70e..421a70e 100644
--- a/plugin/Makefile
+++ b/Makefile
diff --git a/plugin/README b/README
index 7a9b012..fc9d9e2 100644
--- a/plugin/README
+++ b/README
@@ -29,11 +29,12 @@ descriptor ID 0x76. To save bandwith only the <data> section is sent, the <DNS
Name> part is taken from the Default Authority Descriptor in the SDT, and the
crid:// is assumed.
-A programme may have up to two CRIDs in its EPG entry. One identifies the
-specific item of content which is being broadcast, while the other identifies a
-series of programmes which this item belongs to. In FreeView Plus these CRIDs
-have crid_type values 0x31 and 0x32 respectively (TV-Anytime uses values 0x01
-and 0x02).
+A programme may have up to three CRIDs in its EPG entry. One identifies the
+specific item of content which is being broadcast, while another identifies a
+series of programmes which this item belongs to. The third type includes the
+CRIDs of 'suggested' events which the viewer might be interested in. In FreeView
+Plus these CRIDs have crid_type values 0x31 0x32 and 0x33 respectively
+(TV-Anytime uses values 0x01 - 0x03).
To give an example, the programme "Torchwood" broadcast on channel BBC2 at 21:00
on 2008-01-16 had item CRID '54BXLC' and series CRID 'KCJ00C'. When the same
@@ -61,6 +62,10 @@ The plugin runs every 24 hours at a time set by the '-u' parameter (default
- Checks that the event being recorded by each timer is the same as when the
timer was set (ie that the EPG has not changed in the meantime)
+- Flags any split events (eg a long programme with a news sumary in the middle).
+ At present a manual check is needed that all perts of the programme are set to
+ be recorded.
+
The plugin logs its activity through the VDR syslog.
The plugin has an SVDRP interface which is mainly used for debugging, but could
@@ -68,6 +73,8 @@ be used to interface with other applications. The commands are:
LSTL Print the series links list
+LSTS Print the 'suggested' events list
+
LSTY Print the CRIDs for each event
LSTZ Print the Default Authority data for each channel
@@ -79,7 +86,7 @@ UPDT Trigger an update of the series links.
Points to remember:
-- Not all channels on UK Freeview have CRIDs in the EPG Some radio channels
+- Not all channels on UK Freeview have CRIDs in the EPG. Some radio channels
have item CRIDs but none have series CRIDs.
- Different programme providers have different ideas of what constitutes a
@@ -91,9 +98,11 @@ Points to remember:
- A series link is created for every timer whether you want one or not.
-- This script has not been tested with multiple tuner cards or with mixed DVB-T
+- This plugin has not been tested with multiple tuner cards or with mixed DVB-T
and DVB-S setups.
+- The 'suggested' events list may contain duplicates and may have CRIDs which
+ do not appear in the events list.
Although I use this software on my VDR installation, this is Alpha-quality code
- USE AT YOUR OWN RISK!!
diff --git a/plugin/README - vps b/README - vps
index 8d172c2..68aff42 100644
--- a/plugin/README - vps
+++ b/README - vps
@@ -12,7 +12,7 @@ longer work.
To use VPS for accurate recording, some conditions must be met:
- VDR must be compiled with the 'VPS Fallback' patch (included with this
- plugin). Note that some Linux distributions (esp. Mandriva) include this
+ plugin). Note that some Linux distributions (eg. Mandriva) include this
patch in their binaries.
- Parameters 'UseVps' and 'VpsFallback' in setup.conf must both be set to 1
- Timers must have the 'use VPS' flag set
@@ -28,6 +28,8 @@ With these conditions met, the sequence of events is:
- When the running status changes to 'running', VDR starts recording
- When the running status changes to 'not running', VDR stops recording and
deletes the timer.
+- If the programme has not started by the time it was scheduled to finish,
+ monitoring is stopped and the timer is deleted.
CAUTION - VPS recordings seem to have a lower priority than live viewing. VDR
-will not interrupt live viewing to start looking for the start of a recording. \ No newline at end of file
+will not interrupt live viewing to start looking for the start of a recording.
diff --git a/TODO b/TODO
new file mode 100644
index 0000000..97193b7
--- /dev/null
+++ b/TODO
@@ -0,0 +1,13 @@
+Mail a log file after the update.
+
+Check split recordings should create timers if necessary.
+
+Timer clash check code needs to cope with multiple tuner cards.
+
+Test GUI configuration and Config file.
+
+Some events have a series CRID but no item CRID - how to handle these?
+
+Bugs:
+ 'Suggestions' list contains duplicates.
+ Rare crash 'pure virtual method called' in plugin.
diff --git a/patch/HISTORY b/obsolete-patch/HISTORY
index 9af5ce2..9af5ce2 100644
--- a/patch/HISTORY
+++ b/obsolete-patch/HISTORY
diff --git a/patch/README b/obsolete-patch/README
index af7b373..af7b373 100644
--- a/patch/README
+++ b/obsolete-patch/README
diff --git a/patch/README - series b/obsolete-patch/README - series
index 6e0956b..6e0956b 100644
--- a/patch/README - series
+++ b/obsolete-patch/README - series
diff --git a/patch/README - vps b/obsolete-patch/README - vps
index 5f4f38a..5f4f38a 100644
--- a/patch/README - vps
+++ b/obsolete-patch/README - vps
diff --git a/patch/TODO b/obsolete-patch/TODO
index ac4653d..ac4653d 100644
--- a/patch/TODO
+++ b/obsolete-patch/TODO
diff --git a/patch/series.pl b/obsolete-patch/series.pl
index 8423da9..8423da9 100755
--- a/patch/series.pl
+++ b/obsolete-patch/series.pl
diff --git a/patch/vdrtva-1.6.0-2.diff b/obsolete-patch/vdrtva-1.6.0-2.diff
index a8032f4..a8032f4 100644
--- a/patch/vdrtva-1.6.0-2.diff
+++ b/obsolete-patch/vdrtva-1.6.0-2.diff
diff --git a/patch/vdrtva-1.7.18.diff b/obsolete-patch/vdrtva-1.7.18.diff
index 775ebaa..775ebaa 100644
--- a/patch/vdrtva-1.7.18.diff
+++ b/obsolete-patch/vdrtva-1.7.18.diff
diff --git a/patch/vdrtva-1.7.20.diff b/obsolete-patch/vdrtva-1.7.20.diff
index 438d104..438d104 100644
--- a/patch/vdrtva-1.7.20.diff
+++ b/obsolete-patch/vdrtva-1.7.20.diff
diff --git a/plugin/TODO b/plugin/TODO
deleted file mode 100644
index 9b9a913..0000000
--- a/plugin/TODO
+++ /dev/null
@@ -1,10 +0,0 @@
-Handle CRID 'suggestions' via new SVDRP command.
-
-Mail a log file after the update.
-
-Missing functions from Perl script:
- Check split recordings
-
-Timer clash check code needs to cope with multiple tuner cards.
-
-Config file
diff --git a/plugin/vdrtva.c b/vdrtva.c
index bfc45cf..ce39114 100644
--- a/plugin/vdrtva.c
+++ b/vdrtva.c
@@ -19,6 +19,7 @@
cChanDAs *ChanDAs;
cEventCRIDs *EventCRIDs;
+cSuggestCRIDs *SuggestCRIDs;
cLinks *Links;
static const char *VERSION = "0.0.6";
@@ -53,6 +54,7 @@ private:
bool SaveLinksFile(void);
bool UpdateLinksFromTimers(void);
bool AddNewEventsToSeries(void);
+ bool CheckSplitTimers(void);
void CheckChangedEvents(void);
void CheckTimerClashes(void);
void FindAlternatives(const cEvent *event);
@@ -94,6 +96,7 @@ cPluginvdrTva::cPluginvdrTva(void)
Filter = NULL;
ChanDAs = NULL;
EventCRIDs = NULL;
+ SuggestCRIDs = NULL;
Links = NULL;
seriesLifetime = 30 * SECONDSPERDAY;
priority = 99;
@@ -282,6 +285,8 @@ const char **cPluginvdrTva::SVDRPHelpPages(void)
static const char *HelpPages[] = {
"LSTL\n"
" Print the Links list.",
+ "LSTS\n"
+ " Print the suggested events list",
"LSTY\n"
" Print the Event list including CRIDs.",
"LSTZ\n"
@@ -311,6 +316,21 @@ cString cPluginvdrTva::SVDRPCommand(const char *Command, const char *Option, int
if (buffer && length > 0) return cString(Reply(), true);
else return cString::sprintf("Nothing in the buffer!");
}
+ else if (strcasecmp(Command, "LSTS") == 0) {
+ if (SuggestCRIDs && (SuggestCRIDs->MaxNumber() >= 1)) {
+ ReplyCode = 250;
+ for (cSuggestCRID *suggestCRID = SuggestCRIDs->First(); suggestCRID; suggestCRID = SuggestCRIDs->Next(suggestCRID)) {
+ cChanDA *chanDA = ChanDAs->GetByChannelID(suggestCRID->Cid());
+ if(chanDA) {
+ Append("%s%s %s%s\n", chanDA->DA(), suggestCRID->iCRID(), chanDA->DA(), suggestCRID->gCRID());
+ }
+ }
+ if (buffer && length > 0) return cString(Reply(), true);
+ else return cString::sprintf("Nothing in the buffer!");
+ }
+ else
+ return cString::sprintf("No suggested events defined");
+ }
else if (strcasecmp(Command, "LSTY") == 0) {
if (EventCRIDs && (EventCRIDs->MaxNumber() >= 1)) {
ReplyCode = 250;
@@ -406,7 +426,9 @@ void cPluginvdrTva::StartDataCapture()
if (!Filter) {
if (EventCRIDs) delete EventCRIDs;
if (ChanDAs) delete ChanDAs;
+ if (SuggestCRIDs) delete SuggestCRIDs;
EventCRIDs = new cEventCRIDs();
+ SuggestCRIDs = new cSuggestCRIDs;
ChanDAs = new cChanDAs();
Filter = new cTvaFilter();
cDevice::ActualDevice()->AttachFilter(Filter);
@@ -435,6 +457,7 @@ void cPluginvdrTva::Check()
{
CheckChangedEvents();
CheckTimerClashes();
+ CheckSplitTimers();
isyslog("vdrtva: Checks complete");
}
@@ -493,17 +516,17 @@ bool cPluginvdrTva::SaveLinksFile()
cString oldlinks = AddDirectory(configDir, "links.old");
FILE *f = fopen(newlinks, "w");
if (f) {
- for (cLinkItem *Item = Links->First(); Item; Item = Links->Next(Item)) {
+ cLinkItem *Item = Links->First();
+ while (Item) {
+ cLinkItem *next = Links->Next(Item);
if ((Item->ModTime() + seriesLifetime) > time(NULL)) {
fprintf(f, "%s,%d;%s\n", Item->sCRID(), Item->ModTime(), Item->iCRIDs());
}
else {
isyslog ("vdrtva: Expiring series %s\n", Item->sCRID());
- cLinkItem *tmp = Links->Prev(Item);
- if (!tmp) tmp = Links->First();
Links->Del(Item);
- Item = tmp;
}
+ Item = next;
}
fclose(f);
unlink (oldlinks); // Allow to fail if the save file does not exist
@@ -700,6 +723,34 @@ void cPluginvdrTva::FindAlternatives(const cEvent *event)
if (!found) isyslog("vdrtva: No alternatives for '%s':", event->Title());
}
+// Check that, if any split events (eg a long programme with a news break in the middle)
+// are being recorded, that timers are set for all of the parts.
+// FIXME This may not work if the programme is being repeated. Inefficient algorithm.
+
+bool cPluginvdrTva::CheckSplitTimers(void)
+{
+ if (Timers.Count() == 0) return false;
+ for (int i = 0; i < Timers.Count(); i++) {
+ cTimer *timer = Timers.Get(i);
+ if (timer) {
+ const cEvent *event = timer->Event();
+ if (event) {
+ cChannel *channel = Channels.GetByChannelID(event->ChannelID());
+ cChanDA *chanda = ChanDAs->GetByChannelID(channel->Number());
+ cEventCRID *eventcrid = EventCRIDs->GetByID(channel->Number(), event->EventID());
+ if (eventcrid && chanda && strchr(eventcrid->iCRID(), '#')) {
+// char crid[Utf8BufSize(256)], *next;
+// strcpy(crid, eventcrid->iCRID());
+// char *prefix = strtok_r(crid, "#", &next);
+// char *suffix = strtok_r(NULL, "#", &next);
+ isyslog("Timer for split event '%s' found - check all parts are being recorded!", event->Title());
+ }
+ }
+ }
+ }
+ return false;
+}
+
/*
cTvaStatusMonitor - callback for timer changes.
@@ -830,7 +881,7 @@ void cTvaFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
cEventCRID *eventCRID = EventCRIDs->GetByID(chan->Number(), SiEitEvent.getEventId());
if (!eventCRID) {
SI::Descriptor *d;
- char iCRIDBuf[Utf8BufSize(1024)] = {'\0'}, sCRIDBuf[Utf8BufSize(1024)] = {'\0'};
+ char iCRIDBuf[Utf8BufSize(256)] = {'\0'}, sCRIDBuf[Utf8BufSize(256)] = {'\0'}, gCRIDBuf[Utf8BufSize(256)] = {'\0'};
for (SI::Loop::Iterator it2; (d = SiEitEvent.eventDescriptors.getNext(it2)); ) {
switch (d->getDescriptorTag()) {
case SI::ContentIdentifierDescriptorTag: {
@@ -839,16 +890,21 @@ void cTvaFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
for (SI::Loop::Iterator ite; (cd->identifierLoop.getNext(cde,ite)); ) {
if (cde.getCridLocation() == 0) {
switch (cde.getCridType()) {
- case 0x01: // ETSI 102 363 code
+ case 0x01: // ETSI 102 323 code
case 0x31: // UK Freeview private code
cde.identifier.getText(iCRIDBuf, sizeof(iCRIDBuf));
break;
- case 0x02: // ETSI 102 363 code
+ case 0x02: // ETSI 102 323 code
case 0x32: // UK Freeview private code
cde.identifier.getText(sCRIDBuf, sizeof(sCRIDBuf));
+ break;
// ETSI 102 323 defines CRID type 0x03, which describes 'related' or 'suggested' events.
// Freeview broadcasts these as CRID type 0x33.
// There can be more than one type 0x33 descriptor per event (each with one CRID).
+ case 0x03:
+ case 0x33:
+ cde.identifier.getText(gCRIDBuf, sizeof(gCRIDBuf)); // FIXME Rashly assuming that a 0x31 CRID will always precede a 0x33 CRID.
+ if (iCRIDBuf[0]) SuggestCRIDs->NewSuggestCRID(chan->Number(), iCRIDBuf, gCRIDBuf);
}
}
else {
@@ -1000,6 +1056,51 @@ cEventCRID *cEventCRIDs::NewEventCRID(int Cid, tEventID Eid)
/*
+ cSuggestCRID - CRIDs of suggested items for an event.
+*/
+
+cSuggestCRID::cSuggestCRID(void)
+{
+ iCrid = gCrid = NULL;
+}
+
+cSuggestCRID::~cSuggestCRID(void)
+{
+ free (iCrid);
+ free (gCrid);
+}
+
+void cSuggestCRID::Set(int Cid, char *iCRID, char *gCRID) {
+ iCrid = strcpyrealloc(iCrid, iCRID);
+ gCrid = strcpyrealloc(gCrid, gCRID);
+ cid = Cid;
+}
+
+
+/*
+ cSuggestCRIDs - in-memory list of suggested events
+*/
+
+cSuggestCRIDs::cSuggestCRIDs(void)
+{
+ maxNumber = 0;
+}
+
+cSuggestCRIDs::~cSuggestCRIDs(void)
+{
+}
+
+cSuggestCRID *cSuggestCRIDs::NewSuggestCRID(int cid, char *icrid, char *gcrid)
+{
+ cSuggestCRID *NewSuggestCRID = new cSuggestCRID;
+ NewSuggestCRID->Set(cid, icrid, gcrid);
+ Add(NewSuggestCRID);
+ SuggestCRIDs->SetMaxNumber(SuggestCRIDs->MaxNumber()+1);
+ return NewSuggestCRID;
+}
+
+
+/*
cLinkItem - Entry from the links file
*/
diff --git a/plugin/vdrtva.h b/vdrtva.h
index 4149b0c..85cbe17 100644
--- a/plugin/vdrtva.h
+++ b/vdrtva.h
@@ -35,8 +35,7 @@ private:
int newlifetime;
int newpriority;
int newseriesLifetime;
- int newupdatehours;
- int newupdatemins;
+ int newupdatetime;
protected:
virtual void Store(void);
public:
@@ -102,6 +101,33 @@ class cEventCRIDs : public cRwLock, public cConfig<cEventCRID> {
};
+class cSuggestCRID : public cListObject {
+ private:
+ char *iCrid;
+ char *gCrid;
+ int cid;
+ public:
+ cSuggestCRID(void);
+ ~cSuggestCRID(void);
+ char * iCRID(void) { return iCrid; }
+ char * gCRID(void) { return gCrid; }
+ int Cid(void) { return cid; }
+ void Set(int Cid, char *iCRID, char *gCRID);
+};
+
+
+class cSuggestCRIDs : public cRwLock, public cConfig<cSuggestCRID> {
+ private:
+ int maxNumber;
+ public:
+ cSuggestCRIDs(void);
+ ~cSuggestCRIDs(void);
+ int MaxNumber(void) { return maxNumber; }
+ void SetMaxNumber(int number) { maxNumber = number; }
+ cSuggestCRID *NewSuggestCRID(int Cid, char *icrid, char *gcrid);
+};
+
+
class cLinkItem : public cListObject {
private:
char *sCrid;
diff --git a/plugin/vdrvps-1.7.22.diff b/vdrvps-1.7.22.diff
index c851995..c851995 100644
--- a/plugin/vdrvps-1.7.22.diff
+++ b/vdrvps-1.7.22.diff