[mythtv] Brackets in filenames in Mythweb Videos

Joe Ripley vitaminjoe at gmail.com
Tue Jul 31 18:24:41 UTC 2007


On 7/31/07, Joe Ripley <vitaminjoe at gmail.com> wrote:
> The correct query would be:
>
> SELECT videometadata.intid FROM videometadata LEFT JOIN
> videometadatagenre ON videometadata.intid = videometadatagenre.idvideo
> WHERE videometadata.filename RLIKE '/myth/video/The Office
> \\(US\\)/Season 1/[/]*[^/]*$' GROUP BY intid ORDER BY title;
>
> I'm not sure where the best place to escape these characters would be.

My quick hack to fix this is below:

--- /usr/src/myth/mythplugins/mythweb/modules/video/handler.php
2007-07-30 16:26:52.000000000 -0600
+++ handler.php 2007-07-31 12:20:42.000000000 -0600
@@ -220,8 +220,11 @@
     if (isset($_REQUEST['path']))
         $_SESSION['video']['path'] = $_REQUEST['path'];

-    if (isset($_SESSION['video']['path']))
-        $where .= ' AND videometadata.filename RLIKE
'.$db->escape($_SESSION['video']['path'].'[/]*[^/]*$');
+    if (isset($_SESSION['video']['path'])) {
+               $escaped_path = str_replace('(', '\\(',
$_SESSION['video']['path']);
+               $escaped_path = str_replace(')', '\\)', $escaped_path);
+        $where .= ' AND videometadata.filename RLIKE
'.$db->escape($escaped_path.'[/]*[^/]*$');
+       }
 // Deal with the parental locks
     if (isset($_REQUEST['VideoAdminPassword']))
         $_SESSION['video']['VideoAdminPassword'] =
$_REQUEST['VideoAdminPassword'];


-- 
Joe Ripley
vitaminjoe at gmail.com


More information about the mythtv-dev mailing list