diff options
author | Dave <vdr@pickles.me.uk> | 2012-05-17 13:05:23 +0100 |
---|---|---|
committer | Dave <vdr@pickles.me.uk> | 2012-05-17 13:05:23 +0100 |
commit | b0f3e30818ccb382c6827abe798dda63562fc6fe (patch) | |
tree | 10f8981240d9087e73832245b0686a514d8ab7a5 | |
parent | d1be7aa3e914f34044bcca4caf7f8772740e1976 (diff) | |
download | vdrtva-0.2.1.tar.gz vdrtva-0.2.1.tar.bz2 |
Add series title to links file.v0.2.1
-rw-r--r-- | HISTORY | 8 | ||||
-rw-r--r-- | README | 15 | ||||
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | vdrtva.c | 61 | ||||
-rw-r--r-- | vdrtva.h | 9 |
5 files changed, 71 insertions, 24 deletions
@@ -57,3 +57,11 @@ VDR Plugin 'vdrtva' Revision History - Handle timers recording into subdirectories. - Gather CRID data continuously. - Plugin now compatible with New Zealand DVB-S. + +2012-05-16: Version 0.2.1 +- Suppress a few compiler warnings with GCC 4.6. +- Correctly maintain list counts. +- Rename patch file to match distros. +- Add patch for latest VDR version (1.7.27). +- Include series title in links file. +- Included format of links file in README. @@ -51,6 +51,7 @@ previous week. Hence it is possible for a PVR to record an entire series by using the series CRID, or to find an alternative broadcast for an individual item if there is a clash with another recording. + Operation: The use of the 'Accurate Recording' feature is described in README-vps. @@ -108,6 +109,20 @@ STRT UPDT Trigger an update of the series links. + +The plugin stores details of series links in the file links.data which is in the +VIDEODIR/plugins directory. Entries in this file have the format: + +<scrid>,<modtime>;<icrids>;<path>;<title> + +scrid The series CRID. +modtime The start time of the last event in this series. +icrids The CRIDS of the events in the series, separated by colons. +path The subdirectory to store recordings in this series, taken from the first + timer, or the string (NULL) if no subdirectory was given. +title The title of the first event in the series. + + Points to remember: - Not all channels on UK Freeview have CRIDs in the EPG. Some radio channels @@ -12,5 +12,7 @@ Delete a series link if the only timer is manually deleted. Display suggestions for timers which don't have series CRIDs. +OSD for managing series links (work in progress). + Bugs: Very rare crash 'pure virtual method called' in plugin - possibly solved. @@ -22,9 +22,9 @@ cEventCRIDs *EventCRIDs; cSuggestCRIDs *SuggestCRIDs; cLinks *Links; -static const char *VERSION = "0.2.0"; +static const char *VERSION = "0.2.1"; static const char *DESCRIPTION = "Series Record plugin"; -//static const char *MAINMENUENTRY = "vdrTva"; +//static const char *MAINMENUENTRY = "Series Links"; int collectionperiod; // Time to collect all CRID data (default 10 minutes) int lifetime; // Lifetime of series link recordings (default 99) @@ -42,7 +42,7 @@ private: cTvaFilter *Filter; cTvaStatusMonitor *statusMonitor; bool AppendItems(const char* Option); - bool AddSeriesLink(const char *scrid, int modtime, const char *icrid, const char *path); + bool AddSeriesLink(const char *scrid, int modtime, const char *icrid, const char *path, const char *title); void LoadLinksFile(void); bool SaveLinksFile(void); bool UpdateLinksFromTimers(void); @@ -76,6 +76,8 @@ public: virtual void MainThreadHook(void); virtual cString Active(void); virtual time_t WakeupTime(void); +// virtual const char *MainMenuEntry(void) { return tr(MAINMENUENTRY); } + virtual cOsdObject *MainMenuAction(void); virtual cMenuSetupPage *SetupMenu(void); virtual bool SetupParse(const char *Name, const char *Value); virtual bool Service(const char *Id, void *Data = NULL); @@ -287,6 +289,12 @@ time_t cPluginvdrTva::WakeupTime(void) return 0; } +cOsdObject *cPluginvdrTva::MainMenuAction(void) +{ + // Perform the action when selected from the main VDR menu. + return NULL; +} + cMenuSetupPage *cPluginvdrTva::SetupMenu(void) { // Return a setup menu in case the plugin supports one. @@ -360,7 +368,7 @@ cString cPluginvdrTva::SVDRPCommand(const char *Command, const char *Option, int if (Links && (Links->MaxNumber() >=1)) { ReplyCode = 250; for (cLinkItem *linkItem = Links->First(); linkItem; linkItem = Links->Next(linkItem)) { - reply.Append("%s,%d;%s;%s\n", linkItem->sCRID(), linkItem->ModTime(), linkItem->iCRIDs(), linkItem->Path()); + reply.Append("%s,%d;%s;%s;%s\n", linkItem->sCRID(), linkItem->ModTime(), linkItem->iCRIDs(), linkItem->Path(), linkItem->Title()); } } if (reply.Length() > 0) return cString(reply.Buffer()); @@ -523,7 +531,7 @@ void cPluginvdrTva::Report() // add a new event to the Links table, either as an addition to an existing series or as a new series. // return false = nothing done, true = new event for old series, or new series. -bool cPluginvdrTva::AddSeriesLink(const char *scrid, int modtime, const char *icrid, const char *path) +bool cPluginvdrTva::AddSeriesLink(const char *scrid, int modtime, const char *icrid, const char *path, const char *title) { if (Links && (Links->MaxNumber() >=1)) { for (cLinkItem *Item = Links->First(); Item; Item = Links->Next(Item)) { @@ -531,7 +539,8 @@ bool cPluginvdrTva::AddSeriesLink(const char *scrid, int modtime, const char *ic if (strstr(Item->iCRIDs(), icrid) == NULL) { cString icrids = cString::sprintf("%s:%s", Item->iCRIDs(), icrid); modtime = max(Item->ModTime(), modtime); - Item->Set(Item->sCRID(), modtime, icrids, Item->Path()); + Item->SetModtime(modtime); + Item->SetIcrids(icrids); isyslog("vdrtva: Adding new event %s to series %s", icrid, scrid); return true; } @@ -539,8 +548,8 @@ bool cPluginvdrTva::AddSeriesLink(const char *scrid, int modtime, const char *ic } } } - Links->NewLinkItem(scrid, modtime, icrid, path); - isyslog("vdrtva: Creating new series %s for event %s", scrid, icrid); + Links->NewLinkItem(scrid, modtime, icrid, path, title); + isyslog("vdrtva: Creating new series %s for event %s (%s)", scrid, icrid, title); return true; } @@ -559,8 +568,10 @@ void cPluginvdrTva::LoadLinksFile() char *mtime = strtok_r(NULL, ";", &strtok_next); char *icrids = strtok_r(NULL, ";", &strtok_next); char *path = strtok_r(NULL, ";", &strtok_next); + char *title = strtok_r(NULL, "`", &strtok_next); modtime = atoi(mtime); - Links->NewLinkItem(scrid, modtime, icrids, path); + if ((path != NULL) && (!strcmp(path, "(NULL)"))) path = NULL; + Links->NewLinkItem(scrid, modtime, icrids, path, title); } fclose (f); isyslog("vdrtva: loaded %d series links", Links->MaxNumber()); @@ -578,7 +589,11 @@ bool cPluginvdrTva::SaveLinksFile() for (cLinkItem *Item = Links->First(); Item; Item = Links->Next(Item)) { fprintf(f, "%s,%d;%s", Item->sCRID(), Item->ModTime(), Item->iCRIDs()); if (Item->Path()) { - fprintf(f, ";%s\n", Item->Path()); + fprintf(f, ";%s", Item->Path()); + } + else fprintf(f, ";(NULL)"); + if (Item->Title()) { + fprintf(f, ";%s\n", Item->Title()); } else fprintf(f, "\n"); } @@ -613,9 +628,10 @@ bool cPluginvdrTva::UpdateLinksFromTimers() char *path = strcpyrealloc(NULL, ti->File()); if (char *p = strrchr(path, '~')) { *p = '\0'; - status |= AddSeriesLink(scrid, event->StartTime(), icrid, path); + p++; + status |= AddSeriesLink(scrid, event->StartTime(), icrid, path, p); } - else status |= AddSeriesLink(scrid, event->StartTime(), icrid, NULL); + else status |= AddSeriesLink(scrid, event->StartTime(), icrid, NULL, path); free (path); } } @@ -655,9 +671,8 @@ bool cPluginvdrTva::AddNewEventsToSeries() if (schedule) { const cEvent *event = schedule->GetEvent(eventCRID->Eid()); if (CreateTimerFromEvent(event, Item->Path())) { - AddSeriesLink(scrid, event->StartTime(), icrid, NULL); + AddSeriesLink(scrid, event->StartTime(), icrid, NULL, NULL); saveNeeded = true; -// FindSuggestions(event); } } } @@ -1421,12 +1436,13 @@ void cSuggestCRIDs::Expire(void) { cLinkItem - Entry from the links file */ -cLinkItem::cLinkItem(const char *sCRID, int ModTime, const char *iCRIDs, const char *Path) +cLinkItem::cLinkItem(const char *sCRID, int ModTime, const char *iCRIDs, const char *Path, const char *Title) { sCrid = strcpyrealloc(NULL, sCRID); modtime = ModTime; iCrids = strcpyrealloc(NULL, iCRIDs); path = strcpyrealloc(NULL, Path); + title = strcpyrealloc(NULL, Title); } cLinkItem::~cLinkItem(void) @@ -1434,14 +1450,17 @@ cLinkItem::~cLinkItem(void) free(sCrid); free(iCrids); free(path); + free(title); } -void cLinkItem::Set(const char *sCRID, int ModTime, const char *iCRIDs, const char *Path) +void cLinkItem::SetModtime(int ModTime) { - sCrid = strcpyrealloc(sCrid, sCRID); modtime = ModTime; - iCrids = strcpyrealloc(iCrids, iCRIDs); - path = strcpyrealloc(path, Path); +} + +void cLinkItem::SetIcrids(const char *icrids) +{ + iCrids = strcpyrealloc(iCrids, icrids); } /* @@ -1453,9 +1472,9 @@ cLinks::cLinks(void) maxNumber = 0; } -cLinkItem *cLinks::NewLinkItem(const char *sCRID, int ModTime, const char *iCRIDs, const char *path) +cLinkItem *cLinks::NewLinkItem(const char *sCRID, int ModTime, const char *iCRIDs, const char *path, const char *title) { - cLinkItem *NewLinkItem = new cLinkItem(sCRID, ModTime, iCRIDs, path); + cLinkItem *NewLinkItem = new cLinkItem(sCRID, ModTime, iCRIDs, path, title); Add(NewLinkItem); maxNumber++; return NewLinkItem; @@ -167,14 +167,17 @@ class cLinkItem : public cListObject { int modtime; char *iCrids; char *path; + char *title; public: - cLinkItem(const char *sCRID, int ModTime, const char *iCRIDs, const char *Path); + cLinkItem(const char *sCRID, int ModTime, const char *iCRIDs, const char *Path, const char *Title); ~cLinkItem(void); - void Set(const char *sCRID, int ModTime, const char *iCRIDs, const char *Path); + void SetModtime(int modtime); + void SetIcrids(const char *icrids); char * iCRIDs(void) { return iCrids; } char * sCRID(void) { return sCrid; } int ModTime(void) { return modtime; } char * Path(void) { return path; } + char * Title(void) { return title; } }; class cLinks : public cRwLock, public cConfig<cLinkItem> { @@ -183,7 +186,7 @@ class cLinks : public cRwLock, public cConfig<cLinkItem> { public: cLinks(void); int MaxNumber(void) { return maxNumber; } - cLinkItem *NewLinkItem(const char *sCRID, int ModTime, const char *iCRIDs, const char *Path); + cLinkItem *NewLinkItem(const char *sCRID, int ModTime, const char *iCRIDs, const char *Path, const char *Title); bool DeleteItem(const char *sCRID); bool Expire(void); }; |