diff options
author | Kai Sommerfeld <kai.sommerfeld@gmx.com> | 2022-03-30 17:23:24 +0200 |
---|---|---|
committer | Kai Sommerfeld <kai.sommerfeld@gmx.com> | 2022-04-07 07:59:55 +0200 |
commit | c5fc05cdff63c08ec06578bb1036f9c1bad4f6bf (patch) | |
tree | 5c3f209a9712c4aa7f63148cffdbc814ecf8afd3 | |
parent | 72dba3a23d2fbf3c7742d54bb65ec4a39c682fb2 (diff) |
[PVR] Speedup first open of Search dialog by reducing number of EPG database queries to two, no matter how many channels we have - before we did 'number of channels times two' queries. That did hit us hard when we have a huge amount of channels.
-rw-r--r-- | xbmc/pvr/dialogs/GUIDialogPVRGuideSearch.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/xbmc/pvr/dialogs/GUIDialogPVRGuideSearch.cpp b/xbmc/pvr/dialogs/GUIDialogPVRGuideSearch.cpp index fa60192317..d4b32ab673 100644 --- a/xbmc/pvr/dialogs/GUIDialogPVRGuideSearch.cpp +++ b/xbmc/pvr/dialogs/GUIDialogPVRGuideSearch.cpp @@ -334,22 +334,23 @@ void CGUIDialogPVRGuideSearch::Update() SET_CONTROL_SELECTED(GetID(), CONTROL_BTN_IGNORE_FUTURE, m_searchFilter->ShouldIgnoreFutureBroadcasts()); - /* Set time fields */ + // Set start/end datetime fields m_startDateTime = m_searchFilter->GetStartDateTime(); - if (!m_startDateTime.IsValid()) + m_endDateTime = m_searchFilter->GetEndDateTime(); + if (!m_startDateTime.IsValid() || !m_endDateTime.IsValid()) { - m_startDateTime = CServiceBroker::GetPVRManager().EpgContainer().GetFirstEPGDate(); + const auto dates = CServiceBroker::GetPVRManager().EpgContainer().GetFirstAndLastEPGDate(); if (!m_startDateTime.IsValid()) - m_startDateTime = CDateTime::GetUTCDateTime(); + m_startDateTime = dates.first; + if (!m_endDateTime.IsValid()) + m_endDateTime = dates.second; } - m_endDateTime = m_searchFilter->GetEndDateTime(); + if (!m_startDateTime.IsValid()) + m_startDateTime = CDateTime::GetUTCDateTime(); + if (!m_endDateTime.IsValid()) - { - m_endDateTime = CServiceBroker::GetPVRManager().EpgContainer().GetLastEPGDate(); - if (!m_endDateTime.IsValid()) - m_endDateTime = m_startDateTime + CDateTimeSpan(10, 0, 0, 0); // default to start + 10 days - } + m_endDateTime = m_startDateTime + CDateTimeSpan(10, 0, 0, 0); // default to start + 10 days CDateTime startLocal; startLocal.SetFromUTCDateTime(m_startDateTime); |