Ticket #6898: c--TESTED-OLD.PATCH

File c--TESTED-OLD.PATCH, 12.3 KB (added by f-myth-users@…, 16 years ago)
Line 
1--- libs/libmythtv/datadirect.cpp.before-runtime 2008-01-09 16:45:26.000000000 -0500
2+++ libs/libmythtv/datadirect.cpp 2009-06-26 15:41:52.966867566 -0400
3@@ -221,11 +221,11 @@
4
5 query.prepare("INSERT INTO dd_program (programid, title, subtitle, "
6 "description, showtype, category_type, mpaarating, "
7- "starrating, stars, runtime, year, seriesid, colorcode, "
8+ "starrating, stars, runtime, sd_runtime, year, seriesid, colorcode, "
9 "syndicatedepisodenumber, originalairdate) "
10 "VALUES(:PROGRAMID,:TITLE,:SUBTITLE,:DESCRIPTION,"
11 ":SHOWTYPE,:CATTYPE,:MPAARATING,:STARRATING,:STARS,"
12- ":RUNTIME,:YEAR,:SERIESID,:COLORCODE,:SYNDNUM,"
13+ ":RUNTIME,:SD_RUNTIME,:YEAR,:SERIESID,:COLORCODE,:SYNDNUM,"
14 ":ORIGINALAIRDATE);");
15 query.bindValue(":PROGRAMID", curr_program.programid);
16 query.bindValue(":TITLE", curr_program.title.utf8());
17@@ -237,6 +237,7 @@
18 query.bindValue(":STARRATING", curr_program.starRating);
19 query.bindValue(":STARS", staravg);
20 query.bindValue(":RUNTIME", curr_program.duration);
21+ query.bindValue(":SD_RUNTIME", curr_program.sd_runtime);
22 query.bindValue(":YEAR", curr_program.year);
23 query.bindValue(":SERIESID", curr_program.seriesid);
24 query.bindValue(":COLORCODE", curr_program.colorcode);
25@@ -295,6 +296,7 @@
26
27 bool DDStructureParser::characters(const QString& pchars)
28 {
29+ int h, m;
30 // cerr << "Characters : " << pchars << "\n";
31 if (pchars.stripWhiteSpace().isEmpty())
32 return true;
33@@ -352,9 +354,11 @@
34 else if (currtagname == "runTime")
35 {
36 QString runtimestr = pchars;
37- QTime runtime = QTime(runtimestr.mid(2,2).toInt(),
38- runtimestr.mid(5,2).toInt(), 0, 0);
39+
40+ QTime runtime = QTime(h = runtimestr.mid(2,2).toInt(),
41+ m = runtimestr.mid(5,2).toInt(), 0, 0);
42 curr_program.duration = runtime;
43+ curr_program.sd_runtime = h * 60 + m;
44 }
45 else if (currtagname == "originalAirDate")
46 {
47@@ -412,13 +416,13 @@
48 "closecaptioned, partnumber, parttotal, seriesid, "
49 "originalairdate, showtype, category_type, colorcode, "
50 "syndicatedepisodenumber, tvrating, mpaarating, "
51- "programid) "
52+ "programid, sd_runtime) "
53 "SELECT chanid, scheduletime, endtime, title, "
54 "subtitle, description, year, stars, repeat, stereo, "
55 "subtitled, hdtv, closecaptioned, partnumber, "
56 "parttotal, seriesid, originalairdate, showtype, "
57 "category_type, colorcode, syndicatedepisodenumber, "
58- "tvrating, mpaarating, dd_program.programid "
59+ "tvrating, mpaarating, dd_program.programid, sd_runtime "
60 "FROM channel, dd_schedule, dd_program WHERE "
61 " ( (dd_schedule.programid = dd_program.programid) AND "
62 " (channel.xmltvid = dd_schedule.stationid) AND "
63@@ -625,6 +629,7 @@
64 table = "( programid char(20) NOT NULL, seriesid char(12), "
65 "title varchar(120), subtitle varchar(150), description text, "
66 "mpaarating char(5), starrating char(5), runtime time, "
67+ "sd_runtime smallint unsigned, "
68 "year char(4), showtype char(30), category_type char(64), "
69 "colorcode char(20), originalairdate date, "
70 "syndicatedepisodenumber char(20), stars float unsigned, "
71@@ -634,6 +639,7 @@
72 table = "( chanid int unsigned NOT NULL, starttime datetime NOT NULL, "
73 "endtime datetime, title varchar(128), subtitle varchar(128), "
74 "description text, category varchar(64), "
75+ "sd_runtime smallint unsigned, "
76 "category_type varchar(64), airdate year, stars float unsigned, "
77 "previouslyshown tinyint, repeat bool, stereo bool, "
78 "subtitled bool, hdtv bool, closecaptioned bool, partnumber int, "
79--- libs/libmythtv/datadirect.h.before-runtime 2005-05-04 15:40:07.000000000 -0400
80+++ libs/libmythtv/datadirect.h 2009-06-13 00:19:19.558883882 -0400
81@@ -88,6 +88,7 @@
82 stationid = "";
83 time = QDateTime();
84 duration = QTime();
85+ sd_runtime = 0;
86 repeat = false;
87 stereo = false;
88 subtitled = false;
89@@ -102,6 +103,7 @@
90 QString stationid; // 12
91 QDateTime time;
92 QTime duration;
93+ int sd_runtime;
94 bool repeat;
95 bool stereo;
96 bool subtitled;
97@@ -127,6 +129,7 @@
98 mpaaRating = "";
99 starRating = "";
100 duration = QTime();
101+ sd_runtime = 0;
102 year = "";
103 showtype = "";
104 colorcode = "";
105@@ -142,6 +145,7 @@
106 QString mpaaRating; // 5
107 QString starRating; // 5
108 QTime duration;
109+ int sd_runtime;
110 QString year; // 4
111 QString showtype; // 30
112 QString colorcode; // 20
113--- programs/mythfilldatabase/filldata.cpp.before-runtime 2005-05-05 03:10:39.000000000 -0400
114+++ programs/mythfilldatabase/filldata.cpp 2009-06-12 13:12:14.820790191 -0400
115@@ -125,6 +125,7 @@
116 colorcode = other.colorcode;
117 syndicatedepisodenumber = other.syndicatedepisodenumber;
118 programid = other.programid;
119+ sd_runtime = other.sd_runtime;
120
121 clumpidx = other.clumpidx;
122 clumpmax = other.clumpmax;
123@@ -160,6 +161,7 @@
124 QString colorcode;
125 QString syndicatedepisodenumber;
126 QString programid;
127+ QString sd_runtime;
128
129 QString clumpidx;
130 QString clumpmax;
131@@ -885,13 +887,13 @@
132 "airdate, stars, previouslyshown, stereo, subtitled, "
133 "hdtv, closecaptioned, partnumber, parttotal, seriesid, "
134 "originalairdate, colorcode, syndicatedepisodenumber, "
135- "programid) "
136+ "sd_runtime, programid) "
137 "SELECT chanid, starttime, endtime, "
138 "title, subtitle, description, "
139 "showtype, dd_genre.class, category_type, "
140 "airdate, stars, previouslyshown, stereo, subtitled, "
141 "hdtv, closecaptioned, partnumber, parttotal, seriesid, "
142- "originalairdate, colorcode, syndicatedepisodenumber, "
143+ "originalairdate, colorcode, syndicatedepisodenumber, sd_runtime, "
144 "dd_v_program.programid FROM dd_v_program "
145 "LEFT JOIN dd_genre ON ("
146 "dd_v_program.programid = dd_genre.programid AND "
147@@ -2251,6 +2253,7 @@
148 "showtype=:SHOWTYPE AND "
149 "colorcode=:COLORCODE AND "
150 "syndicatedepisodenumber=:SYNDICATEDEPISODENUMBER AND "
151+ "sd_runtime=:SD_RUNTIME AND "
152 "programid=:PROGRAMID;");
153 query.bindValue(":CHANID", chanid);
154 query.bindValue(":START", startstr);
155@@ -2274,6 +2277,7 @@
156 query.bindValue(":SHOWTYPE", (*i).showtype);
157 query.bindValue(":COLORCODE", (*i).colorcode);
158 query.bindValue(":SYNDICATEDEPISODENUMBER", (*i).syndicatedepisodenumber);
159+ query.bindValue(":SD_RUNTIME", (*i).sd_runtime);
160 query.bindValue(":PROGRAMID", (*i).programid);
161 query.exec();
162
163@@ -2344,13 +2348,13 @@
164 "airdate,stars,previouslyshown,title_pronounce,stereo,"
165 "subtitled,hdtv,closecaptioned,partnumber,parttotal,"
166 "seriesid,originalairdate,showtype,colorcode,"
167- "syndicatedepisodenumber,programid) "
168+ "syndicatedepisodenumber,sd_runtime,programid) "
169 "VALUES(:CHANID,:STARTTIME,:ENDTIME,:TITLE,"
170 ":SUBTITLE,:DESCRIPTION,:CATEGORY,:CATEGORY_TYPE,:AIRDATE,:STARS,"
171 ":PREVIOUSLYSHOWN,:TITLE_PRONOUNCE,:STEREO,:SUBTITLED,"
172 ":HDTV,:CLOSECAPTIONED,:PARTNUMBER,:PARTTOTAL,:SERIESID,"
173 ":ORIGINALAIRDATE,:SHOWTYPE,:COLORCODE,:SYNDICATEDEPISODENUMBER,"
174- ":PROGRAMID);");
175+ ":SD_RUNTIME,:PROGRAMID);");
176 query.bindValue(":CHANID", chanid);
177 query.bindValue(":STARTTIME", startstr);
178 query.bindValue(":ENDTIME", endstr);
179@@ -2374,6 +2378,7 @@
180 query.bindValue(":SHOWTYPE", (*i).showtype);
181 query.bindValue(":COLORCODE", (*i).colorcode);
182 query.bindValue(":SYNDICATEDEPISODENUMBER", (*i).syndicatedepisodenumber);
183+ query.bindValue(":SD_RUNTIME", (*i).sd_runtime);
184 query.bindValue(":PROGRAMID", (*i).programid);
185 if (!query.exec())
186 {
187--- /usr/share/mythtv/mythweb/themes/Default/program_detail.php 2009-06-19 02:38:18.000000000 -0400
188+++ /usr/share/mythtv/mythweb/themes/Default/program_detail.php.before-runtime 2005-09-24 00:19:00.000000000 -0400
189@@ -55,41 +55,8 @@
190 echo ' ('.t('Rerun').')';
191 echo '<br />'
192 .t('$1 to $2', strftime('%r', $schedule->starttime), strftime('%r', $schedule->endtime));
193- if ($program) {
194+ if ($program)
195 echo ' ('.tn('$1 min', '$1 mins', intval($program->length/60)).')';
196- // If sd_runtime not in table, blow out visibly by barfing on later use! Can only happen if the table schema isn't in sync w/this function, which shouldn't happen.
197- // ($result will be a boolean false if this erred, or a resource if this succeeded.)
198- $result = mysql_query("SELECT sd_runtime FROM program WHERE chanid = '$program->chanid' AND starttime = from_unixtime($schedule->starttime)");
199- list($sd_runtime) = mysql_fetch_row($result);
200- mysql_free_result($result);
201- // We must get the ORIGINAL (unpadded!) scheduled time and compare it to sd_runtime, for two reasons:
202- // (a) If the program overflows its timeslot, I want to know -even if- it's apparently padded enough,
203- // because it might be that the padding -just- compensates for the putative overflow but then isn't
204- // also doing its job of compensating for clock skew---hence an overflow eats into our clock skew
205- // allowance and might eat it up entirely.
206- // (b) Any preroll padding -can't- be counted as helping to compensate for an overflow, since by definition
207- // overflows can only push the end later---having padding before it starts can't help us at all.
208- // Once we've compared the original scheduling with sd_runtime, we can then -also- see if our postroll claims to help.
209- $scheduled_length = ($schedule->endtime - $schedule->starttime) / 60;
210- $overflow = ($sd_runtime - $scheduled_length);
211- if ($overflow > 0) {
212- // The runtime is larger than the scheduled time, so it has definitely overflowed.
213- // If it's larger than even the postroll-padded time, panic!
214- // Note that the colors below should be in CSS, not here. And, for the first time
215- // since 12/10/94 and Netscape 1.0, I've -finally- found a use for the <blink> tag...
216- $postroll = is_null($program->recendts) ? 0 : ($program->recendts - $schedule->endtime) / 60;
217- $postrolled_overflow = $overflow - $postroll;
218- if ($postrolled_overflow >= 0) { // >= and not just > because, even if it's exactly right, this means we've lost our postroll margin, so complain vociferously.
219- $extra = ($postroll > 0) ? " even w/$postroll postroll" : "";
220- $pack = ($postroll > 0) ? "<br>" : "&nbsp;";
221- echo " $pack<blink><font color=red>($postrolled_overflow min over$extra!)</font></blink>";
222- }
223- else { // Not over including the postroll, but we should still call attention to it.
224- $mpo = -$postrolled_overflow;
225- echo " <br><font color=red>($overflow min over, but $postroll min postroll gives $mpo min safety)</font>";
226- }
227- }
228- }
229 if ($_GET['recordid'])
230 echo "</span>";
231 echo "<br />\n";