diff options
-rw-r--r-- | HISTORY.h | 7 | ||||
-rw-r--r-- | configs/epg.dat | 2 | ||||
-rw-r--r-- | lib/vdrlocks.h | 5 | ||||
-rw-r--r-- | recinfofile.c | 18 | ||||
-rw-r--r-- | recording.c | 92 |
5 files changed, 81 insertions, 43 deletions
@@ -5,10 +5,10 @@ * */ -#define _VERSION "1.1.77" +#define _VERSION "1.1.78" #define VERSION_DATE "22.12.2017" -#define DB_API 4 +#define DB_API 5 #ifdef GIT_REV # define VERSION _VERSION "-GIT" GIT_REV @@ -19,6 +19,9 @@ /* * ------------------------------------ +2017-12-22 version 1.1.78 (horchi) + - change: update of recording description handling + 2017-12-22 version 1.1.77 (horchi) - change: backward compatibility to vdr 2.2.0 - another step diff --git a/configs/epg.dat b/configs/epg.dat index 9e4cf7f..2e7958b 100644 --- a/configs/epg.dat +++ b/configs/epg.dat @@ -501,7 +501,7 @@ Table recordinglist TITLE "" title Ascii 200 Data, SHORTTEXT "" shorttext Ascii 300 Data, LONGDESCRIPTION "" longdescription MText 25000 Data, - // ORGDESCRIPTION "" orgdescription MText 25000 Data, + DESCRIPTION "" description MText 25000 Data, DURATION "" duration UInt 0 Data, FSK "" fsk UInt 1 Data, diff --git a/lib/vdrlocks.h b/lib/vdrlocks.h index 5032f09..c4aafd7 100644 --- a/lib/vdrlocks.h +++ b/lib/vdrlocks.h @@ -13,6 +13,11 @@ # include <vdr/config.h> # include <vdr/tools.h> +/* + * It must always be done in the sequence: + * Timers -> Channels -> Recordings -> Schedules +*/ + //*************************************************************************** // Timer List Lock Macros //*************************************************************************** diff --git a/recinfofile.c b/recinfofile.c index 9c48609..5a29eae 100644 --- a/recinfofile.c +++ b/recinfofile.c @@ -33,6 +33,7 @@ const char* cEventDetails::fields[] = "OTHER", "GUEST", "CAMERA", + "LONGDESCRIPTION", "SCRSERIESID", "SCRSERIESEPISODE", @@ -166,10 +167,7 @@ int cEventDetails::updateToRow(cDbRow* row) else if (value->getField()->isInt()) value->setValue(atoi(it->second.c_str())); else - { tell(0, "Info: Field '%s' unhandled for info.epg2vdr", it->first.c_str()); - continue; - } } return success; @@ -200,7 +198,12 @@ int cEventDetails::storeToFs(const char* path) // store fields for (it = values.begin(); it != values.end(); it++) - fprintf(f, "%s: %s\n", it->first.c_str(), it->second.c_str()); + { + char* value = strdup(it->second.c_str()); + strReplace(value, '\n', '|'); + fprintf(f, "%s: %s\n", it->first.c_str(), value); + free(value); + } free(fileName); fclose(f); @@ -257,7 +260,12 @@ int cEventDetails::loadFromFs(const char* path) p = skipspace(rTrim(p)); if (!isEmpty(p)) - values[s] = p; + { + char* value = strdup(p); + strReplace(value, '|', '\n'); + values[s] = value; + free(value); + } } free(fileName); diff --git a/recording.c b/recording.c index c95dc9f..1dd7cbb 100644 --- a/recording.c +++ b/recording.c @@ -357,7 +357,7 @@ int cUpdate::updateRecordingTable(int fullReload) int eventId = 0; std::string channelId = ""; const char* description = ""; - // const char* longdescription = ""; + std::string longdescription = ""; const char* title = rec->Name(); const cRecordingInfo* recInfo = rec->Info(); int pathOffset = 0; @@ -393,15 +393,37 @@ int cUpdate::updateRecordingTable(int fullReload) if (recInfo->GetEvent()) { - cXml xml; - eventId = recInfo->GetEvent()->EventID(); #if (defined (APIVERSNUM) && (APIVERSNUM >= 20304)) || (WITH_AUX_PATCH) - if (!isEmpty(recInfo->GetEvent()->Aux()) && xml.set(recInfo->GetEvent()->Aux()) == success) + if (channel) { - // if (XMLElement* e = xml.getElementByName("longdescription")) - // longdescription = e->GetText(); + cStateKey schedulesKey; + const cSchedules* schedules = cSchedules::GetSchedulesRead(schedulesKey, 500/*ms*/); + const cSchedule* s = schedules ? (cSchedule*)schedules->GetSchedule(channel) : 0; + const cEvent* event = s ? s->GetEvent(eventId) : 0; + + if (event) + { + cXml xml; + + if (isEmpty(event->Aux())) + tell(0, "AUX for '%s' is empty!", title); + + if (!isEmpty(event->Aux()) && xml.set(event->Aux()) == success) + { + tell(0, "search 'longdescription' for '%s'", title); + + if (XMLElement* element = xml.getElementByName("longdescription")) + { + tell(0, "found 'longdescription' for '%s'", title); + longdescription = element->GetText(); + } + } + } + + if (schedules) + schedulesKey.Remove(); } #endif } @@ -425,14 +447,14 @@ int cUpdate::updateRecordingTable(int fullReload) recordingListDb->setValue("PATH", rec->FileName()+pathOffset); recordingListDb->setValue("NAME", rec->BaseName()); recordingListDb->setValue("FOLDER", rec->Folder()); - recordingListDb->setValue("LONGDESCRIPTION", description); + recordingListDb->setValue("DESCRIPTION", description); recordingListDb->setValue("DURATION", rec->LengthInSeconds() > 0 ? rec->LengthInSeconds() : 0); recordingListDb->setValue("EVENTID", eventId); recordingListDb->setValue("CHANNELID", channelId.c_str()); recordingListDb->setValue("FSK", fsk); - // if (!isEmpty(longdescription)) - // recordingListDb->setValue("ORGDESCRIPTION", longdescription); // since 'LONGDESCRIPTION' already used for 'DESCRIPTION' :( + if (longdescription.length()) + recordingListDb->setValue("LONGDESCRIPTION", longdescription.c_str()); // scraping relevand data .. @@ -452,32 +474,32 @@ int cUpdate::updateRecordingTable(int fullReload) if (recordingListDb->getChanges() > baseChanges) { - int isSeries = recordingListDb->hasValue("CATEGORY", "Serie"); - int changed = no; - - if (isSeries) - { - if (recordingListDb->getValue("SCRSERIESID")->isEmpty() || - !recordingListDb->hasValue("SCRSERIESEPISODE", recordingListDb->getIntValue("SCRINFOEPISODEID")) || - !recordingListDb->hasValue("SCRSERIESID", recordingListDb->getIntValue("SCRINFOSERIESID"))) - { - changed = yes; - } - } - else - { - if (recordingListDb->getValue("SCRMOVIEID")->isEmpty() || - !recordingListDb->hasValue("SCRMOVIEID", recordingListDb->getIntValue("SCRINFOMOVIEID"))) - { - changed = yes; - } - } - - if (changed) - { - recordingListDb->setValue("SCRNEW", yes); // force scrap - recordingListDb->setValue("SCRSP", time(0)); // force load from vdr - } + // int isSeries = recordingListDb->hasValue("CATEGORY", "Serie"); + // int changed = no; + + // if (isSeries) + // { + // if (recordingListDb->getValue("SCRSERIESID")->isEmpty() || + // !recordingListDb->hasValue("SCRSERIESEPISODE", recordingListDb->getIntValue("SCRINFOEPISODEID")) || + // !recordingListDb->hasValue("SCRSERIESID", recordingListDb->getIntValue("SCRINFOSERIESID"))) + // { + // changed = yes; + // } + // } + // else + // { + // if (recordingListDb->getValue("SCRMOVIEID")->isEmpty() || + // !recordingListDb->hasValue("SCRMOVIEID", recordingListDb->getIntValue("SCRINFOMOVIEID"))) + // { + // changed = yes; + // } + // } + + // if (changed) + // { + recordingListDb->setValue("SCRNEW", yes); // force scrap + recordingListDb->setValue("SCRSP", time(0)); // force load from vdr + // } } // don't toggle uuid if already set! |