[mythtv] launching movies from mythweb - html question

Tim Harvey tharvey at alumni.calpoly.edu
Sun Oct 19 11:34:38 EDT 2003


Ok, I've attached a patch for mythweb as well as a registry file for
windows.   This is definitely not ready for CVS as I'm fairly disgusted
with the whole idea of hacking the registry and creating a protocol
handler... also I don't know how to make it work on non windows/ie
systems (mozilla instructions anyone?).

Instructions:

- Apply patch to mythweb:

   This alters the display of songs for mythMusic and the display of
movies for mythVideo, including links for them if properly configured.
If the settings are not defined based on the last step this won't hurt
anything, it simply won't provide the links.

- Edit/Apply registry patch for windows

   This defines the player app to launch for the 'myprog' protocol used
in the mythweb patch.  Be sure to modify this to point to the player of
your choice (notice that I use 'zoom player' not, windows mediaplayer
although that should work if defined properly).  This is what gets IE to
launch your music/movie in the app of your choice.

- Add vars to mythconverge 'settings' table declaring the local
mountpoint for your movies/music.

   While I use phpMyAdmin to make things easier, the following SQL
statements will do this for you:
    INSERT INTO `settings` ( `value` , `data` , `hostname` )
    VALUES (
    'MovieDir', '\\\\nas1\\\\Video\\\\Movies\\\\', NULL
    );
    INSERT INTO `settings` ( `value` , `data` , `hostname` )
    VALUES (
    'MusicDir', '\\\\nas1\\\\Audio\\\\Music\\\\', NULL
    );

   You are defining the path that your movie files will be visible in on
the system using mythweb.  Note that I'm not referencing these variables
per host IP, therefore this should be the same path on any/all systems
your using MythWeb from to launch your files.  In my example above I
have a NAS with the hostname of 'nas1' with an 'Audio' share and a
'Music' share.

Again, I think this is a pretty ugly solution as it requires a protocol
handler and so far only works for windows/ie.  I'm posting it in the
hopes that other people more knowledgeable than me can offer suggestions
to make it more usable.  However limited this is, it works really well
for windows and I now have a windows system capable of using mythweb and
all its metadata glory to launch movies/music.

Constructive comments are welcome

Thanks,

Tim

> -----Original Message-----
> From: mythtv-dev-bounces at mythtv.org
[mailto:mythtv-dev-bounces at mythtv.org]
> On Behalf Of Kent Williams
> Sent: Saturday, October 18, 2003 9:44 AM
> To: Development of mythtv
> Subject: RE: [mythtv] launching movies from mythweb - html question
> 
> I'm interested :)
> 
> > The alternative method I'm using with the registry keys to add a
> > protocol handler only seems to work for IE and not Mozilla.
> >
> > What I wanted was an easy way for my girlfriend to be able to launch
> > music and movies from mythweb on her windows box and that is working
> > well now.  I will post the patch and registry instructions if anyone
> is
> > interested.
> >
> > Tim
> 

-------------- next part --------------
Index: mythweb/mythmusic.php
===================================================================
RCS file: /var/lib/mythcvs/mythweb/mythmusic.php,v
retrieving revision 1.3
diff -u -r1.3 mythmusic.php
--- mythweb/mythmusic.php	7 Aug 2003 04:35:04 -0000	1.3
+++ mythweb/mythmusic.php	19 Oct 2003 17:13:36 -0000
@@ -97,6 +97,7 @@
                 $this->genre=$row[4];
                 $this->length=$row[5];
                 $this->rating=$row[6];
+                $this->filename=$row[7];
                 return(true);
             }
             return(false);
@@ -116,7 +117,7 @@
         {
             while($this->readRow())
             {
-                $music->printDetail($this->title,$this->length,$this->artist,$this->album,$this->genre);
+                $music->printDetail($this->filename,$this->title,$this->length,$this->artist,$this->album,$this->genre);
             }
         }
         else
@@ -248,12 +249,12 @@
 
             if($this->filter != "")
             {
-                $this->result=mysql_query("select intid,artist,album,title,genre,length,rating from musicmetadata where  $this->filter order by artist,album,tracknum $limitText");
+                $this->result=mysql_query("select intid,artist,album,title,genre,length,rating,filename from musicmetadata where  $this->filter order by artist,album,tracknum $limitText");
 
             }
             else
             {
-                $this->result=mysql_query("select intid,artist,album,title,genre,length,rating from musicmetadata order by artist,album,tracknum " . $limitText);
+                $this->result=mysql_query("select intid,artist,album,title,genre,length,rating,filename from musicmetadata order by artist,album,tracknum " . $limitText);
 
             }
         }
