]> git.pld-linux.org Git - packages/mythtv.git/blob - myth_datadirect-dn_r10247.diff
- obsolete
[packages/mythtv.git] / myth_datadirect-dn_r10247.diff
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
6 @@ -60,7 +60,8 @@
7  bool dddataretrieved = false;
8  bool mark_repeats = true;
9  bool channel_updates = false;
10 -
11 +bool add_missing_channels = false;
12 +bool ignore_on_air = false;
13  int maxDays = 0;
14  int listing_wrap_offset = 0;
15  
16 @@ -263,8 +264,12 @@
17  void clearDataBySource(int sourceid, QDateTime from, QDateTime to) 
18  {
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");
25 +    if (ignore_on_air)
26 +        queryStr += QString(" AND useonairguide <> 1");
27 +    query.prepare(queryStr);
28      query.bindValue(":SOURCE", sourceid);
29  
30      if (!query.exec())
31 @@ -795,6 +800,17 @@
32  
33      ddprocessor.updateStationViewTable();
34  
35 +    if (ignore_on_air)
36 +    {
37 +        // Remove xmltvid from all channels with 'useonairguide' set
38 +        MSqlQuery remove_id(MSqlQuery::DDCon());
39 +        remove_id.prepare(
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);
45 +    }
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.
49 @@ -840,9 +856,13 @@
50              }
51  
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)");
58 +            if (ignore_on_air)
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);
64 @@ -862,7 +882,7 @@
65                      "UPDATE channel "
66                      "SET xmltvid = :XMLTVID "
67                      "WHERE chanid = :CHANID AND sourceid = :SOURCEID");
68 -
69 +                
70                  while (query.next())
71                  {
72                      uint chanid = query.value(0).toInt();
73 @@ -879,36 +899,39 @@
74                  continue; // go on to next channel without xmltv
75              }
76  
77 -            // The channel doesn't exist in the DB, insert it...
78 -            int mplexid = -1, majorC, minorC, chanid = 0;
79 -            long long freq;
80 -            get_atsc_stuff(channum, source.id, freqid,
81 -                           majorC, minorC, freq);
82 -
83 -            if (minorC > 0 && freq >= 0)
84 +            if (add_missing_channels)
85              {
86 -                mplexid = ChannelUtil::CreateMultiplex(
87 -                    source.id, "atsc", freq, "8vsb");
88 -            }
89 -
90 -            if ((mplexid > 0) || (minorC == 0))
91 -                chanid = ChannelUtil::CreateChanID(source.id, channum);
92 -
93 -            if (chanid > 0)
94 -            {
95 -                QString icon   = "";
96 -                int  serviceid = 0;
97 -                bool oag       = false; // use on air guide
98 -                bool hidden    = false;
99 -                bool hidden_in_guide = false;
100 -
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,
107 -                    xmltvid);
108 +                // The channel doesn't exist in the DB, insert it...
109 +                int mplexid = -1, majorC, minorC, chanid = 0;
110 +                long long freq;
111 +                get_atsc_stuff(channum, source.id, freqid,
112 +                               majorC, minorC, freq);
113 +    
114 +                if (minorC > 0 && freq >= 0)
115 +                {
116 +                    mplexid = ChannelUtil::CreateMultiplex(
117 +                        source.id, "atsc", freq, "8vsb");
118 +                }
119 +    
120 +                if ((mplexid > 0) || (minorC == 0))
121 +                    chanid = ChannelUtil::CreateChanID(source.id, channum);
122 +    
123 +                if (chanid > 0)
124 +                {
125 +                    QString icon   = "";
126 +                    int  serviceid = 0;
127 +                    bool oag       = false; // use on air guide
128 +                    bool hidden    = false;
129 +                    bool hidden_in_guide = false;
130 +    
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,
137 +                        xmltvid);
138 +                }
139              }
140          }
141      }
142 @@ -3441,6 +3464,14 @@
143          {
144              channel_updates = true;
145          }
146 +        else if (!strcmp(a.argv()[argpos], "--add_missing_channels"))
147 +        {
148 +            add_missing_channels = true;
149 +        }
150 +        else if (!strcmp(a.argv()[argpos], "--ignore_eit_channels"))
151 +        {
152 +            ignore_on_air = true;
153 +        }
154          else if (!strcmp(a.argv()[argpos], "--graboptions"))
155          {
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";
160              cout << "\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";
165 +            cout << "\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";
168 +            cout << "\n";
169              cout << "--graboptions <\"options\">\n";
170              cout << "   Pass options to grabber\n";
171              cout << "\n";
This page took 0.103193 seconds and 3 git commands to generate.