Permalink
Browse files

Fixes #8983. Allow relaxed matching of channels in DB.

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...
1 parent db9ef08 commit 9b8a005c0b5df7378d6db4c54a8cfdd3277fe0c1 @daniel-kristjansson daniel-kristjansson committed Jul 31, 2012
@@ -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;
@@ -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();
}
@@ -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) &&
@@ -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;
}
@@ -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;

0 comments on commit 9b8a005

Please sign in to comment.