Skip to content

Commit

Permalink
Merge pull request xbmc#25739 from ksooo/pvr-epg-search-fixes
Browse files Browse the repository at this point in the history
[PVR] EPG search fixes
  • Loading branch information
ksooo authored Sep 18, 2024
2 parents 036cb76 + c3ba281 commit 0528594
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 18 deletions.
7 changes: 4 additions & 3 deletions xbmc/pvr/epg/EpgDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,8 @@ class CSearchTermConverter
public:
explicit CSearchTermConverter(const std::string& strSearchTerm) { Parse(strSearchTerm); }

bool HasSearchTerm() const { return !m_fragments.empty(); }

std::string ToSQL(const std::string& strFieldName) const
{
std::string result = "(";
Expand Down Expand Up @@ -754,10 +756,9 @@ std::vector<std::shared_ptr<CPVREpgInfoTag>> CPVREpgDatabase::GetEpgTags(
// search term
/////////////////////////////////////////////////////////////////////////////////////////////

if (!searchData.m_strSearchTerm.empty())
const CSearchTermConverter conv{searchData.m_strSearchTerm};
if (conv.HasSearchTerm())
{
const CSearchTermConverter conv(searchData.m_strSearchTerm);

// title
std::string strWhere = conv.ToSQL("sTitle");

Expand Down
18 changes: 6 additions & 12 deletions xbmc/pvr/epg/EpgSearchFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ void CPVREpgSearchFilter::Reset()
m_bIgnorePresentTimers = true;
m_bIgnorePresentRecordings = true;

m_groupIdMatches.reset();

m_iDatabaseId = -1;
m_title.clear();
m_lastExecutedDateTime.SetValid(false);
Expand Down Expand Up @@ -192,7 +190,6 @@ void CPVREpgSearchFilter::SetChannelGroupID(int iChannelGroupID)
if (m_iChannelGroupID != iChannelGroupID)
{
m_iChannelGroupID = iChannelGroupID;
m_groupIdMatches.reset();
m_bChanged = true;
}
}
Expand Down Expand Up @@ -372,17 +369,14 @@ bool CPVREpgSearchFilter::MatchChannelGroup(const std::shared_ptr<const CPVREpgI
{
if (m_iChannelGroupID != -1)
{
if (!m_groupIdMatches.has_value())
const std::shared_ptr<const CPVRChannelGroupsContainer> groups{
CServiceBroker::GetPVRManager().ChannelGroups()};
if (groups)
{
const std::shared_ptr<const CPVRChannelGroup> group = CServiceBroker::GetPVRManager()
.ChannelGroups()
->Get(m_bIsRadio)
->GetById(m_iChannelGroupID);
m_groupIdMatches =
group && (group->GetByUniqueID({tag->ClientID(), tag->UniqueChannelID()}) != nullptr);
const std::shared_ptr<const CPVRChannelGroup> group{
groups->Get(m_bIsRadio)->GetById(m_iChannelGroupID)};
return group && (group->GetByUniqueID({tag->ClientID(), tag->UniqueChannelID()}) != nullptr);
}

return *m_groupIdMatches;
}

return true;
Expand Down
3 changes: 0 additions & 3 deletions xbmc/pvr/epg/EpgSearchFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "pvr/epg/EpgSearchData.h"

#include <memory>
#include <optional>
#include <string>
#include <vector>

Expand Down Expand Up @@ -166,8 +165,6 @@ namespace PVR
bool m_bIgnorePresentTimers; /*!< True to ignore currently present timers (future recordings), false if not */
bool m_bIgnorePresentRecordings; /*!< True to ignore currently active recordings, false if not */

mutable std::optional<bool> m_groupIdMatches;

int m_iDatabaseId = -1;
std::string m_title;
std::string m_iconPath;
Expand Down

0 comments on commit 0528594

Please sign in to comment.