rpms/mythweb/devel mythweb-0.26-fixes.patch,NONE,1.1

Richard Shaw hobbes1069 at rpmfusion.org
Mon Dec 24 20:23:39 CET 2012


Author: hobbes1069

Update of /cvs/free/rpms/mythweb/devel
In directory old02.ovh.rpmfusion.lan:/tmp/cvs-serv9178

Added Files:
	mythweb-0.26-fixes.patch 
Log Message:
Add patch.

mythweb-0.26-fixes.patch:
 classes/Video.php                    |   14 ++++---
 modules/stream/stream_raw.pl         |    4 ++
 modules/video/handler.php            |   26 +++++++++----
 modules/video/stream.php             |   69 +++++++++++++++++++++++++++++++++++
 modules/video/tmpl/default/video.php |    2 -
 mythweb.php                          |    2 -
 6 files changed, 101 insertions(+), 16 deletions(-)

--- NEW FILE mythweb-0.26-fixes.patch ---
 classes/Video.php                    | 14 ++++----
 modules/stream/stream_raw.pl         |  4 +++
 modules/video/handler.php            | 26 +++++++++-----
 modules/video/stream.php             | 69 ++++++++++++++++++++++++++++++++++++
 modules/video/tmpl/default/video.php |  2 +-
 mythweb.php                          |  2 +-
 6 files changed, 101 insertions(+), 16 deletions(-)

diff --git a/classes/Video.php b/classes/Video.php
index 7995aa4..5c6f7e4 100644
--- a/classes/Video.php
+++ b/classes/Video.php
@@ -90,12 +90,14 @@ class Video {
         $this->childid = $video['childid'];
     // Figure out the URL
         $this->url = '#';
-        if (file_exists('data/video/'))
-            $this->url = implode('/', array_map('rawurlencode',
-                                             array_map('utf8tolocal',
-                                             explode('/',
-                                             'data/video/' . preg_replace('#^'.$mythvideo_dir.'/?#', '', $this->filename)
-                                       ))));
+    //// all junk, replacing
+//        if (file_exists('data/video/'))
+//            $this->url = implode('/', array_map('rawurlencode',
+//                                             array_map('utf8tolocal',
+//                                             explode('/',
+//                                             'data/video/' . preg_replace('#^'.$mythvideo_dir.'/?#', '', $this->filename)
+//                                       ))));
+        $this->url = 'video/stream?Id=' . $this->intid;
         $genre = $db->query('SELECT idgenre
                                FROM videometadatagenre
                               WHERE idvideo = ?',
diff --git a/modules/stream/stream_raw.pl b/modules/stream/stream_raw.pl
index 31f6854..6981bca 100755
--- a/modules/stream/stream_raw.pl
+++ b/modules/stream/stream_raw.pl
@@ -30,6 +30,10 @@
         $type   = 'video/nuppelvideo';
         $suffix = '.nuv';
     }
+    elsif ($basename =~ /\.mkv$/) {
+        $type   = 'video/x-matroska';
+        $suffix = '.mkv';
+    }
     else {
         print header(),
               "Unknown video type requested:  $basename\n";
diff --git a/modules/video/handler.php b/modules/video/handler.php
index fd769ce..721f186 100644
--- a/modules/video/handler.php
+++ b/modules/video/handler.php
@@ -15,8 +15,10 @@
  * @global  string   $GLOBALS['mythvideo_dir']
  * @name    $mythvideo_dir
 /**/
-    global $mythvideo_dir;
-    $mythvideo_dir = setting('VideoStartupDir', hostname);
+
+//// dont need this...
+//    global $mythvideo_dir;
+//    $mythvideo_dir = setting('VideoStartupDir', hostname);
 
 // Load the video storage directories
     $video_dirs = $db->query_list('
@@ -37,6 +39,7 @@
         }
     }
 
+/** nor any of this...
 // Make sure the video directory exists
     if (file_exists('data/video')) {
     // File is not a directory or a symlink
@@ -93,7 +96,7 @@
                         .' reload this page.');
         }
     // Create a symlink to the first artwork directory that we find.
-    /** @todo we should really support multiple directories, but it's too much effort to hack in at the moment. */
+    // @todo we should really support multiple directories, but it's too much effort to hack in at the moment.
         else {
             foreach ($artwork_dirs as $dir) {
                 if (is_dir($dir) || is_link($dir)) {
@@ -116,6 +119,7 @@
             }
         }
     }
+*/
 
     define('video_img_height',  _or(setting('web_video_thumbnail_height', hostname), 140));
     define('video_img_width',   _or(setting('web_video_thumbnail_width', hostname),   94));
@@ -125,11 +129,17 @@
         case 'edit':
             require_once 'modules/video/edit.php';
             exit;
-        case 'imdb':
-            require_once 'modules/video/imdb.php';
-            exit;
-        case 'scan':
-            require_once 'modules/video/scan.php';
+//// this is probably doing bad things
+//        case 'imdb':
+//            require_once 'modules/video/imdb.php';
+//            exit;
+//// this is broken, so disable it
+//        case 'scan':
+//            require_once 'modules/video/scan.php';
+//            exit;
+//// new stuff
+        case 'stream':
+            require_once 'modules/video/stream.php';
             exit;
     }
 