@@ -265,4 +266,4 @@
 $mythmusic->display();
 
 
-?>
\ No newline at end of file
+?>
Index: mythweb/themes/Default/mythmusic.php
===================================================================
RCS file: /var/lib/mythcvs/mythweb/themes/Default/mythmusic.php,v
retrieving revision 1.3
diff -u -r1.3 mythmusic.php
--- mythweb/themes/Default/mythmusic.php	7 Aug 2003 04:41:09 -0000	1.3
+++ mythweb/themes/Default/mythmusic.php	19 Oct 2003 17:13:36 -0000
@@ -16,6 +16,9 @@
     var $statusMessage;
     var $filterPlaylist;
 
+    var $musicdir;	// directory music mounted from clients perspective
+    var $musicloc;	// directory music mounted from backends perspective
+
     function getMaxPerPage()
     {
         return($this->maxPerPage);
@@ -74,7 +77,8 @@
 
     function printNavBar()
     {
-
+        $this->musicdir = get_backend_setting('MusicDir');
+        $this->musicloc = get_backend_setting('MusicLocation');
         $pageCount=($this->totalCount / $this->maxPerPage) +1;
         printf("<table class=\"musicTable\" width=\"100%%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n");
         printf("<tr class=\"menu\">\n");
@@ -126,14 +130,17 @@
         printf("</tr>\n");
         printf("</table>\n");
     }
-    function printDetail($trackName,$trackTime,$trackArtist,$trackAlbum,$trackGenre) {
+    function printDetail($fileName,$trackName,$trackTime,$trackArtist,$trackAlbum,$trackGenre) {
         printf("<tr class=\"musicRow\">\n");
-        printf("<td class=\"musicTrack\"> %s</td>\n",htmlspecialchars($trackName));
+        $file = substr($fileName, strlen($this->musicloc)); 
+	if ($this->musicdir != "")
+            printf("<td class=\"musicTrack\"><a href=\"myprog: %%22%s%s%%22\">%s</a></td>\n", $this->musicdir, str_replace("/", "\\\\", $file), htmlspecialchars($trackName));
+        else
+            printf("<td class=\"musicTrack\"> %s</td>\n",htmlspecialchars($trackName));
         $calcLength=$trackTime/1000;
         $calcMin=$calcLength/60;
         $calcSec=$calcLength%60;
Index: mythweb/themes/Default/video.php
===================================================================
RCS file: /var/lib/mythcvs/mythweb/themes/Default/video.php,v
retrieving revision 1.1
diff -u -r1.1 video.php
--- mythweb/themes/Default/video.php	20 Aug 2003 05:13:33 -0000	1.1
+++ mythweb/themes/Default/video.php	19 Oct 2003 17:13:36 -0000
@@ -7,6 +7,10 @@
 class Theme_video extends Theme {
 
 	function print_page() {
+		$moviedir = get_backend_setting('MovieDir');
+
 	// Print the main page header
 		parent::print_header("MythWeb - Videos");
 	// Print the page contents
@@ -38,7 +42,15 @@
 				echo '&nbsp;';
 		}
 	?></td>
-	<td><?php echo $show->title?></td>
+	<td><?php
+		if ($moviedir != "") 
+			// requires protocol handler for 'myprog'
+			// works for iexplorer, not mozilla?
+			printf("<a href=\"myprog: %%22%s%s%%22\">%s</a>", $moviedir, basename($show->filename), $show->title);
+		else 
+			echo $show->title;
+		
+	?></td> 
 	<td><?php echo $show->director?></td>
 	<td><?php echo $show->plot?></td>
 	<td><?php echo $show->rating?></td>
@@ -64,4 +76,4 @@
 	}
 }
 
-?>
\ No newline at end of file
+?>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: myprog protocol.reg
Type: application/octet-stream
Size: 536 bytes
Desc: not available
Url : http://mythtv.org/pipermail/mythtv-dev/attachments/20031019/c97373d6/myprogprotocol.obj


More information about the mythtv-dev mailing list