Ticket #2718: job-queue.diff
File job-queue.diff, 16.7 KB (added by , 17 years ago) |
---|
-
mythweb/modules/tv/tmpl/default/recorded.php
236 236 $prev_group = ''; 237 237 $cur_group = ''; 238 238 239 $rows_per_entry = $_SESSION['recorded_descunder'] ? 3 : 2; 240 $buttons_under = TRUE; 241 239 242 foreach ($All_Shows as $show) { 240 243 241 244 // Print a dividing row if grouping changes … … 266 269 267 270 echo "<tr id=\"inforow_$row\" class=\"recorded\">\n"; 268 271 if ($group_field != "") 269 echo "\t<td class=\"list\" rowspan=\"". ($_SESSION['recorded_descunder'] ? 3 : 2)."\"> </td>\n";272 echo "\t<td class=\"list\" rowspan=\"".$rows_per_entry."\"> </td>\n"; 270 273 if ($_SESSION['recorded_pixmaps']) { 271 echo "\t<td rowspan=\"". ($_SESSION['recorded_descunder'] ? 3 : 2).'">';274 echo "\t<td rowspan=\"".$rows_per_entry.'">'; 272 275 if (file_exists(cache_dir.'/'.basename($show->filename).'.png')) { 273 276 list($width, $height, $type, $attr) = getimagesize(cache_dir.'/'.basename($show->filename).'.png'); 274 277 echo "<a href=\"$show->url\" name=\"$row\">" … … 297 300 <td nowrap align="center"><?php echo strftime($_SESSION['date_recorded'], $show->starttime) ?></td> 298 301 <td nowrap><?php echo nice_length($show->length) ?></td> 299 302 <td nowrap><?php echo nice_filesize($show->filesize) ?></td> 300 <?php if ($show->endtime > time()) { ?> 303 <?php 304 if (!$buttons_under) { 305 if ($show->endtime > time()) { ?> 301 306 <td width="5%">currently recording</td> 302 307 <?php } else { ?> 303 <td width="5%" rowspan="<?php echo $ _SESSION['recorded_descunder'] ? 2 :1 ?>" class="command command_border_l command_border_t command_border_b command_border_r" align="center">308 <td width="5%" rowspan="<?php echo $rows_per_entry - 1 ?>" class="command command_border_l command_border_t command_border_b command_border_r" align="center"> 304 309 <a id="delete_<?php echo $row ?>" 305 310 href="<?php echo root ?>tv/recorded?delete=yes&chanid=<?php echo $show->chanid ?>&starttime=<?php echo $show->recstartts ?>" 306 311 js_href="javascript:confirm_delete(<?php echo $row ?>, false)"; … … 308 313 ><?php echo t('Delete') ?></a> 309 314 </td> 310 315 <?php } 316 } 311 317 312 318 if ($_SESSION['recorded_descunder']) 313 319 echo("</tr><tr id=\"descunderrow_".$row."\" class=\"recorded\">\n\t<td colspan=\"" . (6 + $recgroup_cols) . "\">".$show->description."</td>\n"); 314 320 ?> 315 </tr><tr id="statusrow_<?php echo $row ?>" class="recorded">316 <td nowrap colspan="<?php echo 6 + ($_SESSION['recorded_descunder'] ? 0 : 1) + $recgroup_cols ?>" align="center">317 <span style="padding-right: 25px"><?php echo t('has commflag') ?>: 318 <b><?php echo $show->has_commflag ? t('Yes') : t('No') ?></b></span>319 <span style="padding-right: 25px"><?php echo t('has cutlist') ?>: 320 <b><?php echo $show->has_cutlist ? t('Yes') : t('No') ?></b></span>321 <span style="padding-right: 25px"><?php echo t('is editing') ?>: 322 <b><?php echo $show->is_editing ? t('Yes') : t('No') ?></b></span>323 <span style="padding-right: 25px"><?php echo t('auto-expire') ?>: 321 </tr><tr id="statusrow_<?php echo $row ?>" class="recorded"><td colspan="<?php echo 6 + ($_SESSION['recorded_descunder'] ? 0 : 1) + $recgroup_cols ?>"> 322 <table width="100%" cellspacing="2" cellpadding="1"><tr> 323 <td align="center"><?php echo t('has commflag') ?>: 324 <b><?php echo $show->has_commflag ? t('Yes') : t('No') ?></b></td> 325 <td align="center"><?php echo t('has cutlist') ?>: 326 <b><?php echo $show->has_cutlist ? t('Yes') : t('No') ?></b></td> 327 <td align="center"><?php echo t('is editing') ?>: 328 <b><?php echo $show->is_editing ? t('Yes') : t('No') ?></b></td> 329 <td align="center"><?php echo t('auto-expire') ?>: 324 330 <input type="checkbox" id="autoexpire_<?php echo $show->chanid, '.', $show->recstartts ?>" 325 331 name="autoexpire_<?php echo $show->chanid, '.', $show->recstartts ?>" 326 332 <?php if ($show->auto_expire) echo ' CHECKED' ?> onclick="set_autoexpire(<?php echo $row ?>)" /> 327 </span> 328 <span style="padding-right: 25px"><?php echo t('has bookmark') ?>: 329 <b><?php echo $show->bookmark ? t('Yes') : t('No') ?></b></span> 330 <?php echo t('has been watched') ?>: 331 <b><?php echo $show->is_watched ? t('Yes') : t('No') ?></b> 332 </td> 333 </td> 334 <td align="center"><?php echo t('has bookmark') ?>: 335 <b><?php echo $show->bookmark ? t('Yes') : t('No') ?></b></td> 336 <td align="center"><?php echo t('has been watched') ?>: 337 <b><?php echo $show->is_watched ? t('Yes') : t('No') ?></b></td> 338 339 <?php 340 if ($buttons_under) { 341 foreach ($jobs as $k => $desc) { 342 ?> 343 <td class="command command_border_l command_border_t command_border_b command_border_r" align="center"> 344 <a id="<?php echo $k.'_'.$row ?>" 345 href="<?php echo root ?>tv/recorded?job=<?php echo $k; ?>&chanid=<?php echo $show->chanid; 346 ?>&starttime=<?php echo $show->starttime; ?>" 347 ><?php echo $desc ?></a></td> 348 <?php 349 } 350 351 if ($show->endtime > time()) { ?> 352 <td width="10%">currently recording</td> 353 <?php } else { ?> 354 <td width="5%" class="command command_border_l command_border_t command_border_b command_border_r" align="center"> 355 <a id="delete_<?php echo $row ?>" 356 href="<?php echo root ?>tv/recorded?delete=yes&chanid=<?php echo $show->chanid ?>&starttime=<?php echo $show->recstartts ?>" 357 js_href="javascript:confirm_delete(<?php echo $row ?>, false)"; 358 title="<?php echo html_entities(t('Delete $1', preg_replace('/: $/', '', $show->title.': '.$show->subtitle))) ?>" 359 ><?php echo t('Delete') ?></a> 360 </td> 361 <td width="5%" class="command command_border_l command_border_t command_border_b command_border_r" align="center"> 362 <a id="delete_rerecord_<?php echo $row ?>" 363 href="<?php echo root ?>tv/recorded?delete=yes&chanid=<?php echo $show->chanid ?>&starttime=<?php echo $show->recstartts ?>&forget_old" 364 js_href="javascript:confirm_delete(<?php echo $row ?>, true)"; 365 title="<?php echo html_entities(t('Delete and rerecord $1', preg_replace('/: $/', '', $show->title.': '.$show->subtitle))) ?>" 366 ><?php echo t('Delete + Rerecord') ?></a></td> 367 </td> 368 <?php } 369 } 370 ?> 371 </tr> 372 </table> 373 </td> 374 <?php 375 if (!$buttons_under) { ?> 333 376 <td width="5%" class="command command_border_l command_border_t command_border_b command_border_r" align="center"> 334 377 <a id="delete_rerecord_<?php echo $row ?>" 335 378 href="<?php echo root ?>tv/recorded?delete=yes&chanid=<?php echo $show->chanid ?>&starttime=<?php echo $show->recstartts ?>&forget_old" … … 337 380 title="<?php echo html_entities(t('Delete and rerecord $1', preg_replace('/: $/', '', $show->title.': '.$show->subtitle))) ?>" 338 381 ><?php echo t('Delete + Rerecord') ?></a></td> 339 382 </td> 383 <?php } ?> 340 384 </tr><?php 341 385 $prev_group = $cur_group; 342 386 // Keep track of how many shows are visible in each section -
mythweb/modules/tv/tmpl/compact/recorded.php
236 236 $prev_group = ''; 237 237 $cur_group = ''; 238 238 239 $rows_per_entry = $_SESSION['recorded_descunder'] ? 3 : 2; 240 $buttons_under = TRUE; 241 239 242 foreach ($All_Shows as $show) { 240 243 241 244 // Print a dividing row if grouping changes … … 266 269 267 270 echo "<tr id=\"inforow_$row\" class=\"recorded\">\n"; 268 271 if ($group_field != "") 269 echo "\t<td class=\"list\" rowspan=\"". ($_SESSION['recorded_descunder'] ? 3 : 2)."\"> </td>\n";272 echo "\t<td class=\"list\" rowspan=\"".$rows_per_entry."\"> </td>\n"; 270 273 if ($_SESSION['recorded_pixmaps']) { 271 echo "\t<td rowspan=\"". ($_SESSION['recorded_descunder'] ? 3 : 2).'">';274 echo "\t<td rowspan=\"".$rows_per_entry.'">'; 272 275 if (file_exists(cache_dir.'/'.basename($show->filename).'.png')) { 273 276 list($width, $height, $type, $attr) = getimagesize(cache_dir.'/'.basename($show->filename).'.png'); 274 277 echo "<a href=\"$show->url\" name=\"$row\">" … … 297 300 <td nowrap align="center"><?php echo strftime($_SESSION['date_recorded'], $show->starttime) ?></td> 298 301 <td nowrap><?php echo nice_length($show->length) ?></td> 299 302 <td nowrap><?php echo nice_filesize($show->filesize) ?></td> 300 <?php if ($show->endtime > time()) { ?> 303 <?php 304 if (!$buttons_under) { 305 if ($show->endtime > time()) { ?> 301 306 <td width="5%">currently recording</td> 302 307 <?php } else { ?> 303 <td width="5%" rowspan="<?php echo $ _SESSION['recorded_descunder'] ? 2 :1 ?>" class="command command_border_l command_border_t command_border_b command_border_r" align="center">308 <td width="5%" rowspan="<?php echo $rows_per_entry - 1 ?>" class="command command_border_l command_border_t command_border_b command_border_r" align="center"> 304 309 <a id="delete_<?php echo $row ?>" 305 310 href="<?php echo root ?>tv/recorded?delete=yes&chanid=<?php echo $show->chanid ?>&starttime=<?php echo $show->recstartts ?>" 306 311 js_href="javascript:confirm_delete(<?php echo $row ?>, false)"; … … 308 313 ><?php echo t('Delete') ?></a> 309 314 </td> 310 315 <?php } 316 } 311 317 312 318 if ($_SESSION['recorded_descunder']) 313 319 echo("</tr><tr id=\"descunderrow_".$row."\" class=\"recorded\">\n\t<td colspan=\"" . (6 + $recgroup_cols) . "\">".$show->description."</td>\n"); 314 320 ?> 315 </tr><tr id="statusrow_<?php echo $row ?>" class="recorded">316 <td nowrap colspan="<?php echo 6 + ($_SESSION['recorded_descunder'] ? 0 : 1) + $recgroup_cols ?>" align="center">317 <span style="padding-right: 25px"><?php echo t('has commflag') ?>: 318 <b><?php echo $show->has_commflag ? t('Yes') : t('No') ?></b></span>319 <span style="padding-right: 25px"><?php echo t('has cutlist') ?>: 320 <b><?php echo $show->has_cutlist ? t('Yes') : t('No') ?></b></span>321 <span style="padding-right: 25px"><?php echo t('is editing') ?>: 322 <b><?php echo $show->is_editing ? t('Yes') : t('No') ?></b></span>323 <span style="padding-right: 25px"><?php echo t('auto-expire') ?>: 321 </tr><tr id="statusrow_<?php echo $row ?>" class="recorded"><td colspan="<?php echo 6 + ($_SESSION['recorded_descunder'] ? 0 : 1) + $recgroup_cols ?>"> 322 <table width="100%" cellspacing="2" cellpadding="1"><tr> 323 <td align="center"><?php echo t('has commflag') ?>: 324 <b><?php echo $show->has_commflag ? t('Yes') : t('No') ?></b></td> 325 <td align="center"><?php echo t('has cutlist') ?>: 326 <b><?php echo $show->has_cutlist ? t('Yes') : t('No') ?></b></td> 327 <td align="center"><?php echo t('is editing') ?>: 328 <b><?php echo $show->is_editing ? t('Yes') : t('No') ?></b></td> 329 <td align="center"><?php echo t('auto-expire') ?>: 324 330 <input type="checkbox" id="autoexpire_<?php echo $show->chanid, '.', $show->recstartts ?>" 325 331 name="autoexpire_<?php echo $show->chanid, '.', $show->recstartts ?>" 326 332 <?php if ($show->auto_expire) echo ' CHECKED' ?> onclick="set_autoexpire(<?php echo $row ?>)" /> 327 </span> 328 <span style="padding-right: 25px"><?php echo t('has bookmark') ?>: 329 <b><?php echo $show->bookmark ? t('Yes') : t('No') ?></b></span> 330 <?php echo t('has been watched') ?>: 331 <b><?php echo $show->is_watched ? t('Yes') : t('No') ?></b> 332 </td> 333 </td> 334 <td align="center"><?php echo t('has bookmark') ?>: 335 <b><?php echo $show->bookmark ? t('Yes') : t('No') ?></b></td> 336 <td align="center"><?php echo t('has been watched') ?>: 337 <b><?php echo $show->is_watched ? t('Yes') : t('No') ?></b></td> 338 339 <?php 340 if ($buttons_under) { 341 foreach ($jobs as $k => $desc) { 342 ?> 343 <td class="command command_border_l command_border_t command_border_b command_border_r" align="center"> 344 <a id="<?php echo $k.'_'.$row ?>" 345 href="<?php echo root ?>tv/recorded?job=<?php echo $k; ?>&chanid=<?php echo $show->chanid; 346 ?>&starttime=<?php echo $show->starttime; ?>" 347 ><?php echo $desc ?></a></td> 348 <?php 349 } 350 351 if ($show->endtime > time()) { ?> 352 <td width="10%">currently recording</td> 353 <?php } else { ?> 354 <td width="5%" class="command command_border_l command_border_t command_border_b command_border_r" align="center"> 355 <a id="delete_<?php echo $row ?>" 356 href="<?php echo root ?>tv/recorded?delete=yes&chanid=<?php echo $show->chanid ?>&starttime=<?php echo $show->recstartts ?>" 357 js_href="javascript:confirm_delete(<?php echo $row ?>, false)"; 358 title="<?php echo html_entities(t('Delete $1', preg_replace('/: $/', '', $show->title.': '.$show->subtitle))) ?>" 359 ><?php echo t('Delete') ?></a> 360 </td> 361 <td width="5%" class="command command_border_l command_border_t command_border_b command_border_r" align="center"> 362 <a id="delete_rerecord_<?php echo $row ?>" 363 href="<?php echo root ?>tv/recorded?delete=yes&chanid=<?php echo $show->chanid ?>&starttime=<?php echo $show->recstartts ?>&forget_old" 364 js_href="javascript:confirm_delete(<?php echo $row ?>, true)"; 365 title="<?php echo html_entities(t('Delete and rerecord $1', preg_replace('/: $/', '', $show->title.': '.$show->subtitle))) ?>" 366 ><?php echo t('Delete + Rerecord') ?></a></td> 367 </td> 368 <?php } 369 } 370 ?> 371 </tr> 372 </table> 373 </td> 374 <?php 375 if (!$buttons_under) { ?> 333 376 <td width="5%" class="command command_border_l command_border_t command_border_b command_border_r" align="center"> 334 377 <a id="delete_rerecord_<?php echo $row ?>" 335 378 href="<?php echo root ?>tv/recorded?delete=yes&chanid=<?php echo $show->chanid ?>&starttime=<?php echo $show->recstartts ?>&forget_old" … … 337 380 title="<?php echo html_entities(t('Delete and rerecord $1', preg_replace('/: $/', '', $show->title.': '.$show->subtitle))) ?>" 338 381 ><?php echo t('Delete + Rerecord') ?></a></td> 339 382 </td> 383 <?php } ?> 340 384 </tr><?php 341 385 $prev_group = $cur_group; 342 386 // Keep track of how many shows are visible in each section -
mythweb/modules/tv/recorded.php
13 13 * 14 14 /**/ 15 15 16 require_once 'includes/jobqueue.php'; 17 16 18 // Populate the $Channels array 17 19 load_all_channels(); 18 20 … … 53 55 } 54 56 } 55 57 58 $q = ''; 59 for ($i = 1; $i < 5; ++$i) { 60 $q .= ', \'UserJob'.$i.'\', \'UserJobDesc'.$i.'\''; 61 } 62 63 $jobs = array(); 64 65 $sh = $db->query('SELECT value, data 66 FROM settings 67 WHERE hostname IS NULL 68 AND value IN ('.substr($q, 2).') 69 ORDER BY value'); 70 71 while (list($value, $data) = $sh->fetch_row()) { 72 $jobs[$value] = $data; 73 } 74 75 for ($i = 1; $i < 5; ++$i) { 76 if ($jobs['UserJob'.$i]) 77 $jobs[JOB_USERJOBS * $i] = $jobs['UserJobDesc'.$i]; 78 unset($jobs['UserJobDesc'.$i]); 79 unset($jobs['UserJob'.$i]); 80 } 81 82 $jobs[JOB_TRANSCODE] = t('Transcode'); 83 $jobs[JOB_COMMFLAG] = t('Flag commercials'); 84 85 ksort($jobs); 86 56 87 // Load the sorting routines 57 88 require_once "includes/sorting.php"; 58 89 … … 75 106 /** @todo need some sort of handler here for the non-ajax stuff */ 76 107 } 77 108 109 // Queue a job? 110 isset($_GET['job']) or $_GET['job'] = $_POST['job']; 111 if ($_GET['job'] && $_GET['chanid'] && $_GET['starttime']) { 112 $sh = $db->query('INSERT jobqueue SET chanid=?, starttime=FROM_UNIXTIME(?), inserttime=NOW(), 113 type=?, hostname=?, args=\'\', 114 status='.JOB_QUEUED.', statustime=NOW(), 115 comment=\'Queued by MythWeb\', 116 flags='.JOB_USE_CUTLIST, 117 $_GET['chanid'], 118 $_GET['starttime'], 119 $_GET['job'], 120 hostname 121 ); 122 } 123 78 124 // Delete a program? 79 125 isset($_GET['forget_old']) or $_GET['forget_old'] = $_POST['forget_old']; 80 126 isset($_GET['delete']) or $_GET['delete'] = $_POST['delete'];