Fixed a problem with duplicate events if they are moved to a lower table ID and at the same time get a new event ID

This commit is contained in:
Klaus Schmidinger 2024-09-26 19:25:41 +02:00
parent c590444b7d
commit 2c6fd804f6
3 changed files with 24 additions and 11 deletions

View File

@ -2583,6 +2583,8 @@ Markus Ehrnsperger <markus.ehrnsperger@googlemail.com>
for improving the error message when closing a frontend for improving the error message when closing a frontend
for reporting a problem in cSchedule::Sort(), in case hasRunning was true, but there for reporting a problem in cSchedule::Sort(), in case hasRunning was true, but there
was no event with RunningStatus() >= SI::RunningStatusPausing was no event with RunningStatus() >= SI::RunningStatusPausing
for reporting problem with duplicate events if they are moved to a lower table ID and
at the same time get a new event ID
Werner Färber <w.faerber@gmx.de> Werner Färber <w.faerber@gmx.de>
for reporting a bug in handling the cPluginManager::Active() result when pressing for reporting a bug in handling the cPluginManager::Active() result when pressing

View File

@ -9984,7 +9984,7 @@ Video Disk Recorder Revision History
version numbering. Version numbers are simply counted upwards, with each of the three version numbering. Version numbers are simply counted upwards, with each of the three
parts ("version", "major", "minor") always being a single digit, and '0' being skipped. parts ("version", "major", "minor") always being a single digit, and '0' being skipped.
2024-09-21: 2024-09-26:
- Fix for compilers that don't like non-constant format strings (thanks to Stefan Hofmann). - Fix for compilers that don't like non-constant format strings (thanks to Stefan Hofmann).
- Deprecated code is now marked with [[deprecated]] to issue a compile time warning when - Deprecated code is now marked with [[deprecated]] to issue a compile time warning when
@ -10016,3 +10016,5 @@ Video Disk Recorder Revision History
APIVERSNUM is now 30005. APIVERSNUM is now 30005.
- Fixed singular when displaying number of errors in the recording info. - Fixed singular when displaying number of errors in the recording info.
- Increased the bpp of cProgressBar to 4 to handle all different colors. - Increased the bpp of cProgressBar to 4 to handle all different colors.
- Fixed a problem with duplicate events if they are moved to a lower table ID and at the
same time get a new event ID (reported by Markus Ehrnsperger).

29
epg.c
View File

@ -7,7 +7,7 @@
* Original version (as used in VDR before 1.3.0) written by * Original version (as used in VDR before 1.3.0) written by
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>. * Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
* *
* $Id: epg.c 5.10 2024/09/14 14:17:12 kls Exp $ * $Id: epg.c 5.11 2024/09/26 19:25:41 kls Exp $
*/ */
#include "epg.h" #include "epg.h"
@ -145,7 +145,10 @@ cEvent::~cEvent()
int cEvent::Compare(const cListObject &ListObject) const int cEvent::Compare(const cListObject &ListObject) const
{ {
cEvent *e = (cEvent *)&ListObject; cEvent *e = (cEvent *)&ListObject;
return startTime - e->startTime; int d = startTime - e->startTime;
if (d == 0)
d = int(tableID) - int(e->tableID);
return d;
} }
tChannelID cEvent::ChannelID(void) const tChannelID cEvent::ChannelID(void) const
@ -1100,14 +1103,6 @@ void cSchedule::ResetVersions(void)
void cSchedule::Sort(void) void cSchedule::Sort(void)
{ {
events.Sort(); events.Sort();
// Make sure there are no RunningStatusUndefined before the currently running event:
for (cEvent *p = events.First(); p; p = events.Next(p)) {
if (p->RunningStatus() >= SI::RunningStatusPausing) {
for (p = events.Prev(p); p; p = events.Prev(p))
p->SetRunningStatus(SI::RunningStatusNotRunning);
break;
}
}
SetModified(); SetModified();
} }
@ -1134,6 +1129,20 @@ void cSchedule::DropOutdated(time_t SegmentStart, time_t SegmentEnd, uchar Table
p = n; p = n;
} }
} }
// Make sure there are no two events with the same start time:
for (cEvent *p = events.First(); p; p = events.Next(p)) {
cEvent *n = events.Next(p);
if (n && n->StartTime() == p->StartTime())
DelEvent(n);
}
// Make sure there are no RunningStatusUndefined before the currently running event:
for (cEvent *p = events.First(); p; p = events.Next(p)) {
if (p->RunningStatus() >= SI::RunningStatusPausing) {
for (p = events.Prev(p); p; p = events.Prev(p))
p->SetRunningStatus(SI::RunningStatusNotRunning);
break;
}
}
} }
void cSchedule::Cleanup(void) void cSchedule::Cleanup(void)