[mythtv] [PATCH] Mythweb mythvideo links to videos in subdirectories

bobnvic at everestkc.net bobnvic at everestkc.net
Mon May 24 15:04:54 EDT 2004


This patch enhances the new links to videos in the 
mythweb mythvideo page to properly link to videos
that are in subdirectories of the main video store.
Previous code assumed all videos were in the same
base directory.

This patch modifies the following files:

mythweb/video.php
mythweb/themes/Default/video.php

Please let me know if there are any problems.

Bob Cottingham
-------------- next part --------------
? mythweb.diff
Index: video.php
===================================================================
RCS file: /var/lib/mythcvs/mythweb/video.php,v
retrieving revision 1.3
diff -u -d -r1.3 video.php
--- video.php	22 May 2004 18:58:38 -0000	1.3
+++ video.php	24 May 2004 18:45:39 -0000
@@ -1,6 +1,6 @@
 <?php
 /***                                                                        ***\
-    video.php                               Last Updated: 2003.08.20 (irish)
+    video.php                               Last Updated: 2004.05.24 (bobc)
 
     view video files.
 \***                                                                        ***/
@@ -40,6 +40,12 @@
     if (count($All_Shows))
         sort_programs($All_Shows, 'video_sortby');
 
+// Get the video store directory
+   $result = mysql_query('SELECT data from settings where value="VideoStartupDir"')
+            or trigger_error('SQL Error: '.mysql_error(), FATAL);
+   $videostore=mysql_fetch_assoc($result);
+   $videodir=$videostore['data'];
+
 
 // Load the class for this page
     require_once theme_dir.'video.php';
Index: themes/Default/video.php
===================================================================
RCS file: /var/lib/mythcvs/mythweb/themes/Default/video.php,v
retrieving revision 1.3
diff -u -d -r1.3 video.php
--- themes/Default/video.php	22 May 2004 07:09:23 -0000	1.3
+++ themes/Default/video.php	24 May 2004 18:45:39 -0000
@@ -1,6 +1,6 @@
 <?php
 /***                                                                        ***\
-    video.php                               Last Updated: 2003.08.19 (xris)
+    video.php                               Last Updated: 2004.05.24 (bobc)
 
 \***                                                                        ***/
 
@@ -11,6 +11,7 @@
         parent::print_header("MythWeb - Videos");
     // Print the page contents
         global $All_Shows;
+        global $videodir;
 ?>
 
 <SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
@@ -45,13 +46,13 @@
     <td><?php
         if (show_recorded_pixmaps) {
             if (file_exists(video_img_path.'/'.basename($show->coverfile)))
-                echo '<a href="'.videos_url.'/'.rawurlencode(basename($show->filename)).'">.<img id="'.$show->filename."\" src=\"".video_img_path.'/'.basename($show->coverfile).'" width="'.video_img_width.'" height="'.video_img_height.'">';
+                echo '<a href="'.videos_url.'/'.rawurlencode(substr($show->filename,strlen($videodir)+1)).'">.<img id="'.$show->filename."\" src=\"".video_img_path.'/'.basename($show->coverfile).'" width="'.video_img_width.'" height="'.video_img_height.'">';
             else
                 echo '&nbsp;';
         }
     ?></td>
     <td><?php echo '<a 
-href="'.videos_url.'/'.rawurlencode(basename($show->filename)).'">'."$show->title".'</a>'?></td>
+href="'.videos_url.'/'.rawurlencode(substr($show->filename,strlen($videodir)+1)).'">'."$show->title".'</a>'?></td>
     <td><?php echo $show->director?></td>
     <td><?php echo $show->plot?></td>
     <td><?php echo $show->rating?></td>


More information about the mythtv-dev mailing list