Ticket #1791: mythtv-0.20.jobhibernate-filldatafix.patch.txt

File mythtv-0.20.jobhibernate-filldatafix.patch.txt, 6.2 KB (added by mrsam@…, 19 years ago)

0.20 patch, part II

Line 
1--- programs/mythfilldatabase/filldata.cpp.nostatic 2006-09-25 23:08:37.000000000 -0400
2+++ programs/mythfilldatabase/filldata.cpp 2006-09-29 23:08:18.000000000 -0400
3@@ -78,7 +78,6 @@
4 int listing_wrap_offset = 0;
5
6 QString lastdduserid;
7-DataDirectProcessor ddprocessor;
8 QString graboptions = "";
9 QString cardtype = QString::null;
10
11@@ -879,17 +878,19 @@
12 }
13
14 // DataDirect stuff
15-void DataDirectStationUpdate(Source source, bool update_icons = true)
16+void DataDirectStationUpdate(Source source,
17+ DataDirectProcessor &ddprocessor,
18+ bool update_icons = true)
19 {
20- DataDirectProcessor::UpdateStationViewTable(source.lineupid);
21+ ddprocessor.UpdateStationViewTable(source.lineupid);
22
23 bool insert_channels = insert_chan(source.id);
24- int new_channels = DataDirectProcessor::UpdateChannelsSafe(
25+ int new_channels = ddprocessor.UpdateChannelsSafe(
26 source.id, insert_channels);
27
28 // User must pass "--do-channel-updates" for these updates
29 if (channel_updates)
30- DataDirectProcessor::UpdateChannelsUnsafe(source.id);
31+ ddprocessor.UpdateChannelsUnsafe(source.id);
32 // TODO delete any channels which no longer exist in listings source
33
34 if (update_icons)
35@@ -919,7 +920,7 @@
36 }
37 }
38
39-bool DataDirectUpdateChannels(Source source)
40+bool DataDirectUpdateChannels(DataDirectProcessor &ddprocessor, Source source)
41 {
42 ddprocessor.SetListingsProvider(DD_ZAP2IT);
43 ddprocessor.SetUserID(source.userid);
44@@ -931,7 +932,7 @@
45 raw_lineup = source.id;
46
47 if (ok)
48- DataDirectStationUpdate(source, false);
49+ DataDirectStationUpdate(source, ddprocessor, false);
50
51 return ok;
52 }
53@@ -1030,7 +1031,8 @@
54 //cerr << "Done...\n";
55 }
56
57-bool grabDDData(Source source, int poffset, QDate pdate, int ddSource)
58+bool grabDDData(Source source, int poffset, QDate pdate, int ddSource,
59+ DataDirectProcessor &ddprocessor)
60 {
61 ddprocessor.SetListingsProvider(ddSource);
62 ddprocessor.SetUserID(source.userid);
63@@ -1111,13 +1113,13 @@
64 if (!channel_update_run)
65 {
66 VERBOSE(VB_GENERAL, "Updating myth channels.");
67- DataDirectStationUpdate(source);
68+ DataDirectStationUpdate(source, ddprocessor);
69 VERBOSE(VB_GENERAL, "Channels updated.");
70 channel_update_run = true;
71 }
72
73 //cerr << "Creating program view table...\n";
74- DataDirectProcessor::UpdateProgramViewTable(source.id);
75+ ddprocessor.UpdateProgramViewTable(source.id);
76 //cerr << "Finished creating program view table...\n";
77
78 myMonitor->hibernate();
79@@ -2618,12 +2620,14 @@
80 return secsSince1Jan1970UTC;
81 }
82
83-bool grabData(Source source, int offset, QDate *qCurrentDate = 0)
84+bool grabData(DataDirectProcessor &ddprocessor,
85+ Source source, int offset, QDate *qCurrentDate = 0)
86 {
87 QString xmltv_grabber = source.xmltvgrabber;
88
89 if (xmltv_grabber == "datadirect")
90- return grabDDData(source, offset, *qCurrentDate, DD_ZAP2IT);
91+ return grabDDData(source, offset, *qCurrentDate, DD_ZAP2IT,
92+ ddprocessor);
93 else if (xmltv_grabber == "technovera")
94 {
95 VERBOSE(VB_ALL, "This grabber is no longer supported");
96@@ -2816,7 +2820,9 @@
97 }
98
99 void grabDataFromDDFile(int id, int offset, const QString &filename,
100- const QString &lineupid, QDate *qCurrentDate = 0)
101+ const QString &lineupid,
102+ DataDirectProcessor &ddprocessor,
103+ QDate *qCurrentDate = 0)
104 {
105 QDate *currentd = qCurrentDate;
106 QDate qcd = QDate::currentDate();
107@@ -2832,7 +2838,7 @@
108 s.password = "fromfile";
109 s.lineupid = lineupid;
110
111- grabData(s, offset, currentd);
112+ grabData(ddprocessor, s, offset, currentd);
113 }
114
115 void clearOldDBEntries(void)
116@@ -2962,7 +2968,8 @@
117 * program info grabbed with the associated grabber.
118 * \return true if there was no failures
119 */
120-bool fillData(QValueList<Source> &sourcelist)
121+bool fillData(QValueList<Source> &sourcelist,
122+ DataDirectProcessor &ddprocessor)
123 {
124 QValueList<Source>::Iterator it;
125
126@@ -3009,17 +3016,17 @@
127 {
128 // These don't support the --offset option, so just grab the max.
129 // TODO: tv_grab_fi/dk/is seems to support --offset, maybe more. Needs verification.
130- if (!grabData(*it, 0))
131+ if (!grabData(ddprocessor, *it, 0))
132 ++failures;
133 }
134 else if ((xmltv_grabber == "datadirect") && dd_grab_all)
135 {
136 if (only_update_channels)
137- DataDirectUpdateChannels(*it);
138+ DataDirectUpdateChannels(ddprocessor, *it);
139 else
140 {
141 QDate qCurrentDate = QDate::currentDate();
142- grabData(*it, 0, &qCurrentDate);
143+ grabData(ddprocessor, *it, 0, &qCurrentDate);
144 }
145 }
146 else if (xmltv_grabber == "datadirect" ||
147@@ -3064,7 +3071,7 @@
148
149 if ((xmltv_grabber == "datadirect") && only_update_channels)
150 {
151- DataDirectUpdateChannels(*it);
152+ DataDirectUpdateChannels(ddprocessor, *it);
153 grabdays = 0;
154 }
155
156@@ -3238,7 +3245,7 @@
157 {
158 VERBOSE(VB_IMPORTANT,
159 QString("Refreshing data for ") + currDate);
160- if (!grabData(*it, i, &qCurrentDate))
161+ if (!grabData(ddprocessor, *it, i, &qCurrentDate))
162 {
163 ++failures;
164 if (interrupted)
165@@ -3949,7 +3956,9 @@
166
167 gContext->LogEntry("mythfilldatabase", LP_INFO,
168 "Listings Download Started", "");
169-
170+
171+ DataDirectProcessor ddprocessor;
172+
173 JobMonitor jobMonitor(-1);
174
175 myMonitor= &jobMonitor;
176@@ -4033,7 +4042,7 @@
177 else if (from_dd_file)
178 {
179 grabDataFromDDFile(fromfile_id, fromfile_offset, fromfile_name,
180- fromddfile_lineupid);
181+ fromddfile_lineupid, ddprocessor);
182 clearOldDBEntries();
183 }
184 else
185@@ -4098,7 +4107,7 @@
186 return FILLDB_EXIT_DB_ERROR;
187 }
188
189- if (!fillData(sourcelist))
190+ if (!fillData(sourcelist, ddprocessor))
191 {
192 VERBOSE(VB_IMPORTANT, "Failed to fetch some program info");
193 gContext->LogEntry("mythfilldatabase", LP_WARNING,