Skip to content

Commit

Permalink
Fixes #8983. Allow relaxed matching of channels in DB.
Browse files Browse the repository at this point in the history
If the user has incomplete channel info in their DB still try
to match them as best as we can to channels found in the scan.
  • Loading branch information
daniel-kristjansson committed Jul 31, 2012
1 parent db9ef08 commit 9b8a005
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/channelscan/channelimporter.cpp
Expand Up @@ -858,7 +858,7 @@ ScanDTVTransportList ChannelImporter::GetDBTransports(
ChannelInsertInfo &chan = transports[i].channels[j];
for (uint k = 0; k < newt.channels.size(); k++)
{
if (newt.channels[k].IsSameChannel(chan))
if (newt.channels[k].IsSameChannel(chan, true))
{
found_chan[k] = true;
chan.db_mplexid = mplexid;
Expand Down
17 changes: 15 additions & 2 deletions mythtv/libs/libmythtv/dbchannelinfo.cpp
Expand Up @@ -396,7 +396,8 @@ void ChannelInsertInfo::ImportExtraInfo(const ChannelInsertInfo &other)
orig_netid = other.orig_netid;
if (other.netid && !netid)
netid = other.netid;
if (!other.si_standard.isEmpty() && si_standard.isEmpty())
if (!other.si_standard.isEmpty() &&
(si_standard.isEmpty() || ("mpeg" == si_standard)))
{
si_standard = other.si_standard; si_standard.detach();
}
Expand Down Expand Up @@ -426,7 +427,8 @@ void ChannelInsertInfo::ImportExtraInfo(const ChannelInsertInfo &other)
decryption_status = other.decryption_status;
}

bool ChannelInsertInfo::IsSameChannel(const ChannelInsertInfo &other) const
bool ChannelInsertInfo::IsSameChannel(
const ChannelInsertInfo &other, bool relaxed) const
{
if (atsc_major_channel &&
(atsc_major_channel == other.atsc_major_channel) &&
Expand All @@ -444,6 +446,17 @@ bool ChannelInsertInfo::IsSameChannel(const ChannelInsertInfo &other) const
(pat_tsid == other.pat_tsid) && (service_id == other.service_id))
return true;

if (relaxed)
{
if (("mpeg" == si_standard || "mpeg" == other.si_standard ||
"dvb" == si_standard || "dvb" == other.si_standard ||
si_standard.isEmpty() || other.si_standard.isEmpty()) &&
(service_id == other.service_id))
{
return true;
}
}

return false;
}

Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/dbchannelinfo.h
Expand Up @@ -129,7 +129,7 @@ class MTV_PUBLIC ChannelInsertInfo
ChannelInsertInfo(const ChannelInsertInfo &other) { (*this = other); }
ChannelInsertInfo &operator=(const ChannelInsertInfo &other);

bool IsSameChannel(const ChannelInsertInfo&) const;
bool IsSameChannel(const ChannelInsertInfo&, bool relaxed = false) const;

bool SaveScan(uint scanid, uint transportid) const;

Expand Down

0 comments on commit 9b8a005

Please sign in to comment.