DvbSharedEpgEntry DvbEpgModel::findExistingEntry(DvbEpgEntry &entry) { DvbSharedEpgEntry existingEntry; existingEntry = eventIds.value(QPair(entry.channel, entry.eventid)); if(existingEntry.isValid()) return existingEntry; DvbEpgEntry fakeEntry(entry.channel); int newDurSecs = QTime(0,0).secsTo(entry.duration); int allowedDiff = 0; int durSecs = 0; //Log("DATA: ") << durSecs << " " << allowedDiff; for (ConstIdIterator it = entryIds.lowerBound(DvbEpgEntryId(&fakeEntry)); it != entryIds.constEnd(); ++it) { const DvbSharedEpgEntry &exEntry = *it; if (!exEntry.isValid() || entry.channel != exEntry->channel ) { continue; } durSecs = QTime(0,0).secsTo(exEntry->duration); allowedDiff = (10*60 > (durSecs/2)) ? (durSecs / 2): 10*60; // allowed start/stop difference //Log("DATA -> : ") << entry.begin.toMSecsSinceEpoch() << " " << exEntry->begin.toMSecsSinceEpoch() << " " << (abs(entry.begin.toMSecsSinceEpoch() - exEntry->begin.toMSecsSinceEpoch()) / 1000 ) << " " << allowedDiff; if((abs(entry.begin.toMSecsSinceEpoch() - exEntry->begin.toMSecsSinceEpoch()) / 1000) > allowedDiff || abs(newDurSecs - durSecs) > allowedDiff) continue; return exEntry; } //DvbSharedEpgEntry sharedFakeEntry(&fakeEntry); //return sharedFakeEntry; // return an invalid entry return DvbSharedEpgEntry(); }