Skip to content

Commit

Permalink
Added EpgSearchFilter criteria for UniqueBroadcastID. Extend implemen…
Browse files Browse the repository at this point in the history
…tation of ISerializable in CEpginfoTag.
  • Loading branch information
groth-its committed Oct 31, 2013
1 parent 26b92f4 commit fdad51c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
9 changes: 9 additions & 0 deletions xbmc/epg/EpgInfoTag.cpp
Expand Up @@ -203,6 +203,7 @@ CEpgInfoTag &CEpgInfoTag::operator =(const CEpgInfoTag &other)

void CEpgInfoTag::Serialize(CVariant &value) const
{
value["broadcastid"] = m_iUniqueBroadcastID;
value["rating"] = m_iStarRating;
value["title"] = m_strTitle;
value["plotoutline"] = m_strPlotOutline;
Expand All @@ -213,6 +214,14 @@ void CEpgInfoTag::Serialize(CVariant &value) const
value["endtime"] = m_endTime.IsValid() ? m_endTime.GetAsDBDateTime() : StringUtils::EmptyString;
value["runtime"] = StringUtils::Format("%d", GetDuration() / 60);
value["firstaired"] = m_firstAired.IsValid() ? m_firstAired.GetAsDBDate() : StringUtils::EmptyString;
value["progress"] = Progress();
value["progresspercentage"] = ProgressPercentage();
value["episodename"] = m_strEpisodeName;
value["episodenum"] = m_iEpisodeNumber;
value["episodepart"] = m_iEpisodePart;
value["hastimer"] = HasTimer();
value["isactive"] = IsActive();
value["wasactive"] = WasActive();
}

bool CEpgInfoTag::Changed(void) const
Expand Down
16 changes: 13 additions & 3 deletions xbmc/epg/EpgSearchFilter.cpp
Expand Up @@ -58,6 +58,7 @@ void EpgSearchFilter::Reset()
m_iChannelGroup = EPG_SEARCH_UNSET;
m_bIgnorePresentTimers = true;
m_bIgnorePresentRecordings = true;
m_iUniqueBroadcastId = EPG_SEARCH_UNSET;
}

bool EpgSearchFilter::MatchGenre(const CEpgInfoTag &tag) const
Expand Down Expand Up @@ -106,16 +107,25 @@ bool EpgSearchFilter::MatchSearchTerm(const CEpgInfoTag &tag) const
return bReturn;
}

bool EpgSearchFilter::MatchBroadcastId(const CEpgInfoTag &tag) const
{
if (m_iUniqueBroadcastId != EPG_SEARCH_UNSET)
return (tag.UniqueBroadcastID() == m_iUniqueBroadcastId);

return true;
}

bool EpgSearchFilter::FilterEntry(const CEpgInfoTag &tag) const
{
return (MatchGenre(tag) &&
MatchBroadcastId(tag) &&
MatchDuration(tag) &&
MatchStartAndEndTimes(tag) &&
MatchSearchTerm(tag)) &&
(!tag.HasPVRChannel() ||
(MatchChannelNumber(tag) &&
MatchChannelGroup(tag) &&
(!m_bFTAOnly || !tag.ChannelTag()->IsEncrypted())));
(MatchChannelNumber(tag) &&
MatchChannelGroup(tag) &&
(!m_bFTAOnly || !tag.ChannelTag()->IsEncrypted())));
}

int EpgSearchFilter::RemoveDuplicates(CFileItemList &results)
Expand Down
2 changes: 2 additions & 0 deletions xbmc/epg/EpgSearchFilter.h
Expand Up @@ -55,6 +55,7 @@ namespace EPG
virtual bool MatchSearchTerm(const CEpgInfoTag &tag) const;
virtual bool MatchChannelNumber(const CEpgInfoTag &tag) const;
virtual bool MatchChannelGroup(const CEpgInfoTag &tag) const;
virtual bool MatchBroadcastId(const CEpgInfoTag &tag) const;

static int RemoveDuplicates(CFileItemList &results);

Expand All @@ -76,5 +77,6 @@ namespace EPG
int m_iChannelGroup; /*!< The group this channel belongs to */
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 */
int m_iUniqueBroadcastId; /*!< The broadcastid to search for */
};
}
8 changes: 7 additions & 1 deletion xbmc/interfaces/json-rpc/FileItemHandler.cpp
Expand Up @@ -40,6 +40,8 @@
#include "music/MusicThumbLoader.h"
#include "Util.h"
#include "pvr/channels/PVRChannel.h"
#include "epg/Epg.h"
#include "epg/EpgContainer.h"

using namespace MUSIC_INFO;
using namespace JSONRPC;
Expand Down Expand Up @@ -278,7 +280,7 @@ void CFileItemHandler::HandleFileItem(const char *ID, bool allowFile, const char
if (allowFile)
{
if (item->HasVideoInfoTag() && !item->GetVideoInfoTag()->GetPath().IsEmpty())
object["file"] = item->GetVideoInfoTag()->GetPath().c_str();
object["file"] = item->GetVideoInfoTag()->GetPath().c_str();
if (item->HasMusicInfoTag() && !item->GetMusicInfoTag()->GetURL().IsEmpty())
object["file"] = item->GetMusicInfoTag()->GetURL().c_str();

Expand All @@ -292,6 +294,8 @@ void CFileItemHandler::HandleFileItem(const char *ID, bool allowFile, const char
{
if (item->HasPVRChannelInfoTag() && item->GetPVRChannelInfoTag()->ChannelID() > 0)
object[ID] = item->GetPVRChannelInfoTag()->ChannelID();
else if (item->HasEPGInfoTag() && item->GetEPGInfoTag()->UniqueBroadcastID() > 0)
object[ID] = item->GetEPGInfoTag()->UniqueBroadcastID();
else if (item->HasMusicInfoTag() && item->GetMusicInfoTag()->GetDatabaseId() > 0)
object[ID] = (int)item->GetMusicInfoTag()->GetDatabaseId();
else if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_iDbId > 0)
Expand Down Expand Up @@ -348,6 +352,8 @@ void CFileItemHandler::HandleFileItem(const char *ID, bool allowFile, const char

if (item->HasPVRChannelInfoTag())
FillDetails(item->GetPVRChannelInfoTag(), item, fields, object, thumbLoader);
if (item->HasEPGInfoTag())
FillDetails(item->GetEPGInfoTag(), item, fields, object, thumbLoader);
if (item->HasVideoInfoTag())
FillDetails(item->GetVideoInfoTag(), item, fields, object, thumbLoader);
if (item->HasMusicInfoTag())
Expand Down

0 comments on commit fdad51c

Please sign in to comment.