Ticket #1626: playgroup.patch

File playgroup.patch, 17.3 KB (added by derek@…, 20 years ago)

patch to allow playback group changes from MythWeb

Line 
1Index: includes/programs.php
2===================================================================
3--- includes/programs.php (revision 9646)
4+++ includes/programs.php (working copy)
5@@ -261,6 +261,7 @@
6 var $is_movie;
7
8 var $timestretch;
9+ var $playgroup;
10
11 var $credits = array();
12
13@@ -333,7 +334,8 @@
14 $this->recpriority = $data[36];
15 $this->airdate = date('Y-m-d', $data[37]);
16 $this->hasairdate = $data[38];
17- $this->timestretch = $data[39];
18+ $this->playgroup = $data[39];
19+ $this->timestretch = ''; # Not printed by ToStringList()
20 $this->recpriority2 = $data[40];
21 // Assign the program flags
22 $this->has_commflag = ($progflags & 0x01) ? true : false; // FL_COMMFLAG = 0x01
23Index: includes/recording_schedules.php
24===================================================================
25--- includes/recording_schedules.php (revision 9646)
26+++ includes/recording_schedules.php (working copy)
27@@ -143,6 +143,7 @@
28 var $findid;
29 var $transcoder;
30 var $parentid;
31+ var $playgroup;
32
33 var $texttype;
34 var $channel;
35@@ -251,7 +252,7 @@
36 // Update the type, in case it changed
37 $this->type = $new_type;
38 // Update the record
39- $result = mysql_query('REPLACE INTO record (recordid,type,chanid,starttime,startdate,endtime,enddate,search,title,subtitle,description,profile,recpriority,category,maxnewest,inactive,maxepisodes,autoexpire,startoffset,endoffset,recgroup,dupmethod,dupin,station,seriesid,programid,autocommflag,findday,findtime,findid,autotranscode,transcoder,parentid,tsdefault,autouserjob1,autouserjob2,autouserjob3,autouserjob4) values ('
40+ $result = mysql_query('REPLACE INTO record (recordid,type,chanid,starttime,startdate,endtime,enddate,search,title,subtitle,description,profile,recpriority,category,maxnewest,inactive,maxepisodes,autoexpire,startoffset,endoffset,recgroup,dupmethod,dupin,station,seriesid,programid,autocommflag,findday,findtime,findid,autotranscode,transcoder,parentid,tsdefault,autouserjob1,autouserjob2,autouserjob3,autouserjob4,playgroup) values ('
41 .escape($this->recordid, true) .','
42 .escape($this->type) .','
43 .escape($this->chanid) .','
44@@ -289,7 +290,8 @@
45 .escape($this->autouserjob1) .','
46 .escape($this->autouserjob2) .','
47 .escape($this->autouserjob3) .','
48- .escape($this->autouserjob4) .')')
49+ .escape($this->autouserjob4) .','
50+ .escape($this->playgroup) .')')
51 or trigger_error('SQL Error: '.mysql_error(), FATAL);
52 // Get the id that was returned
53 $recordid = mysql_insert_id();
54@@ -512,4 +514,31 @@
55 echo '</select>';
56 }
57
58+/**
59+ * prints a <select> of the various playback groups available
60+/**/
61+ function playgroup_select($this_playgroup, $name = 'playgroup', $js = '', $id = '')
62+ {
63+ static $playgroups = array();
64+ if(!sizeof($playgroups))
65+ {
66+ $res = mysql_query('SELECT name FROM playgroup');
67+ while($row = mysql_fetch_row($res))
68+ $playgroups[$row[0]] = $row[0];
69+ mysql_free_result($res);
70+ }
71
72+ echo "<select name=\"$name\"";
73+ if(strlen($js))
74+ echo " onchange=\"$js\" id=\"playgroup_$id\" name=\"playgroup_$id\"";
75+ echo ">\n";
76+ foreach($playgroups as $playgroup)
77+ {
78+ echo "\t<option value=\"" . html_entities($playgroup) . '"';
79+ if($this_playgroup == $playgroup)
80+ echo ' SELECTED';
81+ echo '>' . html_entities($playgroup) . "</option>\n";
82+ }
83+ echo "</select>\n";
84+ return;
85+ }
86Index: modules/_shared/lang/English_GB.lang
87===================================================================
88--- modules/_shared/lang/English_GB.lang (revision 9646)
89+++ modules/_shared/lang/English_GB.lang (working copy)
90@@ -244,6 +244,7 @@
91 "Past Year"
92 "People"
93 "People Search"
94+"Playback Group"
95 "Please be warned that by altering this table without knowing what you are doing, you could seriously disrupt mythtv functionality."
96 "Please search for something."
97 "plot"
98Index: modules/_shared/lang/French.lang
99===================================================================
100--- modules/_shared/lang/French.lang (revision 9646)
101+++ modules/_shared/lang/French.lang (working copy)
102@@ -347,6 +347,7 @@
103 "Past Year"
104 "People"
105 "People Search"
106+"Playback Group"
107 "Please be warned that by altering this table without knowing what you are doing, you could seriously disrupt mythtv functionality."
108 Nous vous pr&eacute;venons que modifier les touches sans savoir ce que vous fa&icirc;tes peut s&eacute;rieusement endomager le fonctionnement de MythTV
109 "Please search for something."
110Index: modules/_shared/lang/Spanish.lang
111===================================================================
112--- modules/_shared/lang/Spanish.lang (revision 9646)
113+++ modules/_shared/lang/Spanish.lang (working copy)
114@@ -427,6 +427,7 @@
115 Gente
116 "People Search"
117 Búsqueda gente
118+"Playback Group"
119 "Please be warned that by altering this table without knowing what you are doing, you could seriously disrupt mythtv functionality."
120 Tenga cuidado al alterar esta tabla sin saber lo que hace, puede romper el funcionamiento de MythTV
121 "Please search for something."
122Index: modules/_shared/lang/Danish.lang
123===================================================================
124--- modules/_shared/lang/Danish.lang (revision 9646)
125+++ modules/_shared/lang/Danish.lang (working copy)
126@@ -374,6 +374,7 @@
127 "Past Year"
128 "People"
129 "People Search"
130+"Playback Group"
131 "Please be warned that by altering this table without knowing what you are doing, you could seriously disrupt mythtv functionality."
132 BemÊrk at ved at Êndre i denne tabel uden at vide hvad du laver, kan du ÞdelÊgge mythtvs funktioner.
133 "Please search for something."
134Index: modules/_shared/lang/Swedish.lang
135===================================================================
136--- modules/_shared/lang/Swedish.lang (revision 9646)
137+++ modules/_shared/lang/Swedish.lang (working copy)
138@@ -431,6 +431,7 @@
139 Person
140 "People Search"
141 Sök person
142+"Playback Group"
143 "Please be warned that by altering this table without knowing what you are doing, you could seriously disrupt mythtv functionality."
144 OBS! Genom att Àndra dessa instÀllningar utan att veta vad du gör kan du allvarligt störa MythTVs funktionalitet.
145 "Please search for something."
146Index: modules/_shared/lang/Dutch.lang
147===================================================================
148--- modules/_shared/lang/Dutch.lang (revision 9646)
149+++ modules/_shared/lang/Dutch.lang (working copy)
150@@ -430,6 +430,7 @@
151 Personen
152 "People Search"
153 Personen zoeken
154+"Playback Group"
155 "Please be warned that by altering this table without knowing what you are doing, you could seriously disrupt mythtv functionality."
156 Waarschuwing! Als u niet weet wat u doet, kan het veranderen van deze tabel de werking van MythTV ernstig verstoren.
157 "Please search for something."
158Index: modules/_shared/lang/German.lang
159===================================================================
160--- modules/_shared/lang/German.lang (revision 9646)
161+++ modules/_shared/lang/German.lang (working copy)
162@@ -427,6 +427,7 @@
163 Leute
164 "People Search"
165 Suche nach Darsteller
166+"Playback Group"
167 "Please be warned that by altering this table without knowing what you are doing, you could seriously disrupt mythtv functionality."
168 Achtung! Falls diese Tabelle ohne das nötige Hintergrundwissen verÀndert wird, könnte MythTVs FunktionalitÀt nachhaltig gestört werden.
169 "Please search for something."
170Index: modules/_shared/lang/Japanese.lang
171===================================================================
172--- modules/_shared/lang/Japanese.lang (revision 9646)
173+++ modules/_shared/lang/Japanese.lang (working copy)
174@@ -399,6 +399,7 @@
175 ピヌプル
176 "People Search"
177 ピヌプルサヌチ
178+"Playback Group"
179 "Please be warned that by altering this table without knowing what you are doing, you could seriously disrupt mythtv functionality."
180 蚭定項
181目の意味がわからないずきは倉曎しないでください。MythTVが正垞に動䜜しなくなりたす。
182 "Please search for something."
183Index: modules/_shared/lang/English.lang
184===================================================================
185--- modules/_shared/lang/English.lang (revision 9646)
186+++ modules/_shared/lang/English.lang (working copy)
187@@ -234,6 +234,7 @@
188 "Past Year"
189 "People"
190 "People Search"
191+"Playback Group"
192 "Please be warned that by altering this table without knowing what you are doing, you could seriously disrupt mythtv functionality."
193 "Please search for something."
194 "plot"
195Index: modules/_shared/lang/Czech.lang
196===================================================================
197--- modules/_shared/lang/Czech.lang (revision 9646)
198+++ modules/_shared/lang/Czech.lang (working copy)
199@@ -295,6 +295,7 @@
200 "Past Year"
201 "People"
202 "People Search"
203+"Playback Group"
204 "Please be warned that by altering this table without knowing what you are doing, you could seriously disrupt mythtv functionality."
205 "Please search for something."
206 "plot"
207Index: modules/_shared/lang/Finnish.lang
208===================================================================
209--- modules/_shared/lang/Finnish.lang (revision 9646)
210+++ modules/_shared/lang/Finnish.lang (working copy)
211@@ -414,6 +414,7 @@
212 "People"
213 "People Search"
214 Haku NimellÀ
215+"Playback Group"
216 "Please be warned that by altering this table without knowing what you are doing, you could seriously disrupt mythtv functionality."
217 Varoitus: NÀiden asetusten muokkaus voi haitata MythTV:n toimintaa.
218 "Please search for something."
219Index: modules/_shared/lang/Slovenian.lang
220===================================================================
221--- modules/_shared/lang/Slovenian.lang (revision 9646)
222+++ modules/_shared/lang/Slovenian.lang (working copy)
223@@ -341,6 +341,7 @@
224 "Past Year"
225 "People"
226 "People Search"
227+"Playback Group"
228 "Please be warned that by altering this table without knowing what you are doing, you could seriously disrupt mythtv functionality."
229 "Please search for something."
230 Prosim poiščite kaj
231Index: modules/tv/schedules_custom.php
232===================================================================
233--- modules/tv/schedules_custom.php (revision 9646)
234+++ modules/tv/schedules_custom.php (working copy)
235@@ -100,6 +100,7 @@
236 $schedule->findday = $_POST['findday'];
237 $schedule->autotranscode = $_POST['autotranscode'] ? 1 : 0;
238 $schedule->transcoder = $_POST['transcoder'];
239+ $schedule->playgroup = $_POST['playgroup'];
240 // Parse the findtime
241 $schedule->findtime = trim($_POST['findtime']);
242 if ($schedule->findtime) {
243Index: modules/tv/schedules_manual.php
244===================================================================
245--- modules/tv/schedules_manual.php (revision 9646)
246+++ modules/tv/schedules_manual.php (working copy)
247@@ -87,6 +87,7 @@
248 $schedule->findtime = date('H:m:s', $schedule->starttime);
249 $schedule->autotranscode = $_POST['autotranscode'] ? 1 : 0;
250 $schedule->transcoder = $_POST['transcoder'];
251+ $schedule->playgroup = $_POST['playgroup'];
252 // Figure out the title
253 $channel = $Channels[$_POST['channel']];
254 if (strcasecmp($_POST['title'], t('Use callsign')) == 0) {
255Index: modules/tv/detail.php
256===================================================================
257--- modules/tv/detail.php (revision 9646)
258+++ modules/tv/detail.php (working copy)
259@@ -132,6 +132,7 @@
260 $schedule->endoffset = intval($_POST['endoffset']);
261 $schedule->autotranscode = $_POST['autotranscode'] ? 1 : 0;
262 $schedule->transcoder = $_POST['transcoder'];
263+ $schedule->playgroup = $_POST['playgroup'];
264 $schedule->tsdefault = $_POST['timestretch'];
265 // Keep track of the parent recording for overrides
266 if ($_POST['record'] == rectype_override) {
267Index: modules/tv/tmpl/default/schedules_custom.php
268===================================================================
269--- modules/tv/tmpl/default/schedules_custom.php (revision 9646)
270+++ modules/tv/tmpl/default/schedules_custom.php (working copy)
271@@ -160,6 +160,8 @@
272 echo ">$i</option>";
273 }
274 ?></select></dd>
275+ <dt><?php echo t('Playback Group') ?>:</dt>
276+ <dd><?php playgroup_select($schedule->playgroup) ?></dd>
277 <dt><?php echo t('Check for duplicates in') ?>:</dt>
278 <dd><select name="dupin"><?php
279 echo '<option value="1"';
280Index: modules/tv/tmpl/default/schedules_manual.php
281===================================================================
282--- modules/tv/tmpl/default/schedules_manual.php (revision 9646)
283+++ modules/tv/tmpl/default/schedules_manual.php (working copy)
284@@ -113,6 +113,8 @@
285 echo ">$i</option>";
286 }
287 ?></select></dd>
288+ <dt><?php echo t('Playback Group') ?>:</dt>
289+ <dd><?php playgroup_select($schedule->playgroup) ?></dd>
290 <dt><?php echo t('Check for duplicates in') ?>:</dt>
291 <dd><select name="dupin"><?php
292 echo '<option value="1"';
293Index: modules/tv/tmpl/default/detail.php
294===================================================================
295--- modules/tv/tmpl/default/detail.php (revision 9646)
296+++ modules/tv/tmpl/default/detail.php (working copy)
297@@ -371,6 +371,8 @@
298 echo ">$i</option>";
299 }
300 ?></select></dd>
301+ <dt><?php echo t('Playback Group') ?>:</dt>
302+ <dd><?php playgroup_select($schedule->playgroup) ?></dd>
303 <dt><?php echo t('Time Stretch Default') ?>:</dt>
304 <dd>
305 <select name="timestretch">
306Index: modules/tv/tmpl/default/recorded.php
307===================================================================
308--- modules/tv/tmpl/default/recorded.php (revision 9646)
309+++ modules/tv/tmpl/default/recorded.php (working copy)
310@@ -68,6 +68,14 @@
311 +'&chanid='+file.chanid+'&starttime='+file.starttime);
312 }
313
314+ function set_playgroup(id) {
315+ var file = files[id];
316+ var sel = get_element('playgroup_' + file.chanid + '.' + file.starttime);
317+ submit_url('<?php echo root ?>tv/recorded?ajax&playgroup='+
318+ sel.options[sel.selectedIndex].value+
319+ '&chanid='+file.chanid+'&starttime='+file.starttime);
320+ }
321+
322 function confirm_delete(id, forget_old) {
323 var file = files[id];
324 if (confirm("<?php echo t('Are you sure you want to delete the following show?') ?>\n\n "+file.title+": "+file.subtitle)) {
325@@ -325,6 +333,9 @@
326 name="autoexpire_<?php echo $show->chanid, '.', $show->recstartts ?>"
327 <?php if ($show->auto_expire) echo ' CHECKED' ?> onchange="set_autoexpire(<?php echo $row ?>)" />
328 </span>
329+ <span style="padding-right: 25px"><?php echo strtolower(t('Playback Group')) ?>:&nbsp;
330+ <?php playgroup_select($show->playgroup, 'playgroup', "set_playgroup($row)", $show->chanid . '.' . $show->recstartts) ?>
331+ </span>
332 <?php echo t('has bookmark') ?>:&nbsp;
333 <b><?php echo $show->bookmark ? t('Yes') : t('No') ?></b>
334 </td>
335Index: modules/tv/recorded.php
336===================================================================
337--- modules/tv/recorded.php (revision 9646)
338+++ modules/tv/recorded.php (working copy)
339@@ -58,18 +58,27 @@
340
341 // Auto-expire
342 isset($_GET['autoexpire']) or $_GET['autoexpire'] = $_POST['autoexpire'];
343- if (isset($_GET['autoexpire']) && $_GET['chanid'] && $_GET['starttime']) {
344+ if (isset($_GET['autoexpire']) && $_GET['chanid'] && $_GET['starttime'])
345 $sh = $db->query('UPDATE recorded
346 SET autoexpire = ?
347 WHERE chanid = ? AND starttime = FROM_UNIXTIME(?)',
348 $_GET['autoexpire'] ? 1 : 0,
349 $_GET['chanid'],
350 $_GET['starttime']);
351+// Playback group edit
352+ isset($_GET['playgroup']) or $_GET['playgroup'] = $_POST['playgroup'];
353+ if(isset($_GET['playgroup']) && $_GET['chanid'] && $_GET['starttime'])
354+ $sh = $db->query('UPDATE recorded
355+ SET playgroup = ?
356+ WHERE chanid = ? AND starttime = FROM_UNIXTIME(?)',
357+ $_GET['playgroup'],
358+ $_GET['chanid'],
359+ $_GET['starttime']);
360+
361 // Exit early if we're in AJAX mode.
362- if (isset($_GET['ajax'])) {
363- echo 'success';
364- exit;
365- }
366+ if (isset($_GET['ajax'])) {
367+ echo 'success';
368+ exit;
369 }
370 else {
371 /** @todo need some sort of handler here for the non-ajax stuff */