[mythtv-users] Pre and Post Roll in MythWeb [Patch]

William Powers wepprop at sbcglobal.net
Wed Feb 4 22:04:00 EST 2004


Ok, well, attached is a crude and slightly tested patch to add pre- and 
post- roll selections to the program detail dialog of the Default theme 
only (me not knowing if the change would be appropriate for the other 
themes.)  This might serve as the starting point for a better crafted 
update.

Bill

Chris Petersen wrote:
>>When using the MythWeb scheduling interface, is there currently
>>any way to set the per-show pre and post roll?  It doesn't appear
>>so, but every other time I wondered about something in MythWeb, I
>>found out that it was already in there and I just hadn't figured
>>it out yet!
> 
> 
> No one told me there was such a thing, so as far as I know, it's not
> there.
> 
> Unfortunately, I've been swamped in life for the past few months, and
> haven't had much time to poke at mythweb.
> 

---------------------------------------------------------------------------

diff -u -r mythweb/includes/programs.php mythweb-new/includes/programs.php
--- mythweb/includes/programs.php	2004-02-04 15:54:05.000000000 -0600
+++ mythweb-new/includes/programs.php	2004-02-04 20:45:48.000000000 -0600
@@ -149,7 +149,7 @@
  							.' SUM(record.type = 2) > 0 AS record_daily,'
  							.' SUM(record.type = 1) > 0 AS record_once,'
  							.' IF(record.profile > 0, recordingprofiles.name, \'Default\') 
as profilename,'
-							.' record.profile, record.recpriority, record.recorddups, 
record.maxnewest, record.maxepisodes, record.autoexpire,';
+							.' record.profile, record.recpriority, record.recorddups, 
record.maxnewest, record.maxepisodes, record.autoexpire, record.preroll, 
record.postroll,';
  		}
  		else {
  			$record_table  = '';
@@ -353,6 +353,8 @@
  			$this->maxnewest       = $program_data['maxnewest'];
  			$this->maxepisodes     = $program_data['maxepisodes'];
  			$this->autoexpire      = $program_data['autoexpire'];
+			$this->preroll         = $program_data['preroll'];
+			$this->postroll        = $program_data['postroll'];
  		// Check to see if there is any additional data from mythbackend 
about this program
  			global $Pending_Programs;
  			load_pending();
@@ -412,14 +414,16 @@
  	// Wipe out any pre-existing settings for this program
  		$this->record_never(false);
  	// Insert this recording choice into the database
-		$result = mysql_query('REPLACE INTO record (type ,title, 
profile,recpriority,recorddups,maxnewest,maxepisodes,autoexpire)
+		$result = mysql_query('REPLACE INTO record (type ,title, 
profile,recpriority,recorddups,maxnewest,maxepisodes,autoexpire,preroll,postroll)
  																			VALUES (4,'.escape($this->title).','
  																				.escape($this->profile).','
  																				.escape($this->recpriority).','
  																				.escape($this->recorddups).','
  																				.escape($this->maxnewest).','
  																				.escape($this->maxepisodes).','
-																				.escape($this->autoexpire).')')
+																				.escape($this->autoexpire).','
+																				.escape($this->preroll).','
+																				.escape($this->postroll).')')
  			or trigger_error('SQL Error: '.mysql_error(), FATAL);
  	// Clean up the program variable
  		$this->record_always = $this->will_record = true;
@@ -431,7 +435,7 @@
  	// Wipe out any pre-existing settings for this program
  		$this->record_never(false);
  	// Insert this recording choice into the database
