Ticket #1626: playgroup.patch

File playgroup.patch, 17.3 KB (added by derek@…, 6 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     èš­å®šé …目の意味がわからないずきは倉曎しないでください。MythTVが正垞に動䜜しなくなりたす。
181 "Please search for something."
182Index: modules/_shared/lang/English.lang
183===================================================================
184--- modules/_shared/lang/English.lang   (revision 9646)
185+++ modules/_shared/lang/English.lang   (working copy)
186@@ -234,6 +234,7 @@
187 "Past Year"
188 "People"
189 "People Search"
190+"Playback Group"
191 "Please be warned that by altering this table without knowing what you are doing, you could seriously disrupt mythtv functionality."
192 "Please search for something."
193 "plot"
194Index: modules/_shared/lang/Czech.lang
195===================================================================
196--- modules/_shared/lang/Czech.lang     (revision 9646)
197+++ modules/_shared/lang/Czech.lang     (working copy)
198@@ -295,6 +295,7 @@
199 "Past Year"
200 "People"
201 "People Search"
202+"Playback Group"
203 "Please be warned that by altering this table without knowing what you are doing, you could seriously disrupt mythtv functionality."
204 "Please search for something."
205 "plot"
206Index: modules/_shared/lang/Finnish.lang
207===================================================================
208--- modules/_shared/lang/Finnish.lang   (revision 9646)
209+++ modules/_shared/lang/Finnish.lang   (working copy)
210@@ -414,6 +414,7 @@
211 "People"
212 "People Search"
213     Haku NimellÀ
214+"Playback Group"
215 "Please be warned that by altering this table without knowing what you are doing, you could seriously disrupt mythtv functionality."
216     Varoitus: NÀiden asetusten muokkaus voi haitata MythTV:n toimintaa.
217 "Please search for something."
218Index: modules/_shared/lang/Slovenian.lang
219===================================================================
220--- modules/_shared/lang/Slovenian.lang (revision 9646)
221+++ modules/_shared/lang/Slovenian.lang (working copy)
222@@ -341,6 +341,7 @@
223 "Past Year"
224 "People"
225 "People Search"
226+"Playback Group"
227 "Please be warned that by altering this table without knowing what you are doing, you could seriously disrupt mythtv functionality."
228 "Please search for something."
229     Prosim poiščite kaj
230Index: modules/tv/schedules_custom.php
231===================================================================
232--- modules/tv/schedules_custom.php     (revision 9646)
233+++ modules/tv/schedules_custom.php     (working copy)
234@@ -100,6 +100,7 @@
235             $schedule->findday       = $_POST['findday'];
236             $schedule->autotranscode = $_POST['autotranscode'] ? 1 : 0;
237             $schedule->transcoder    = $_POST['transcoder'];
238+            $schedule->playgroup     = $_POST['playgroup'];
239         // Parse the findtime
240             $schedule->findtime      = trim($_POST['findtime']);
241             if ($schedule->findtime) {
242Index: modules/tv/schedules_manual.php
243===================================================================
244--- modules/tv/schedules_manual.php     (revision 9646)
245+++ modules/tv/schedules_manual.php     (working copy)
246@@ -87,6 +87,7 @@
247             $schedule->findtime    = date('H:m:s', $schedule->starttime);
248             $schedule->autotranscode = $_POST['autotranscode'] ? 1 : 0;
249             $schedule->transcoder  = $_POST['transcoder'];
250+            $schedule->playgroup   = $_POST['playgroup'];
251         // Figure out the title
252             $channel = $Channels[$_POST['channel']];
253             if (strcasecmp($_POST['title'], t('Use callsign')) == 0) {
254Index: modules/tv/detail.php
255===================================================================
256--- modules/tv/detail.php       (revision 9646)
257+++ modules/tv/detail.php       (working copy)
258@@ -132,6 +132,7 @@
259             $schedule->endoffset     = intval($_POST['endoffset']);
260             $schedule->autotranscode = $_POST['autotranscode'] ? 1 : 0;
261             $schedule->transcoder    = $_POST['transcoder'];
262+            $schedule->playgroup     = $_POST['playgroup'];
263             $schedule->tsdefault     = $_POST['timestretch'];
264         // Keep track of the parent recording for overrides
265             if ($_POST['record'] == rectype_override) {
266Index: modules/tv/tmpl/default/schedules_custom.php
267===================================================================
268--- modules/tv/tmpl/default/schedules_custom.php        (revision 9646)
269+++ modules/tv/tmpl/default/schedules_custom.php        (working copy)
270@@ -160,6 +160,8 @@
271                         echo ">$i</option>";
272                     }
273                     ?></select></dd>
274+                <dt><?php echo t('Playback Group') ?>:</dt>
275+                <dd><?php playgroup_select($schedule->playgroup) ?></dd>
276                 <dt><?php echo t('Check for duplicates in') ?>:</dt>
277                 <dd><select name="dupin"><?php
278                         echo '<option value="1"';
279Index: modules/tv/tmpl/default/schedules_manual.php
280===================================================================
281--- modules/tv/tmpl/default/schedules_manual.php        (revision 9646)
282+++ modules/tv/tmpl/default/schedules_manual.php        (working copy)
283@@ -113,6 +113,8 @@
284                         echo ">$i</option>";
285                     }
286                     ?></select></dd>
287+                <dt><?php echo t('Playback Group') ?>:</dt>
288+                <dd><?php playgroup_select($schedule->playgroup) ?></dd>
289                 <dt><?php echo t('Check for duplicates in') ?>:</dt>
290                 <dd><select name="dupin"><?php
291                         echo '<option value="1"';
292Index: modules/tv/tmpl/default/detail.php
293===================================================================
294--- modules/tv/tmpl/default/detail.php  (revision 9646)
295+++ modules/tv/tmpl/default/detail.php  (working copy)
296@@ -371,6 +371,8 @@
297                         echo ">$i</option>";
298                     }
299                     ?></select></dd>
300+                <dt><?php echo t('Playback Group') ?>:</dt>
301+                <dd><?php playgroup_select($schedule->playgroup) ?></dd>
302                 <dt><?php echo t('Time Stretch Default') ?>:</dt>
303                 <dd>
304                     <select name="timestretch">
305Index: modules/tv/tmpl/default/recorded.php
306===================================================================
307--- modules/tv/tmpl/default/recorded.php        (revision 9646)
308+++ modules/tv/tmpl/default/recorded.php        (working copy)
309@@ -68,6 +68,14 @@
310                    +'&chanid='+file.chanid+'&starttime='+file.starttime);
311     }
312 
313+    function set_playgroup(id) {
314+        var file = files[id];
315+        var sel  = get_element('playgroup_' + file.chanid + '.' + file.starttime);
316+        submit_url('<?php echo root ?>tv/recorded?ajax&playgroup='+
317+                    sel.options[sel.selectedIndex].value+
318+                    '&chanid='+file.chanid+'&starttime='+file.starttime);
319+    }
320+
321     function confirm_delete(id, forget_old) {
322         var file = files[id];
323         if (confirm("<?php echo t('Are you sure you want to delete the following show?') ?>\n\n     "+file.title+": "+file.subtitle)) {
324@@ -325,6 +333,9 @@
325              name="autoexpire_<?php echo $show->chanid, '.', $show->recstartts ?>"
326              <?php if ($show->auto_expire) echo ' CHECKED' ?> onchange="set_autoexpire(<?php echo $row ?>)" />
327             </span>
328+        <span style="padding-right: 25px"><?php echo strtolower(t('Playback Group')) ?>:&nbsp;
329+            <?php playgroup_select($show->playgroup, 'playgroup', "set_playgroup($row)", $show->chanid . '.' . $show->recstartts) ?>
330+            </span>
331         <?php echo t('has bookmark') ?>:&nbsp;
332             <b><?php echo $show->bookmark ? t('Yes') : t('No') ?></b>
333         </td>
334Index: modules/tv/recorded.php
335===================================================================
336--- modules/tv/recorded.php     (revision 9646)
337+++ modules/tv/recorded.php     (working copy)
338@@ -58,18 +58,27 @@
339 
340 // Auto-expire
341     isset($_GET['autoexpire']) or $_GET['autoexpire'] = $_POST['autoexpire'];
342-    if (isset($_GET['autoexpire']) && $_GET['chanid'] && $_GET['starttime']) {
343+    if (isset($_GET['autoexpire']) && $_GET['chanid'] && $_GET['starttime'])
344         $sh = $db->query('UPDATE recorded
345                              SET autoexpire = ?
346                            WHERE chanid = ? AND starttime = FROM_UNIXTIME(?)',
347                          $_GET['autoexpire'] ? 1 : 0,
348                          $_GET['chanid'],
349                          $_GET['starttime']);
350+// Playback group edit
351+    isset($_GET['playgroup']) or $_GET['playgroup'] = $_POST['playgroup'];
352+    if(isset($_GET['playgroup']) && $_GET['chanid'] && $_GET['starttime'])
353+        $sh = $db->query('UPDATE recorded
354+                             SET playgroup = ?
355+                           WHERE chanid = ? AND starttime = FROM_UNIXTIME(?)',
356+                         $_GET['playgroup'],
357+                         $_GET['chanid'],
358+                         $_GET['starttime']);
359+
360     // Exit early if we're in AJAX mode.
361-        if (isset($_GET['ajax'])) {
362-            echo 'success';
363-            exit;
364-        }
365+    if (isset($_GET['ajax'])) {
366+        echo 'success';
367+        exit;
368     }
369     else {
370         /** @todo need some sort of handler here for the non-ajax stuff */