[mythtv] [patch] new "All Recordings" page for mythweb

Dave Alden alden at math.ohio-state.edu
Sat Feb 7 19:39:30 EST 2004


Hi,

On Thu, Feb 05, 2004 at 11:42:35PM -0800, Chris Petersen wrote:
> I think the issue is that this page needs some explanation.  It's
> recording schedules, not scheduled recordings.  Which means that button
> should really read "cancel this schedule".
> 
> Apparently still needs a lot of work.  I'm open to patches (esp. ones
> that would display more info about the schedules), or will hopefully get
> around to it myself before .15 (unfortunately, I'm working on 2 for-pay
> projects on top of my full-time job, so I get kind of swamped).

Ok, here are some more patches.  :-)  Note that this currently only works
with the Default theme -- if I get more time I'll try to send a patch for
the "compact" or "wap" themes.  Here's a summary of the changes

  o  Removed (hopefully) unused code in recording_schedules.php.

  o  recording_schedules.php changes:

     1)  Removed Airtime, Episode, Description and Rating from the mouseover
         unless the recording type is "Once".

     2)  Added "Dup Method" to mouseover.

  o  program_detail.php changes (if you're looking at a "Recording Schedule"):

     1)  Removed an extraneous quote (it used to display an extra quote before
         the start time).

     2)  Only display "Record only this showing" if that is the recording type
         or if the starttime is greater than the current time.

     3)  Removed the duration since it's always 0.  :-)

     4)  Change "Don't record this program." to "Cancel this schedule."

     5)  "emphasized" (<em></em>) the time, episode and description to
         mark them as possibly not used.  I debated removing them completely,
         but the "Recording Options:" window didn't make as much sense if
         they weren't there.  For example, "Record this program in this
         timeslot every day" doesn't make sense if the start time isn't shown.

...dave
-------------- next part --------------
Index: recording_schedules.php
===================================================================
RCS file: /var/lib/mythcvs/mythweb/recording_schedules.php,v
retrieving revision 1.1
diff -u -r1.1 recording_schedules.php
--- recording_schedules.php	5 Feb 2004 06:56:11 -0000	1.1
+++ recording_schedules.php	8 Feb 2004 00:37:04 -0000
@@ -1,6 +1,6 @@
 <?
 /***                                                                        ***\
-	recording_schedules.php                      Last Updated: 2004.01.29 (alden)
+	recording_schedules.php                 Last Updated: 2004.02.07 (alden)
 
 	view and fix scheduling conflicts.
 \***                                                                        ***/
@@ -10,62 +10,17 @@
 	require_once "includes/init.php";
 	require_once "includes/sorting.php";
 
-// Make sure we get the form data
-	isset($_GET['chanid'])    or $_GET['chanid']    = $_POST['chanid'];
-	isset($_GET['starttime']) or $_GET['starttime'] = $_POST['starttime'];
-
-// Doing something to a recording?  Load its detailed info
-	if ($_GET['chanid'] && $_GET['starttime']) {
-		$recording = load_one_recording($_GET['starttime'], $_GET['chanid']);
-
-	// Fake an old recording so that this show won't record again
-		if ($_GET['never_record'] || $_POST['never_record']) {
-			$result = mysql_query('REPLACE INTO oldrecorded (chanid, starttime, endtime, title, subtitle, description, category) VALUES ('
-									.escape($recording->chanid)                    .','
-									.escape($recording->starttime)                 .'),'
-									.escape($recording->endtime)                   .'),'
-									.escape($recording->title)                     .','
-									.escape($recording->subtitle)                  .','
-									.escape($recording->description)               .','
-									.escape($recording->category)                  .')')
-				or trigger_error('SQL Error: '.mysql_error(), FATAL);
-		// Make sure the aren't any manual overrides set for this show, either
-			$result = mysql_query('DELETE FROM recordoverride WHERE chanid='.escape($_GET['chanid']).' AND title='.escape($recording->title).' AND subtitle='.escape($recording->subtitle).' AND description='.escape($recording->desription))
-				or trigger_error('SQL Error: '.mysql_error().' [#'.mysql_errno().']', FATAL);
-		}
-	// Suppress something that shouldn't be recorded
-		elseif ($_GET['suppress'] || $_POST['suppress']) {
-			$result = mysql_query('DELETE FROM recordoverride WHERE chanid='.escape($recording->chanid).' AND starttime=FROM_UNIXTIME('.escape($recording->starttime).') AND endtime=FROM_UNIXTIME('.escape($recording->endtime).')')
-				or trigger_error('SQL Error: '.mysql_error().' [#'.mysql_errno().']', FATAL);
-			$result = mysql_query('REPLACE INTO recordoverride (recordid,type,chanid,starttime,endtime,title,subtitle,description) VALUES ('
-									.escape($recording->recordid).','
-									.'2,'	// record override type:   1 == record, 2 == don't record
-									.escape($recording->chanid)                    .','
-									.'FROM_UNIXTIME('.escape($recording->starttime).'),'
-									.'FROM_UNIXTIME('.escape($recording->endtime)  .'),'
-									.escape($recording->title)                     .','
-									.escape($recording->subtitle)                  .','
-									.escape($recording->description)               .')')
-				or trigger_error('SQL Error: '.mysql_error().' [#'.mysql_errno().']', FATAL);
-		}
-
-	// Notify the backend of the changes
-		backend_notify_changes();
-	}
-
 // Load the recordings
 	$records = load_all_recordings();
 
 // Parse the recording list
 	$All_Shows = array();