-		$result = mysql_query('REPLACE INTO record 
(type,title,chanid,profile,recpriority,recorddups,maxnewest,maxepisodes,autoexpire)
+		$result = mysql_query('REPLACE INTO record 
(type,title,chanid,profile,recpriority,recorddups,maxnewest,maxepisodes,autoexpire,preroll,postroll)
  																		VALUES (3,'.escape($this->title).','
  																				.escape($this->chanid).','
  																				.escape($this->profile).','
@@ -439,7 +443,9 @@
  																				.escape($this->recorddups).','
  																				.escape($this->maxnewest).','
  																				.escape($this->maxepisodes).','
-																				.escape($this->autoexpire).')')
+																				.escape($this->autoexpire).','
+																				.escape($this->preroll).','
+																				.escape($this->postroll).')')
  			or trigger_error('SQL Error: '.mysql_error(), FATAL);
  	// Clean up the program variable
  		$this->record_channel = $this->will_record = true;
@@ -451,7 +457,7 @@
  	// Wipe out any pre-existing settings for this program
  		$this->record_never(false);
  	// Insert this recording choice into the database
-		$result = mysql_query('REPLACE INTO record 
(type,chanid,startdate,starttime,enddate,endtime,title,profile,recpriority,recorddups,maxnewest,maxepisodes,autoexpire)
+		$result = mysql_query('REPLACE INTO record 
(type,chanid,startdate,starttime,enddate,endtime,title,profile,recpriority,recorddups,maxnewest,maxepisodes,autoexpire,preroll,postroll)
  							VALUES (5,'	.escape($this->chanid) .','
  								.'FROM_UNIXTIME('.escape($this->starttime).'),'
  								.'FROM_UNIXTIME('.escape($this->starttime).'),'
@@ -463,7 +469,9 @@
  								.escape($this->recorddups).','
  								.escape($this->maxnewest).','
  								.escape($this->maxepisodes).','
-								.escape($this->autoexpire).')')
+								.escape($this->autoexpire).','
+								.escape($this->preroll).','
+								.escape($this->postroll).')')
  			or trigger_error('SQL Error: '.mysql_error(), FATAL);
  	// Clean up the program variable
  		$this->record_weekly = $this->will_record = true;
@@ -475,7 +483,7 @@
  	// Wipe out any pre-existing settings for this program
  		$this->record_never(false);
  	// Insert this recording choice into the database
-		$result = mysql_query('REPLACE INTO record 
(type,chanid,starttime,startdate,endtime,enddate,title,profile,recpriority,recorddups,maxnewest,maxepisodes,autoexpire) 
VALUES (2,'
+		$result = mysql_query('REPLACE INTO record 
(type,chanid,starttime,startdate,endtime,enddate,title,profile,recpriority,recorddups,maxnewest,maxepisodes,autoexpire,preroll,postroll) 
VALUES (2,'
  								.escape($this->chanid).','
  								.'FROM_UNIXTIME('.escape($this->starttime).'),'
  								.'FROM_UNIXTIME('.escape($this->starttime).'),'
@@ -487,7 +495,9 @@
  								.escape($this->recorddups).','
  								.escape($this->maxnewest).','
  								.escape($this->maxepisodes).','
-								.escape($this->autoexpire).')')
+								.escape($this->autoexpire).','
+								.escape($this->preroll).','
+								.escape($this->postroll).')')
  			or trigger_error('SQL Error: '.mysql_error(), FATAL);
  	// Clean up the program variable
  		$this->record_daily = $this->will_record = true;
@@ -499,7 +509,7 @@
  	// Wipe out any pre-existing settings for this program
  		$this->record_never(false);
  	// Insert this recording choice into the database
-		$result = mysql_query('REPLACE INTO record 
(type,chanid,starttime,startdate,endtime,enddate,title,subtitle,description,profile,recpriority,recorddups,maxnewest,maxepisodes,autoexpire) 
values (1,'
+		$result = mysql_query('REPLACE INTO record 
(type,chanid,starttime,startdate,endtime,enddate,title,subtitle,description,profile,recpriority,recorddups,maxnewest,maxepisodes,autoexpire,preroll,postroll) 
values (1,'
  								.escape($this->chanid).','
  								.'FROM_UNIXTIME('.escape($this->starttime).'),'
  								.'FROM_UNIXTIME('.escape($this->starttime).'),'
@@ -513,7 +523,9 @@
  								.escape($this->recorddups).','
  								.escape($this->maxnewest).','
  								.escape($this->maxepisodes).','
-								.escape($this->autoexpire).')')
+								.escape($this->autoexpire).','
+								.escape($this->preroll).','
+								.escape($this->postroll).')')
  			or trigger_error('SQL Error: '.mysql_error(), FATAL);
  	// Clean up the program variable
  		$this->record_once = $this->will_record = true;
diff -u -r mythweb/program_detail.php mythweb-new/program_detail.php
--- mythweb/program_detail.php	2004-02-04 15:54:05.000000000 -0600
+++ mythweb-new/program_detail.php	2004-02-04 15:56:15.000000000 -0600
@@ -31,6 +31,10 @@
  			$this_program->recpriority = $_GET['recpriority'];
  		if (isset($_GET['maxepisodes']))
  			$this_program->maxepisodes=$_GET['maxepisodes'];
+		if (isset($_GET['preroll']))
+			$this_program->preroll=$_GET['preroll'];
+		if (isset($_GET['postroll']))
+			$this_program->postroll=$_GET['postroll'];
  		$this_program->recorddups = (isset($_GET['recorddups']) && 
$_GET['recorddups'] == "on") ? 1 : 0;
  		$this_program->autoexpire = (isset($_GET['autoexpire']) && 
$_GET['autoexpire'] == "on") ? 1 : 0;
  		$this_program->maxnewest  = (isset($_GET['maxnewest']) && 
$_GET['maxnewest'] == "on")   ? 1 : 0;
diff -u -r mythweb/themes/Default/program_detail.php 
mythweb-new/themes/Default/program_detail.php
--- mythweb/themes/Default/program_detail.php	2004-02-04 
15:54:05.000000000 -0600
+++ mythweb-new/themes/Default/program_detail.php	2004-02-04 
15:59:55.000000000 -0600
@@ -154,6 +154,12 @@
  				</tr><tr>
  					<td nowrap align="right">Record new and expire old?&nbsp;</td>
  					<td><input type="checkbox" class="radio" name="maxnewest" <?php 
if ($this_program->maxnewest) echo "CHECKED" ?>></td>
+				</tr><tr>
+					<td nowrap align="right">Preroll (minutes):&nbsp;</td>
+					<td><input type="input" name="preroll" size="1" value="<?php echo 
htmlentities($this_program->preroll) ?>"></td>
+				</tr><tr>
+					<td nowrap align="right">Postroll (minutes):&nbsp;</td>
+					<td><input type="input" name="postroll" size="1" value="<?php echo 
htmlentities($this_program->postroll) ?>"></td>
  				</tr>
  				</table>
  				</p>
Only in mythweb-new/themes/Default: .program_detail.php.swp



More information about the mythtv-users mailing list