Skip to content

Commit e3720fd

Browse files
author
Isaac Richards
committed
Patches from Anduin Withers to add a default timestretch value on a scheduled recording basis.
Closes #71 and #1. git-svn-id: http://svn.mythtv.org/svn/trunk@6865 7dbf422c-18fa-0310-86e9-fd20926502f2
1 parent 4d8c625 commit e3720fd

File tree

6 files changed

+50
-4
lines changed

6 files changed

+50
-4
lines changed

includes/mythbackend.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414

1515
// MYTH_PROTO_VERSION is defined in libmyth in mythtv/libs/libmyth/mythcontext.h
1616
// and should be the current MythTV protocol version.
17-
define('MYTH_PROTO_VERSION', 17);
17+
define('MYTH_PROTO_VERSION', 18);
1818

1919
// NUMPROGRAMLINES is defined in mythtv/libs/libmythtv/programinfo.h and is
2020
// the number of items in a ProgramInfo QStringList group used by
2121
// ProgramInfo::ToSringList and ProgramInfo::FromStringList.
22-
$NUMPROGRAMLINES = 39;
22+
$NUMPROGRAMLINES = 40;
2323

2424
// Keep track of the master backend port/ip
2525
$Master_Host = get_backend_setting('MasterServerIP');
@@ -265,6 +265,7 @@ function generate_preview_pixmap($show) {
265265
$show->starttime, // dummy lastmodified
266266
'0', // dummy stars
267267
$show->starttime, // dummy org airdate
268+
'', // dummy timestretch
268269
'', // trailing separator
269270
);
270271
$lastmodified = strtotime(backend_command($cmd));

includes/programs.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ class Program {
230230
var $starstring;
231231
var $is_movie;
232232

233+
var $timestretch;
234+
233235
var $credits = array();
234236

235237
function Program($data) {
@@ -295,6 +297,8 @@ function Program($data) {
295297
$this->lastmodified = $data[35];
296298
$this->recpriority = $data[36];
297299
#$this->airdate = $data[37];
300+
#$this->hasairdate = $data[38];
301+
$this->timestretch = $program_data[39];
298302
// Assign the program flags
299303
$this->has_commflag = ($progflags & 0x01) ? true : false; // FL_COMMFLAG = 0x01
300304
$this->has_cutlist = ($progflags & 0x02) ? true : false; // FL_CUTLIST = 0x02
@@ -335,6 +339,12 @@ function Program($data) {
335339
$this->colorcode = $data['colorcode'];
336340
$this->syndicatedepisodenumber = $data['syndicatedepisodenumber'];
337341
$this->title_pronounce = $data['title_pronounce'];
342+
343+
if ($program_data['tsdefault']) {
344+
$this->timestretch = $program_data['tsdefault'];
345+
} else {
346+
$this->timestretch = 1.0;
347+
}
338348
}
339349
// No longer a null column, so check for blank entries
340350
if ($this->airdate == '0000-00-00')

includes/recording_schedules.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ class Schedule {
136136
var $channel;
137137
var $will_record = false;
138138
var $class; // css class, based on category and/or category_type
139+
var $tsdefault;
139140

140141
function Schedule($data) {
141142
// Schedule object data -- just copy it into place
@@ -153,6 +154,7 @@ function Schedule($data) {
153154
}
154155
// Empty Schedule
155156
elseif (is_null($data)) {
157+
$this->tsdefault = defined('default_rec_ts') ? default_rec_ts : 1.0;
156158
return;
157159
}
158160
// Something else
@@ -220,7 +222,7 @@ function save($new_type) {
220222
// Update the type, in case it changed
221223
$this->type = $new_type;
222224
// Update the record
223-
$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) values ('
225+
$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,tsdefault) values ('
224226
.escape($this->recordid, true) .','
225227
.escape($this->type) .','
226228
.escape($this->chanid) .','
@@ -252,7 +254,8 @@ function save($new_type) {
252254
.escape($this->findtime) .','
253255
.escape($this->findid) .','
254256
.escape($this->autotranscode) .','
255-
.escape($this->transcoder) .')')
257+
.escape($this->transcoder) .','
258+
.escape($this->tsdefault) .')')
256259
or trigger_error('SQL Error: '.mysql_error(), FATAL);
257260
// Get the id that was returned
258261
$recordid = mysql_insert_id();

includes/utils.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,3 +248,9 @@ function DEBUG($data, $file = false) {
248248
}
249249
}
250250

251+
function fequals($lhs, $rhs) {
252+
$epsilon = 1e-3;
253+
return abs($lhs - $rhs) <= $epsilon * abs($lhs);
254+
}
255+
256+
?>

program_detail.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
$schedule->endoffset = intval($_POST['endoffset']);
109109
$schedule->autotranscode = $_POST['autotranscode'] ? 1 : 0;
110110
$schedule->transcoder = $_POST['transcoder'];
111+
$schedule->tsdefault = $_POST['timestretch'];
111112
// Back up the program type, and save the schedule
112113
$schedule->save($type);
113114
}

themes/Default/program_detail.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,31 @@ function print_page(&$program, &$schedule, &$channel) {
296296
echo ">$i</option>";
297297
}
298298
?></select></dd>
299+
<dt><?php echo t('Time Stretch Default') ?>:</dt>
300+
<dd>
301+
<select name="timestretch">
302+
<?php
303+
$tsstep = 0.05;
304+
for ($tscount = 0.5; $tscount < 2.01; $tscount += $tsstep) {
305+
$matches = fequals($schedule->tsdefault, $tscount);
306+
307+
if (!$matches &&
308+
$schedule->tsdefault < $tscount &&
309+
$schedule->tsdefault > $tscount - $tsstep) {
310+
printf('<option value="%01.2f" selected>%01.2f' .
311+
"</option>\n", $schedule->tsdefault,
312+
$schedule->tsdefault);
313+
}
314+
315+
printf('<option value="%01.2f"', $tscount);
316+
if ($matches) {
317+
echo ' selected';
318+
}
319+
printf(">%01.2f</option>\n", $tscount);
320+
}
321+
?>
322+
</select>
323+
</dd>
299324
<dt><?php echo t('Check for duplicates in') ?>:</dt>
300325
<dd><select name="dupin"><?php
301326
echo '<option value="1"';

0 commit comments

Comments
 (0)