diff --git a/modules/video/stream.php b/modules/video/stream.php
new file mode 100644
index 0000000..49a7298
--- /dev/null
+++ b/modules/video/stream.php
@@ -0,0 +1,69 @@
+<?php
+/**
+ * Stream a music file
+ *
+ * @license     GPL
+ *
+ * @package     MythWeb
+ * @subpackage  Music
+/**/
+
+// Yes, a db connection
+    global $db;
+
+// Pull video ID
+    $vid_id = $_GET['Id'];
+
+// Get filename
+    list($fname) = $db->query_row('SELECT filename
+                                     FROM videometadata
+                                    WHERE intid = ?', $vid_id);
+
+// Mime type
+    switch (substr($fname, strrpos($fname, '.'))) {
+        case 'mpg':
+        case 'mpeg':
+            $mime = 'video/mpeg';
+            break;
+        case 'mp4':
+            $mime = 'video/mp4';
+            break;
+        case 'ogg':
+        case 'ogm':
+        case 'ogv':
+            $mime = 'video/ogg';
+            break;
+        case 'qt':
+            $mime = 'video/quicktime';
+            break;
+        case 'webm':
+            $mime = 'video/webm';
+            break;
+        case 'mkv':
+            $mime = 'video/x-matroska';
+            break;
+        case 'wmv':
+            $mime = 'video/x-ms-wmv';
+            break;
+        case 'flv':
+            $mime = 'video/x-flv';
+            break;
+        default:
+            $mime = 'applicatoin/octet-stream';
+    }
+    header('Content-Type: '.$mime);
+
+// Send the filename
+    header('Content-Disposition: filename="'.$fname.'"');
+
+// Send data via the backend
+    $Master_Host = setting('MasterServerIP');
+    $port = _or(get_backend_setting('BackendStatusPort', $Master_Host),
+                get_backend_setting('BackendStatusPort'));
+    if (stripos($Master_Host,':') !== false) {
+        $Master_Host = '['.$Master_Host.']';
+    }
+    readfile("http://$Master_Host:$port/Content/GetVideo?Id=".$vid_id);
+
+// Nothing else to do
+    exit;
diff --git a/modules/video/tmpl/default/video.php b/modules/video/tmpl/default/video.php
index e80176e..ad7e9a9 100644
--- a/modules/video/tmpl/default/video.php
+++ b/modules/video/tmpl/default/video.php
@@ -252,7 +252,7 @@
 <table width="100%" border="0" cellpadding="4" cellspacing="2" class="list small">
 <tr class="menu">
 <td>
- <span style="float: right"><input type="button" value="<?php echo t('Scan Collection'); ?>" class="submit" onclick="scan()"></span>
+<!-- Bad! Don't do this! <span style="float: right"><input type="button" value="<?php echo t('Scan Collection'); ?>" class="submit" onclick="scan()"></span> -->
  <form action="<?php echo root_url; ?>video" method="GET">
   <?php echo t('Display'); ?>:
   <select name="category" id="category" onchange="filter();">
diff --git a/mythweb.php b/mythweb.php
index bba2aa8..79ff196 100644
--- a/mythweb.php
+++ b/mythweb.php
@@ -30,7 +30,7 @@
     if (Modules::getModule($Path[0])) {
     // Add the current module directory to our search path, so modules can
     // define includes, etc.
-        ini_set('include_path', ini_get('include_path').':'.modules_path.'/'.$Path[0]);
+        ini_set('include_path', ini_get('include_path').PATH_SEPARATOR.modules_path.'/'.$Path[0]);
     // Load the module handler
         require_once 'handler.php';
     }


More information about the rpmfusion-commits mailing list