1 === programs/mythfilldatabase/filldata.cpp
2 Index: programs/mythfilldatabase/filldata.cpp
3 ===================================================================
4 --- programs/mythfilldatabase/filldata.cpp.orig 2006-06-20 17:32:57.000000000 -0400
5 +++ programs/mythfilldatabase/filldata.cpp 2006-06-20 17:36:06.000000000 -0400
7 bool dddataretrieved = false;
8 bool mark_repeats = true;
9 bool channel_updates = false;
11 +bool add_missing_channels = false;
12 +bool ignore_on_air = false;
14 int listing_wrap_offset = 0;
17 void clearDataBySource(int sourceid, QDateTime from, QDateTime to)
19 MSqlQuery query(MSqlQuery::InitCon());
20 - query.prepare("SELECT chanid FROM channel WHERE "
21 - "sourceid = :SOURCE ;");
22 + QString queryStr = QString(
23 + "SELECT chanid FROM channel WHERE "
24 + "sourceid = :SOURCE");
26 + queryStr += QString(" AND useonairguide <> 1");
27 + query.prepare(queryStr);
28 query.bindValue(":SOURCE", sourceid);
33 ddprocessor.updateStationViewTable();
37 + // Remove xmltvid from all channels with 'useonairguide' set
38 + MSqlQuery remove_id(MSqlQuery::DDCon());
40 + "UPDATE channel SET xmltvid=NULL WHERE useonairguide = 1 "
41 + "AND sourceid = :SOURCEID");
42 + remove_id.bindValue(":SOURCEID", source.id);
43 + if (!remove_id.exec())
44 + MythContext::DBError("Removing xmltvid", remove_id);
46 // Find all the channels in the dd_v_station temp table
47 // where there is no channel with the same xmltvid in the
48 // DB using the same source.
52 // First check if channel already in DB, but without xmltvid
53 - query.prepare("SELECT chanid FROM channel "
54 + QString queryStr = QString(
55 + "SELECT chanid FROM channel "
56 "WHERE sourceid = :SOURCEID AND "
57 " (channum=:CHANNUM OR atscsrcid=:ATSCSRCID)");
59 + queryStr += QString(" AND useonairguide <> 1");
60 + query.prepare(queryStr);
61 query.bindValue(":SOURCEID", source.id);
62 query.bindValue(":CHANNUM", channum);
63 query.bindValue(":ATSCSRCID", atscsrcid);
66 "SET xmltvid = :XMLTVID "
67 "WHERE chanid = :CHANID AND sourceid = :SOURCEID");
72 uint chanid = query.value(0).toInt();
74 continue; // go on to next channel without xmltv
77 - // The channel doesn't exist in the DB, insert it...
78 - int mplexid = -1, majorC, minorC, chanid = 0;
80 - get_atsc_stuff(channum, source.id, freqid,
81 - majorC, minorC, freq);
83 - if (minorC > 0 && freq >= 0)
84 + if (add_missing_channels)
86 - mplexid = ChannelUtil::CreateMultiplex(
87 - source.id, "atsc", freq, "8vsb");
90 - if ((mplexid > 0) || (minorC == 0))
91 - chanid = ChannelUtil::CreateChanID(source.id, channum);
97 - bool oag = false; // use on air guide
98 - bool hidden = false;
99 - bool hidden_in_guide = false;
101 - ChannelUtil::CreateChannel(
102 - mplexid, source.id, chanid,
103 - callsign, name, channum,
104 - serviceid, majorC, minorC,
105 - oag, hidden, hidden_in_guide,
106 - freqid, icon, tvformat,
108 + // The channel doesn't exist in the DB, insert it...
109 + int mplexid = -1, majorC, minorC, chanid = 0;
111 + get_atsc_stuff(channum, source.id, freqid,
112 + majorC, minorC, freq);
114 + if (minorC > 0 && freq >= 0)
116 + mplexid = ChannelUtil::CreateMultiplex(
117 + source.id, "atsc", freq, "8vsb");
120 + if ((mplexid > 0) || (minorC == 0))
121 + chanid = ChannelUtil::CreateChanID(source.id, channum);
127 + bool oag = false; // use on air guide
128 + bool hidden = false;
129 + bool hidden_in_guide = false;
131 + ChannelUtil::CreateChannel(
132 + mplexid, source.id, chanid,
133 + callsign, name, channum,
134 + serviceid, majorC, minorC,
135 + oag, hidden, hidden_in_guide,
136 + freqid, icon, tvformat,
142 @@ -3441,6 +3464,14 @@
144 channel_updates = true;
146 + else if (!strcmp(a.argv()[argpos], "--add_missing_channels"))
148 + add_missing_channels = true;
150 + else if (!strcmp(a.argv()[argpos], "--ignore_eit_channels"))
152 + ignore_on_air = true;
154 else if (!strcmp(a.argv()[argpos], "--graboptions"))
156 if (((argpos + 1) >= a.argc()))
157 @@ -3646,6 +3677,14 @@
158 cout << " override custom channel names, which is why it is\n";
159 cout << " off by default.\n";
161 + cout << "--add_missing_channels\n";
162 + cout << " Insert any channels that are found but not in\n";
163 + cout << " the database. This is off by default, as it can\n";
164 + cout << " cause issues with DVB channels.\n";
166 + cout << "--ignore_eit_channels\n";
167 + cout << " Don't get data for any channels that are marked\n"; cout << " As using the on-air guid.\n";
169 cout << "--graboptions <\"options\">\n";
170 cout << " Pass options to grabber\n";