-	$Recordings  = array();
 	$Channels  = array();
 
 	foreach ($records as $record) {
 		$show = new Recording($record);
 	// Assign a reference to this show to the various arrays
 		$All_Shows[]                 = &$show;
-		$Recordings[$show['title']][]  = &$show;
 		$Channels[$show['chanid']][] = &$show;
 		unset($show);
 	}
Index: includes/recordings.php
===================================================================
RCS file: /var/lib/mythcvs/mythweb/includes/recordings.php,v
retrieving revision 1.6
diff -u -r1.6 recordings.php
--- includes/recordings.php	7 Feb 2004 01:47:44 -0000	1.6
+++ includes/recordings.php	8 Feb 2004 00:37:04 -0000
@@ -15,7 +15,7 @@
 						3 => 'Channel',
 						4 => 'Always',
 						5 => 'Weekly',
-                        6 => 'FindOne'
+						6 => 'FindOne'
 					 );
 
 /*
Index: themes/Default/program_detail.php
===================================================================
RCS file: /var/lib/mythcvs/mythweb/themes/Default/program_detail.php,v
retrieving revision 1.22
diff -u -r1.22 program_detail.php
--- themes/Default/program_detail.php	7 Feb 2004 14:58:26 -0000	1.22
+++ themes/Default/program_detail.php	8 Feb 2004 00:37:04 -0000
@@ -51,24 +51,34 @@
 			<td width="24px">&nbsp;</td>
 			<td><span class="huge"><a href="search.php?searchstr=<?php echo urlencode($this_program->title)?>&search_title=yes">"<?php echo $this_program->title?>"</a>
 			<?php if (strlen($this_program->starstring) > 0) echo ", $this_program->starstring";?>
-			</span><BR>"
+			</span><BR>
 				<span class="small">
-				<?php echo date('g:i A', $this_program->starttime)?> to <?php echo date('g:i A', $this_program->endtime)?> (<?php echo (int)($this_program->length/60)?> minutes)<BR>
+				<?php
+				if (isset($_GET[recordid])) echo "<em>";
+				echo date('g:i A', $this_program->starttime) ." to " . date('g:i A', $this_program->endtime);
+				if (!isset($_GET[recordid])) echo "(" . (int)($this_program->length/60) . " minutes)";?><BR>
 				<?php
 				if ($this_program->previouslyshown)
 					echo '(Rerun) ';
+				if (isset($_GET[recordid])) echo "</em>";
 				echo " (<a href=\"http://www.imdb.com/Find?select=Titles&for=" . urlencode($this_program->title) . "\">Search IMDB</a>)";
 				echo " (<a href=\"http://www.google.com/search?q=" . urlencode($this_program->title) . "\">Search Google</a>)";
 				?></span></td>
 		</tr><tr>
 			<td colspan="3">&nbsp;</td>
-		</tr><?php if (!isset($_GET[recordid]) && strlen($this_program->subtitle)) { ?><tr>
-			<td colspan="2" align="right">Episode:&nbsp;</td>
-			<td><?php echo $this_program->subtitle?></td>
+		</tr><?php if (strlen($this_program->subtitle)) { ?><tr>
+			<td colspan="2" align="right"> <?php if (isset($_GET[recordid])) echo "<em>"; ?>Episode:&nbsp;
+							<?php if (isset($_GET[recordid])) echo "</em>"; ?></td>
+			<td><?php if (isset($_GET[recordid])) echo "<em>";
+				  echo $this_program->subtitle;
+				  if (isset($_GET[recordid])) echo "</em>"; ?></td>
 		</tr><?php }
-				if (!isset($_GET[recordid]) && strlen($this_program->description)) {?><tr>
-			<td colspan="2" align="right" valign="top">Description:&nbsp;</td>
-			<td><?php echo wordwrap($this_program->description, 45, "<BR>\n")?></td>
+				if (strlen($this_program->description)) { ?><tr>
+			<td colspan="2" align="right" valign="top"> <?php if (isset($_GET[recordid])) echo "<em>";?>
+				Description:&nbsp;<?php if (isset($_GET[recordid])) echo "</em>"; ?></td>
+			<td><?php if (isset($_GET[recordid])) echo "<em>";
+				  echo wordwrap($this_program->description, 45, "<BR>\n");
+				  if (isset($_GET[recordid])) echo "</em>"; ?></td>
 		</tr><?php } ?><tr>
 			<td colspan="3">&nbsp;</td>
 		</tr><?php if (strlen($this_program->category)) {?><tr>
@@ -101,12 +111,17 @@
 		<tr><td>
 				<input type="radio" class="radio" name="record" value="never" id="record_never"<?php echo
 				$this_program->will_record ? '' : ' CHECKED'?>></input>
-				<a onclick="get_element('record_never').checked=true;">Don't record this program.</a>
+				<a onclick="get_element('record_never').checked=true;"><?php if (isset($_GET[recordid])) { ?>
+					Cancel this schedule.
+				<?php } else { ?>
+					Don't record this program. <?php } ?></a>
 				<br/>
+				<?php if (($this_program->type == 1) || ($this_program->starttime > time())) { ?>
 				<input type="radio" class="radio" name="record" value="once" id="record_once"<?php echo
 				$this_program->record_once ? ' CHECKED' : ''?>></input>
 				<a onclick="get_element('record_once').checked=true;">Record only this showing.</a>
 				<br/>
+				<?php } ?>
 				<input type="radio" class="radio" name="record" value="daily" id="record_daily"<?php echo
 				$this_program->record_daily ? ' CHECKED' : ''?>></input>
 				<a onclick="get_element('record_daily').checked=true;">Record this program in this timeslot every day.</a>
Index: themes/Default/recording_schedules.php
===================================================================
RCS file: /var/lib/mythcvs/mythweb/themes/Default/recording_schedules.php,v
retrieving revision 1.4
diff -u -r1.4 recording_schedules.php
--- themes/Default/recording_schedules.php	7 Feb 2004 14:58:26 -0000	1.4
+++ themes/Default/recording_schedules.php	8 Feb 2004 00:37:05 -0000
@@ -1,6 +1,6 @@
 <?php
 /***                                                                        ***\
-	recording_schedules.php                  Last Updated: 2004.02.04 (xris)
+	recording_schedules.php                 Last Updated: 2004.02.07 (alden)
 
 	This file defines a theme class for the all recordings section.
 	It must define one method.   documentation will be added someday.
@@ -83,24 +83,30 @@
 <tr>
 	<td><table class=\"menu small\" cellpadding=\"2\" cellspacing=\"0\">
 		<tr>
-			<td align=\"right\">Airtime:</td>
-			<td>".date($_SESSION['date_scheduled_popup'].', '.$_SESSION['time_format'], $show->starttime).' to '.date($_SESSION['time_format'], $show->endtime)."</td>
-		</tr><tr>
 			<td align=\"right\">Program:</td>
 			<td>$show->title</td>
+		</tr>";
+			if ($show->type == 1) {
+				$Footnotes[] .= "
+		<tr>
+			<td align=\"right\">Airtime:</td>
+			<td>".date($_SESSION['date_scheduled_popup'].', '.$_SESSION['time_format'], $show->starttime).' to '.date($_SESSION['time_format'], $show->endtime)."</td>
 		</tr>"
-		.(preg_match('/\\S/', $show->subtitle) ? "<tr>
+			.(preg_match('/\\S/', $show->subtitle) ? "<tr>
 			<td align=\"right\">Episode:</td>
 			<td>$show->subtitle</td>
 		</tr>" : '')
-		.(preg_match('/\\S/', $show->description) ? "<tr>
+			.(preg_match('/\\S/', $show->description) ? "<tr>
 			<td align=\"right\" valign=\"top\">Description:</td>
 			<td>".nl2br(wordwrap($show->description, 70))."</td>
 		</tr>" : '')
-		.(preg_match('/\\S/', $show->rating) ? "<tr>
+			.(preg_match('/\\S/', $show->rating) ? "<tr>
 			<td align=\"right\" valign=\"top\">Rating:</td>
 			<td>$show->rating</td>
-		</tr>" : '') . "<tr>
+		</tr>" : '');
+			}
+
+			$Footnotes[] .= "<tr>
 			<td align=\"right\">Type:</td>
 			<td>$show->texttype</td>
 		</tr>"
@@ -125,6 +131,15 @@
 					: ($show->record_findone ? "Record one showing of this program at any time"
 					: "Always record")))))."</td>
 		</tr>" : '')
+		.($show->dupmethod > 0 ? "<tr>
+			<td align=\"right\">Dup Method:</td>
+			<td>".($show->dupmethod == 1	? "None"
+					: ($show->dupmethod == 2	? "Subtitle"
+					: ($show->dupmethod == 4	? "Description"
+					: ($show->dupmethod == 6	? "Subtitle & Description"
+					: ($show->dupmethod == 22	? "Sub & Desc (Empty matches)"
+					: "")))))."</td>
+		</tr>" : '')
 		.(preg_match('/\\S/', $show->profile) ? "<tr>
 			<td align=\"right\">Profile:</td>
 			<td>$show->profile</td>
@@ -163,7 +178,7 @@
 			 					.' onmouseout="window.status=\'\';hide();return true"'
 							   : '')
 			 .'>'.$show->title
-			 .(preg_match('/\\w/', $show->subtitle) ? ":  $show->subtitle" : '')
+			 .($show->type == 1 && preg_match('/\\w/', $show->subtitle) ? ":  $show->subtitle" : '')
 			 .'</a>';
 		?></td>
 	<td><?php echo $show->channel->name?></td>


More information about the mythtv-dev mailing list