From b1905747a381ef8c5c198c82f8ae9c5ce63f41b7 Mon Sep 17 00:00:00 2001 From: Jochen Dolze Date: Wed, 16 May 2012 07:03:48 +0200 Subject: Changed import handling for 'create', existing eventids will be reassigned Added picture linking for 'create' --- import.cpp | 22 ++++++++++++---------- setup.h | 1 - 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/import.cpp b/import.cpp index f1f4f7f..90a6dc9 100644 --- a/import.cpp +++ b/import.cpp @@ -347,7 +347,7 @@ void cImport::LinkPictures(const char *Source, cXMLTVStringList *Pics, tEventID } } } - + if (stat(dst,&statbuf)==-1) { if (symlink(src,dst)==-1) @@ -372,7 +372,7 @@ void cImport::LinkPictures(const char *Source, cXMLTVStringList *Pics, tEventID tsyslog("linked %s to %s_%i_%i.%s",pic,*ChanID.ToString(),DestID,i,ext); } } - } + } } } } @@ -510,6 +510,11 @@ bool cImport::PutEvent(cEPGSource *Source, sqlite3 *Db, cSchedule* Schedule, Event->SetTableID(0); Schedule->AddEvent(Event); Schedule->Sort(); + if (xEvent->Pics()->Size() && Source->UsePics()) + { + /* here's a good place to link pictures! */ + LinkPictures(xEvent->Source(),xEvent->Pics(),Event->EventID(),Event->ChannelID()); + } if (Source->Trace()) { localtime_r(&start,&tm); @@ -520,10 +525,6 @@ bool cImport::PutEvent(cEPGSource *Source, sqlite3 *Db, cSchedule* Schedule, } retcode=true; } - else - { - append=false; - } if (!Event) return false; @@ -1443,10 +1444,11 @@ int cImport::Process(cEPGSource *Source, cEPGExecutor &myExecutor) if (addevents && event && (event->EventID() != xevent.EventID())) { - esyslogs(Source,"found another event with different eventid"); - int newflags=map->Flags(); - newflags &=~OPT_APPEND; - map->ChangeFlags(newflags); + xevent.SetEITEventID(event->EventID()); // that's only a guess! + tsyslogs(Source,"{%5i} changing existing eventid to {%5i}",event->EventID(),xevent.EventID()); + event->SetEventID(xevent.EventID()); + event->SetVersion(0); + event->SetTableID(0); } #if VDRVERSNUM < 10726 && (!EPGHANDLER) diff --git a/setup.h b/setup.h index 716d26d..2cff749 100644 --- a/setup.h +++ b/setup.h @@ -135,7 +135,6 @@ private: uint flags; void output(void); cString title; - //const char *channel; cOsdItem *option(const char *s, bool yesno); void epgmappingreplace(cEPGMapping *newmapping); void Store(cEPGMapping *newmapping, bool replacemapping=true); -- cgit v1.2.3