diff options
author | horchi <vdr@jwendel.de> | 2019-11-02 16:59:34 +0100 |
---|---|---|
committer | horchi <vdr@jwendel.de> | 2019-11-02 16:59:34 +0100 |
commit | 2d209b6715738cfcdbb4f0c9109c02d7b5ec3b81 (patch) | |
tree | 68430a49310385651addec94749c494a480d5f29 | |
parent | 8695dac6a305c0e0abe6966ad164490471a84067 (diff) | |
download | vdr-plugin-epg2vdr-2d209b6715738cfcdbb4f0c9109c02d7b5ec3b81.tar.gz vdr-plugin-epg2vdr-2d209b6715738cfcdbb4f0c9109c02d7b5ec3b81.tar.bz2 |
dev
-rw-r--r-- | configs/epg.dat | 6 | ||||
-rw-r--r-- | menu.c | 31 | ||||
-rw-r--r-- | menu.h | 19 | ||||
-rw-r--r-- | menurec.c | 382 | ||||
-rw-r--r-- | recinfofile.c | 91 |
5 files changed, 235 insertions, 294 deletions
diff --git a/configs/epg.dat b/configs/epg.dat index e0d5de5..4a4129b 100644 --- a/configs/epg.dat +++ b/configs/epg.dat @@ -517,6 +517,9 @@ Table recordinglist INUSE "" inuse UInt 1 Data, JOB "" job Ascii 1 Data, + GROUP "category/genre group (for menu)" recgroup Ascii 100 Data, + NGENRE "normalized genre (for menu)" ngenre Ascii 50 Data, + // enriched by 'external' data of events ACTOR "" actor MText 5000 Data, @@ -672,7 +675,8 @@ Table searchtimers CHANNELIDS "comma separated list of channleids or empty" channelids Ascii 500 Data, CHEXCLUDE "" chexclude UInt 0 Data, CHFORMAT "HD,SD" chformat Ascii 50 Data, - + CHNUMMIN "min channel number" chnummin UInt 0 Data, + CHNUMMAX "max channel number" chnummax UInt 0 Data, NAME "Bezeichung des Suchtimers" name Ascii 100 Data, EXPRESSION "" expression Ascii 200 Data, EXPRESSION1 "" expression1 Ascii 200 Data, @@ -344,25 +344,42 @@ int cMenuDb::initDb() selectRecordingsGrouped = new cDbStatement(recordingListDb); selectRecordingsGrouped->build("select "); - selectRecordingsGrouped->bind("CATEGORY", cDBS::bndOut); + selectRecordingsGrouped->bind("GROUP", cDBS::bndOut); + selectRecordingsGrouped->bind("CATEGORY", cDBS::bndOut, ", "); selectRecordingsGrouped->bind("GENRE", cDBS::bndOut, ", "); + selectRecordingsGrouped->bind("NGENRE", cDBS::bndOut, ", "); selectRecordingsGrouped->bind(&groupCount, cDBS::bndOut, ", "); selectRecordingsGrouped->build(" from %s where ", recordingListDb->TableName()); selectRecordingsGrouped->build(" (%s <> 'D' or %s is null)", recordingListDb->getField("STATE")->getDbName(), recordingListDb->getField("STATE")->getDbName()); - selectRecordingsGrouped->build(" group by ifnull(%s, 'unknown'), ifnull(%s, 'unknown')", - recordingListDb->getField("CATEGORY")->getDbName(), - recordingListDb->getField("GENRE")->getDbName()); - selectRecordingsGrouped->build(" order by ifnull(%s, 'unknown'), ifnull(%s, 'unknown')", - recordingListDb->getField("CATEGORY")->getDbName(), - recordingListDb->getField("GENRE")->getDbName()); + selectRecordingsGrouped->build(" group by %s", recordingListDb->getField("GROUP")->getDbName()); + selectRecordingsGrouped->build(" order by %s", recordingListDb->getField("GROUP")->getDbName()); status += selectRecordingsGrouped->prepare(); // select * // from recordinglist where // (state <> 'D' or state is null) + // and category = ? + // order by starttime + + selectRecordingByGroup = new cDbStatement(recordingListDb); + + selectRecordingByGroup->build("select "); + selectRecordingByGroup->bindAllOut(); + selectRecordingByGroup->build(" from %s where ", recordingListDb->TableName()); + selectRecordingByGroup->build(" (%s <> 'D' or %s is null)", + recordingListDb->getField("STATE")->getDbName(), + recordingListDb->getField("STATE")->getDbName()); + selectRecordingByGroup->bind("GROUP", cDBS::bndIn | cDBS::bndSet, " and "); + selectRecordingByGroup->build(" order by %s", recordingListDb->getField("STARTTIME")->getDbName()); + + status += selectRecordingByGroup->prepare(); + + // select * + // from recordinglist where + // (state <> 'D' or state is null) // and title like ? // and shorttext like ? @@ -136,6 +136,7 @@ class cMenuDb : public cParameters cDbStatement* selectRecordingForEventByLv {nullptr}; cDbStatement* selectRecordings {nullptr}; cDbStatement* selectRecordingsGrouped {nullptr}; + cDbStatement* selectRecordingByGroup {nullptr}; cDbStatement* selectChannelFromMap {nullptr}; cSearchTimer* search {nullptr}; @@ -565,38 +566,32 @@ class cMenuDbRecordings : public cOsdMenu { public: - cMenuDbRecordings(const char* Base = nullptr, int Level = 0, bool OpenSubMenus = false); + cMenuDbRecordings(const char* Base = nullptr, int Level = 0, const char* Group = 0, bool OpenSubMenus = false); virtual ~cMenuDbRecordings(); virtual eOSState ProcessKey(eKeys Key); - static void SetPath(const char* Path); - static void SetRecording(const char* FileName); - - protected: - - cString DirectoryName(); private: - void SetHelpKeys(); void LoadPlain(bool Refresh = false); void LoadGrouped(bool Refresh = false); + void LoadGroup(const char* group, bool Refresh = false); + bool Open(bool OpenSubMenus = false); eOSState Play(); eOSState Rewind(); - // eOSState Delete(); - // eOSState Info(); eOSState Sort(); eOSState Commands(eKeys Key = kNone); + void SetHelpKeys(); + // data cMenuDb* menuDb {nullptr}; char* base {nullptr}; + char* group {nullptr}; int level {-1}; int helpKeys {-1}; cStateKey recordingsStateKey; // list lock - static cString path; - static cString fileName; }; @@ -5,6 +5,13 @@ * */ +/* + Inbetribnahme: + truncate recordinglist; commit; + #> systemctrl start vdr + #> svdrpsend PLUG epg2vdr UPDREC +*/ + #include <vdr/menuitems.h> #include <vdr/status.h> #include <vdr/menu.h> @@ -17,6 +24,10 @@ #include "menu.h" #include "ttools.h" +//*************************************************************************** +// Item Base Class +//*************************************************************************** + class cMenuDbRecordingItemBase : public cOsdItem { public: @@ -26,7 +37,7 @@ class cMenuDbRecordingItemBase : public cOsdItem virtual const char* Name() const { return name; } virtual const cRecording* Recording() const = 0; - virtual bool IsDirectory() const = 0; + virtual bool isDirectory() const = 0; protected: @@ -34,7 +45,7 @@ class cMenuDbRecordingItemBase : public cOsdItem }; //*************************************************************************** -// Class cMenuDbRecordingItem +// Class Recording Item //*************************************************************************** class cMenuDbRecordingItem : public cMenuDbRecordingItemBase @@ -45,17 +56,14 @@ class cMenuDbRecordingItem : public cMenuDbRecordingItemBase virtual ~cMenuDbRecordingItem(); - int Level() const { return level; } - const cRecording* Recording() const override { return recording; } - bool IsDirectory() const override { return false; } + bool isDirectory() const override { return false; } void SetRecording(const cRecording* Recording) { recording = Recording; } virtual void SetMenuItem(cSkinDisplayMenu* DisplayMenu, int Index, bool Current, bool Selectable); private: const cRecording* recording {nullptr}; - int level {0}; cMenuDb* menuDb {nullptr}; }; @@ -65,31 +73,28 @@ cMenuDbRecordingItem::cMenuDbRecordingItem(cMenuDb* db, const cRecording* Record recording = Recording; name = nullptr; + int level = 0; + for (const char* p = Recording->Title(); *p; p++) if (*p == '~') level++; SetText(Recording->Title('\t', true, level)); tell(0, "Added recording for file '%s'", Recording->Title()); - - // a folder? - - // if (*Text() == '\t') - // name = strdup(Text() + 2); // 'Text() + 2' to skip the two '\t' } cMenuDbRecordingItem::~cMenuDbRecordingItem() { } -void cMenuDbRecordingItem::SetMenuItem(cSkinDisplayMenu *DisplayMenu, int Index, bool Current, bool Selectable) +void cMenuDbRecordingItem::SetMenuItem(cSkinDisplayMenu* DisplayMenu, int Index, bool Current, bool Selectable) { - if (!DisplayMenu->SetItemRecording(recording, Index, Current, Selectable, level, 0, 0)) - DisplayMenu->SetItem(Text(), Index, Current, Selectable); + if (!DisplayMenu->SetItemRecording(recording, Index, Current, Selectable, 0/*level*/, 0, 0)) + DisplayMenu->SetItem(Text(), Index, Current, Selectable); } //*************************************************************************** -// Class cMenuDbRecordingItem +// Class Folder Item //*************************************************************************** class cMenuDbRecordingFolderItem : public cMenuDbRecordingItemBase @@ -102,7 +107,7 @@ class cMenuDbRecordingFolderItem : public cMenuDbRecordingItemBase // void IncrementCounter(bool New); const cRecording* Recording() const override { return tmpRecording; } - bool IsDirectory() const override { return true; } + bool isDirectory() const override { return true; } virtual void SetMenuItem(cSkinDisplayMenu* DisplayMenu, int Index, bool Current, bool Selectable); private: @@ -149,37 +154,45 @@ void cMenuDbRecordingFolderItem::SetMenuItem(cSkinDisplayMenu* DisplayMenu, int //*************************************************************************** // Class cMenuDbRecordings //*************************************************************************** +//*************************************************************************** +// Object +//*************************************************************************** -cString cMenuDbRecordings::path; -cString cMenuDbRecordings::fileName; - -cMenuDbRecordings::cMenuDbRecordings(const char* Base, int Level, bool OpenSubMenus) +cMenuDbRecordings::cMenuDbRecordings(const char* Base, int Level, const char* Group, bool OpenSubMenus) : cOsdMenu(Base ? Base : tr("Recordings"), 9, 6, 6) { menuDb = new cMenuDb; + level = Level; SetMenuCategory(mcRecording); + group = Group ? strdup(Group) : nullptr; base = Base ? strdup(Base) : nullptr; - level = Setup.RecordingDirs ? Level : -1; Display(); // this keeps the higher level menus from showing up briefly when pressing 'Back' during replay + tell(0, "open recording menu '%s' for group '%s'", base, group ? group : ""); + if (menuDb->dbConnected()) { - LoadGrouped(); // LoadPlain(); + if (!isEmpty(group)) + LoadGroup(group); + else + LoadGrouped(); + + // LoadPlain(); } if (Current() < 0) SetCurrent(First()); - else if (OpenSubMenus && (cReplayControl::LastReplayed() || *path || *fileName)) - { - if (!*path || Level < strcountchr(path, FOLDERDELIMCHAR)) - { - if (Open(true)) - return; - } - } + // else if (OpenSubMenus && (cReplayControl::LastReplayed())) + // { + // if (!*path || Level < strcountchr(path, FOLDERDELIMCHAR)) + // { + // if (Open(true)) + // return; + // } + // } Display(); SetHelpKeys(); @@ -189,16 +202,14 @@ cMenuDbRecordings::~cMenuDbRecordings() { // cMenuDbRecordingItem* ri = (cMenuDbRecordingItem*)Get(Current()); - // if (ri && !ri->IsDirectory()) - // SetRecording(ri->Recording()->FileName()); - delete menuDb; + free(group); free(base); } //*************************************************************************** -// +// Set Help Keys //*************************************************************************** void cMenuDbRecordings::SetHelpKeys(void) @@ -208,7 +219,7 @@ void cMenuDbRecordings::SetHelpKeys(void) if (ri) { - if (ri->IsDirectory()) + if (ri->isDirectory()) NewHelpKeys = 1; else NewHelpKeys = 2; @@ -240,16 +251,9 @@ void cMenuDbRecordings::LoadGrouped(bool Refresh) for (int res = menuDb->selectRecordingsGrouped->find(); res; res = menuDb->selectRecordingsGrouped->fetch()) { - char* folderTitle {nullptr}; - - asprintf(&folderTitle, "%s / %s", - menuDb->recordingListDb->getValue("CATEGORY")->isNull() ? "unknown" : menuDb->recordingListDb->getStrValue("CATEGORY"), - menuDb->recordingListDb->getValue("GENRE")->isNull() ? "unknown" : menuDb->recordingListDb->getStrValue("GENRE")); - - tell(0, "Added recording folder '%s'", folderTitle); - Add(new cMenuDbRecordingFolderItem(menuDb, folderTitle, menuDb->groupCount.getIntValue())); - - free(folderTitle); + const char* group = menuDb->recordingListDb->getStrValue("GROUP"); + tell(0, "Added recording folder '%s'", group); + Add(new cMenuDbRecordingFolderItem(menuDb, group, menuDb->groupCount.getIntValue())); } menuDb->selectRecordingsGrouped->freeResult(); @@ -261,10 +265,10 @@ void cMenuDbRecordings::LoadGrouped(bool Refresh) } //*************************************************************************** -// Load Plain +// Load recordings of a Group //*************************************************************************** -void cMenuDbRecordings::LoadPlain(bool Refresh) +void cMenuDbRecordings::LoadGroup(const char* group, bool Refresh) { if (!cRecordings::GetRecordingsRead(recordingsStateKey)) return ; @@ -281,147 +285,83 @@ void cMenuDbRecordings::LoadPlain(bool Refresh) Clear(); menuDb->recordingListDb->clear(); + menuDb->recordingListDb->setValue("GROUP", group); - for (int res = menuDb->selectRecordings->find(); res; res = menuDb->selectRecordings->fetch()) + for (int res = menuDb->selectRecordingByGroup->find(); res; res = menuDb->selectRecordingByGroup->fetch()) { char* fileName {nullptr}; asprintf(&fileName, "%s/%s", cVideoDirectory::Name(), menuDb->recordingListDb->getStrValue("PATH")); const cRecording* recording = Recordings->GetByName(fileName); if (recording) - { - // tell(0, "Added recording for file '%s'", fileName); Add(new cMenuDbRecordingItem(menuDb, recording)); - } else - tell(0, "Fatal: Recording for file '%s' not found", fileName); + tell(0, "Error: Recording for file '%s' not found, skipped", fileName); free(fileName); } - menuDb->selectRecordings->freeResult(); + menuDb->selectRecordingByGroup->freeResult(); recordingsStateKey.Remove(false); if (Refresh) Display(); +} - return ; - - /* - // ------------------------------------------------------ +//*************************************************************************** +// Load Plain +//*************************************************************************** +void cMenuDbRecordings::LoadPlain(bool Refresh) +{ if (!cRecordings::GetRecordingsRead(recordingsStateKey)) return ; recordingsStateKey.Remove(); - const char* CurrentRecording = *fileName ? *fileName : cReplayControl::LastReplayed(); - cRecordings* Recordings = cRecordings::GetRecordingsWrite(recordingsStateKey); // write access is necessary for sorting! - cMenuDbRecordingItem *LastItem = NULL; + cRecordings* Recordings = cRecordings::GetRecordingsWrite(recordingsStateKey); - if (!CurrentRecording) + if (!Recordings) { - if (cMenuDbRecordingItem *ri = (cMenuDbRecordingItem*)Get(Current())) - CurrentRecording = ri->Recording()->FileName(); + tell(0, "Fatal: Can't get recording lock"); + return ; } - int current = Current(); Clear(); - GetRecordingsSortMode(DirectoryName()); - Recordings->Sort(); - for (const cRecording *Recording = Recordings->First(); Recording; Recording = Recordings->Next(Recording)) + menuDb->recordingListDb->clear(); + + for (int res = menuDb->selectRecordings->find(); res; res = menuDb->selectRecordings->fetch()) { - if ((!filter || filter->Filter(Recording)) && (!base || (strstr(Recording->Name(), base) == Recording->Name() && Recording->Name()[strlen(base)] == FOLDERDELIMCHAR))) - { - cMenuDbRecordingItem *Item = new cMenuDbRecordingItem(Recording, level); - cMenuDbRecordingItem *LastDir = NULL; - - if (Item->IsDirectory()) - { - // Sorting may ignore non-alphanumeric characters, so we need to explicitly handle directories in case they only differ in such characters: - - for (cMenuDbRecordingItem* p = LastItem; p; p = dynamic_cast<cMenuDbRecordingItem*>(p->Prev())) - { - if (p->Name() && strcmp(p->Name(), Item->Name()) == 0) - { - LastDir = p; - break; - } - } - } - - if (*Item->Text() && !LastDir) - { - Add(Item); - LastItem = Item; - - if (Item->IsDirectory()) - LastDir = Item; - } - else - delete Item; - - if (LastItem || LastDir) - { - if (*path) - { - if (strcmp(path, Recording->Folder()) == 0) - SetCurrent(LastDir ? LastDir : LastItem); - } - else if (CurrentRecording && strcmp(CurrentRecording, Recording->FileName()) == 0) - SetCurrent(LastDir ? LastDir : LastItem); - } - - if (LastDir) - LastDir->IncrementCounter(Recording->IsNew()); - } + char* fileName {nullptr}; + asprintf(&fileName, "%s/%s", cVideoDirectory::Name(), menuDb->recordingListDb->getStrValue("PATH")); + const cRecording* recording = Recordings->GetByName(fileName); + + if (recording) + Add(new cMenuDbRecordingItem(menuDb, recording)); + else + tell(0, "Fatal: Recording for file '%s' not found", fileName); + + free(fileName); } - if (Current() < 0) - SetCurrent(Get(current)); // last resort, in case the recording was deleted + menuDb->selectRecordings->freeResult(); - SetMenuSortMode(RecordingsSortMode == rsmName ? msmName : msmTime); - recordingsStateKey.Remove(false); // sorting doesn't count as a real modification + recordingsStateKey.Remove(false); if (Refresh) Display(); - */ } //*************************************************************************** -// +// Open //*************************************************************************** -void cMenuDbRecordings::SetPath(const char *Path) -{ - path = Path; -} - -void cMenuDbRecordings::SetRecording(const char *FileName) -{ - fileName = FileName; -} - -cString cMenuDbRecordings::DirectoryName(void) -{ - cString d(cVideoDirectory::Name()); - - if (base) - { - char *s = ExchangeChars(strdup(base), true); - d = AddDirectory(d, s); - free(s); - } - - return d; -} - bool cMenuDbRecordings::Open(bool OpenSubMenus) { cMenuDbRecordingItemBase* ri = (cMenuDbRecordingItemBase*)Get(Current()); - if (ri && ri->IsDirectory() && (!*path || strcountchr(path, FOLDERDELIMCHAR) > 0)) + if (ri && ri->isDirectory()) { const char* t = ri->Name(); cString buffer; @@ -432,20 +372,25 @@ bool cMenuDbRecordings::Open(bool OpenSubMenus) t = buffer; } - AddSubMenu(new cMenuDbRecordings(t, level + 1, OpenSubMenus)); + AddSubMenu(new cMenuDbRecordings(t, level+1, ri->Name(), OpenSubMenus)); + return true; } return false; } +//*************************************************************************** +// Play +//*************************************************************************** + eOSState cMenuDbRecordings::Play(void) { cMenuDbRecordingItemBase* ri = (cMenuDbRecordingItemBase*)Get(Current()); if (ri) { - if (ri->IsDirectory()) + if (ri->isDirectory()) Open(); else { @@ -457,6 +402,10 @@ eOSState cMenuDbRecordings::Play(void) return osContinue; } +//*************************************************************************** +// Rewind +//*************************************************************************** + eOSState cMenuDbRecordings::Rewind(void) { if (HasSubMenu() || Count() == 0) @@ -464,7 +413,7 @@ eOSState cMenuDbRecordings::Rewind(void) cMenuDbRecordingItemBase *ri = (cMenuDbRecordingItemBase*)Get(Current()); - if (ri && !ri->IsDirectory()) + if (ri && !ri->isDirectory()) { cDevice::PrimaryDevice()->StopReplay(); // must do this first to be able to rewind the currently replayed recording cResumeFile ResumeFile(ri->Recording()->FileName(), ri->Recording()->IsPesRecording()); @@ -475,81 +424,11 @@ eOSState cMenuDbRecordings::Rewind(void) return osContinue; } -/* -eOSState cMenuDbRecordings::Delete(void) -{ - if (HasSubMenu() || Count() == 0) - return osContinue; - cMenuDbRecordingItem *ri = (cMenuDbRecordingItem *)Get(Current()); - if (ri && !ri->IsDirectory()) { - if (Interface->Confirm(tr("Delete recording?"))) { - if (cRecordControl *rc = cRecordControls::GetRecordControl(ri->Recording()->FileName())) { - if (Interface->Confirm(tr("Timer still recording - really delete?"))) { - if (cTimer *Timer = rc->Timer()) { - LOCK_TIMERS_WRITE; - Timer->Skip(); - cRecordControls::Process(Timers, time(NULL)); - if (Timer->IsSingleEvent()) { - Timers->Del(Timer); - isyslog("deleted timer %s", *Timer->ToDescr()); - } - } - } - else - return osContinue; - } - cString FileName; - { - LOCK_RECORDINGS_READ; - if (const cRecording *Recording = Recordings->GetByName(ri->Recording()->FileName())) { - FileName = Recording->FileName(); - if (RecordingsHandler.GetUsage(FileName)) { - if (!Interface->Confirm(tr("Recording is being edited - really delete?"))) - return osContinue; - } - } - } - RecordingsHandler.Del(FileName); // must do this w/o holding a lock, because the cleanup section in cDirCopier::Action() might request one! - if (cReplayControl::NowReplaying() && strcmp(cReplayControl::NowReplaying(), FileName) == 0) - cControl::Shutdown(); - cRecordings *Recordings = cRecordings::GetRecordingsWrite(recordingsStateKey); - Recordings->SetExplicitModify(); - cRecording *Recording = Recordings->GetByName(FileName); - if (!Recording || Recording->Delete()) { - cReplayControl::ClearLastReplayed(FileName); - Recordings->DelByName(FileName); - cOsdMenu::Del(Current()); - SetHelpKeys(); - cVideoDiskUsage::ForceCheck(); - Recordings->SetModified(); - recordingsStateKey.Remove(); - Display(); - if (!Count()) - return osUserRecEmpty; - return osUserRecRemoved; - } - else - Skins.Message(mtError, tr("Error while deleting recording!")); - recordingsStateKey.Remove(); - } - } - return osContinue; -} -*/ -/* -eOSState cMenuDbRecordings::Info(void) -{ - if (HasSubMenu() || Count() == 0) - return osContinue; - if (cMenuDbRecordingItem *ri = (cMenuDbRecordingItem *)Get(Current())) { - if (ri->IsDirectory()) - return AddSubMenu(new cMenuPathEdit(cString(ri->Recording()->Name(), strchrn(ri->Recording()->Name(), FOLDERDELIMCHAR, ri->Level() + 1)))); - else - return AddSubMenu(new cMenuRecording(ri->Recording(), true)); - } - return osContinue; -} -*/ + +//*************************************************************************** +// Commands +//*************************************************************************** + eOSState cMenuDbRecordings::Commands(eKeys Key) { if (HasSubMenu() || Count() == 0) @@ -557,7 +436,7 @@ eOSState cMenuDbRecordings::Commands(eKeys Key) cMenuDbRecordingItemBase* ri = (cMenuDbRecordingItemBase*)Get(Current()); - if (ri && !ri->IsDirectory()) + if (ri && !ri->isDirectory()) { cMenuCommands *menu; eOSState state = AddSubMenu(menu = new cMenuCommands(tr("Recording commands"), &RecordingCommands, cString::sprintf("\"%s\"", *strescape(ri->Recording()->FileName(), "\\\"$")))); @@ -571,6 +450,10 @@ eOSState cMenuDbRecordings::Commands(eKeys Key) return osContinue; } +//*************************************************************************** +// Sort +//*************************************************************************** + eOSState cMenuDbRecordings::Sort() { LoadPlain(); @@ -578,6 +461,10 @@ eOSState cMenuDbRecordings::Sort() return osContinue; } +//*************************************************************************** +// ProcessKey +//*************************************************************************** + eOSState cMenuDbRecordings::ProcessKey(eKeys Key) { eOSState state = cOsdMenu::ProcessKey(Key); @@ -591,9 +478,6 @@ eOSState cMenuDbRecordings::ProcessKey(eKeys Key) case kOk: return Play(); case kRed: return (helpKeys > 1 && RecordingCommands.Count()) ? Commands() : Play(); case kGreen: return Rewind(); - // case kYellow: return Delete(); - case kInfo: - // case kBlue: return Info(); case k0: return Sort(); case k1: case k2: @@ -609,55 +493,5 @@ eOSState cMenuDbRecordings::ProcessKey(eKeys Key) } } - /* - else if (state == osUserRecRenamed) { - // a recording was renamed (within the same folder), so let's refresh the menu - CloseSubMenu(false); // this is the cMenuRecordingEdit/cMenuPathEdit - path = NULL; - fileName = NULL; - state = osContinue; - } - else if (state == osUserRecMoved) { - // a recording was moved to a different folder, so let's delete the old item - CloseSubMenu(false); // this is the cMenuRecordingEdit/cMenuPathEdit - path = NULL; - fileName = NULL; - cOsdMenu::Del(Current()); - Set(); // the recording might have been moved into a new subfolder of this folder - if (!Count()) - return osUserRecEmpty; - Display(); - state = osUserRecRemoved; - } - else if (state == osUserRecRemoved) { - // a recording was removed from a sub folder, so update the current item - if (cOsdMenu *m = SubMenu()) { - if (cMenuDbRecordingItem *ri = (cMenuDbRecordingItem *)Get(Current())) { - if (cMenuDbRecordingItem *riSub = (cMenuDbRecordingItem *)m->Get(m->Current())) - ri->SetRecording(riSub->Recording()); - } - } - // no state change here, this report goes upstream! - } - else if (state == osUserRecEmpty) { - // a subfolder became empty, so let's go back up - CloseSubMenu(false); // this is the now empty submenu - cOsdMenu::Del(Current()); // the menu entry of the now empty subfolder - Set(); // in case a recording was moved into a new subfolder of this folder - if (base && !Count()) // base: don't go up beyond the top level Recordings menu - return state; - Display(); - state = osContinue; - } - */ - - // if (!HasSubMenu()) - // { - // Set(true); - - // if (Key != kNone) - // SetHelpKeys(); - // } - return state; } diff --git a/recinfofile.c b/recinfofile.c index dd9991c..d72c21c 100644 --- a/recinfofile.c +++ b/recinfofile.c @@ -170,6 +170,97 @@ int cEventDetails::updateToRow(cDbRow* row) tell(0, "Info: Field '%s' unhandled for info.epg2vdr", it->first.c_str()); } + if (row->getValue("CATEGORY")->isEmpty()) + row->setValue("CATEGORY", "unknown"); + + if (row->getValue("GENRE")->isEmpty()) + row->setValue("GENRE", "unknown"); + + cDbValue* value = row->getValue("GENRE"); + + if (value) + { + // build normalized genre + + if (strncasecmp(value->getStrValue(), "Action", 6) == 0) + row->setValue("NGENRE", "Action"); + else if (strncasecmp(value->getStrValue(), "Digitaltrick", 12) == 0 || + strncasecmp(value->getStrValue(), "Digitrick", 9) == 0 || + strncasecmp(value->getStrValue(), "Zeichentrick", 12) == 0 || + strncasecmp(value->getStrValue(), "Trickfilmkomödie", 16) == 0 || + strncasecmp(value->getStrValue(), "Trickfilm", 12) == 0) + row->setValue("NGENRE", "Trickfilm"); + else if (strncasecmp(value->getStrValue(), "Sci-Fi", 6) == 0 || + strncasecmp(value->getStrValue(), "Science-Fiction", 15) == 0 || + strncasecmp(value->getStrValue(), "Science Fiction", 15) == 0 + ) + row->setValue("NGENRE", "Science-Fiction"); + else if (strncasecmp(value->getStrValue(), "Comedy", 6) == 0) + row->setValue("NGENRE", "Comedy"); + else if (strncasecmp(value->getStrValue(), "Comic", 5) == 0) + row->setValue("NGENRE", "Comic"); + else if (strncasecmp(value->getStrValue(), "Doku", 5) == 0 || + strncasecmp(value->getStrValue(), "Naturdoku", 9) == 0 || + strncasecmp(value->getStrValue(), "Dokumentar", 10) == 0 || + strncasecmp(value->getStrValue(), "Tierdoku", 8) == 0) + row->setValue("NGENRE", "Dokumentation"); + else if (strncasecmp(value->getStrValue(), "Abenteuer", 9) == 0 || + strncasecmp(value->getStrValue(), "Jugendabenteuer", 15) == 0 || + strncasecmp(value->getStrValue(), "Indianerabenteuer", 17) == 0 || + strncasecmp(value->getStrValue(), "Dschungelabenteuer", 18) == 0) + row->setValue("NGENRE", "Abenteuer"); + else if (strncasecmp(value->getStrValue(), "Superhelden", 11) == 0) + row->setValue("NGENRE", "Superhelden"); + else if (strncasecmp(value->getStrValue(), "Agenten", 7) == 0) + row->setValue("NGENRE", "Agenten"); + else if (strncasecmp(value->getStrValue(), "Drama", 7) == 0 || + strncasecmp(value->getStrValue(), "Gefängnisdrama", 14) == 0 || + strncasecmp(value->getStrValue(), "Familiendrama", 13) == 0 || + strncasecmp(value->getStrValue(), "Kriegsdrama", 11) == 0 || + strncasecmp(value->getStrValue(), "Gewaltdrama", 11 == 0)) + row->setValue("NGENRE", "Drama"); + else if (strncasecmp(value->getStrValue(), "Biografie", 9) == 0) + row->setValue("NGENRE", "Biografie"); + else if (strncasecmp(value->getStrValue(), "Erotik", 6) == 0) + row->setValue("NGENRE", "Erotik"); + else if (strncasecmp(value->getStrValue(), "Fantasy", 7) == 0) + row->setValue("NGENRE", "Fantasy"); + else if (strncasecmp(value->getStrValue(), "Horror", 6) == 0 || + strncasecmp(value->getStrValue(), "Vampirhorror", 12) == 0) + row->setValue("NGENRE", "Horror"); + else if (strncasecmp(value->getStrValue(), "Historien", 9) == 0) + row->setValue("NGENRE", "Historien"); + else if (strncasecmp(value->getStrValue(), "Krimi", 5) == 0) + row->setValue("NGENRE", "Krimi"); + else if (strncasecmp(value->getStrValue(), "Musik", 5) == 0) + row->setValue("NGENRE", "Musik"); + else if (strncasecmp(value->getStrValue(), "Musical", 7) == 0) + row->setValue("NGENRE", "Musical"); + else if (strncasecmp(value->getStrValue(), "Mystery", 7) == 0) + row->setValue("NGENRE", "Mystery"); + else if (strncasecmp(value->getStrValue(), "Militär", 7) == 0) + row->setValue("NGENRE", "Militär"); + else if (strncasecmp(value->getStrValue(), "Psycho", 6) == 0) + row->setValue("NGENRE", "Psycho"); + else if (strncasecmp(value->getStrValue(), "Thriller", 8) == 0 || + strncasecmp(value->getStrValue(), "Politthriller", 13) == 0) + row->setValue("NGENRE", "Thriller"); + else if (strncasecmp(value->getStrValue(), "Western", 7) == 0 || + strncasecmp(value->getStrValue(), "Wildwestabenteuer", 17) == 0) + row->setValue("NGENRE", "Western"); + else + row->setValue("NGENRE", value->getStrValue()); + } + + if (row->hasValue("CATEGORY", "unknown")) + row->setValue("GROUP", cString::sprintf("%s", row->getStrValue("NGENRE"))); + else if (row->hasValue("NGENRE", "unknown")) + row->setValue("GROUP", cString::sprintf("%s", row->getStrValue("CATEGORY"))); + else + row->setValue("GROUP", cString::sprintf("%s / %s", + row->getStrValue("CATEGORY"), + row->getStrValue("NGENRE"))); + return success; } |