Skip to content

Commit

Permalink
Revert "EIT updates of programs with starttime in the past"
Browse files Browse the repository at this point in the history
This reverts commit 41df371.

This commit has been tested with EIT but it is likely to
be the cause of segfault in mythfilldatabase.
  • Loading branch information
kmdewaal committed Jan 14, 2022
1 parent 0c7ead0 commit 8aa1468
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 27 deletions.
38 changes: 12 additions & 26 deletions mythtv/libs/libmythtv/programdata.cpp
Expand Up @@ -232,12 +232,6 @@ DBEvent &DBEvent::operator=(const DBEvent &other)
if (this == &other)
return *this;

*this = DBEvent(other);
return *this;
}

DBEvent::DBEvent(const DBEvent &other)
{
m_title = other.m_title;
m_subtitle = other.m_subtitle;
m_description = other.m_description;
Expand Down Expand Up @@ -284,6 +278,8 @@ DBEvent::DBEvent(const DBEvent &other)
m_genres = other.m_genres;

Squeeze();

return *this;
}

void DBEvent::Squeeze(void)
Expand Down Expand Up @@ -677,29 +673,19 @@ uint DBEvent::UpdateDB(
return InsertDB(q, chanid);
}

// Changing the starttime or the title of a program that is being
// recorded will start another recording of the same program.
// Therefore updates with a starttime in the past keep
// the old start time and program title.
// Changing a starttime of a program that is being recorded can
// start another recording of the same program.
// Therefore we skip updates that change a starttime in the past
// unless the endtime is later.
if (m_starttime != p[match].m_starttime)
{
QDateTime now = QDateTime::currentDateTimeUtc();

// Starttime in the past
if (m_starttime < now)
if (m_starttime < now && m_endtime <= p[match].m_endtime)
{
if ((m_starttime != p[match].m_starttime) ||
(m_title != p[match].m_title ))
{
LOG(VB_EIT, LOG_INFO,
QString("EIT: update '%1' but starttime in the past, keep starttime and title")
.arg(m_title.left(35)));

// Update matched item with current data but old starttime and title
DBEvent new_event(*this);
new_event.m_starttime = p[match].m_starttime;
new_event.m_title = p[match].m_title;
return new_event.UpdateDB(q, chanid, p[match]);
}
LOG(VB_EIT, LOG_DEBUG,
QString("EIT: skip '%1' starttime is in the past")
.arg(m_title.left(35)));
return 0;
}
}

Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/programdata.h
Expand Up @@ -112,7 +112,7 @@ class MTV_PUBLIC DBEvent
m_episode(_episode),
m_totalepisodes(_totalepisodes)
{
} DBEvent(const DBEvent &other);
}

virtual ~DBEvent() { delete m_credits; }

Expand Down

0 comments on commit 8aa1468

Please sign in to comment.