Difference between revisions of "Play Recordings On Windows From MythWeb"

From MythTV Official Wiki
Jump to: navigation, search
m (Modifying Mythweb to View Recordings)
m (Modifying Mythweb to View Recordings)
Line 84: Line 84:
 
  mysql> UPDATE `settings` SET `data` = 'myth:\\\\MyMythBackend/recordings/',
 
  mysql> UPDATE `settings` SET `data` = 'myth:\\\\MyMythBackend/recordings/',
 
  `hostname` = NULL WHERE `value` = 'WebVideo_URL' AND `hostname` IS NULL LIMIT 1 ;
 
  `hostname` = NULL WHERE `value` = 'WebVideo_URL' AND `hostname` IS NULL LIMIT 1 ;
* Note the multiple backslashes are required, and yes there are forward and back slashes in there but VLC figures it out.
+
* '''Note''' The multiple backslashes are required, and yes there are forward and back slashes in there but VLC figures it out.
* Note since this database setting does not exist by default you need to either save something in "MythTV global defaults" -> "Video URL" through MythWeb prior to executing the UPDATE, or change the mysql command to INSERT the setting.
+
* '''Note''' Since this database setting does not exist by default you need to either save something in "MythTV global defaults" -> "Video URL" through MythWeb prior to executing the UPDATE, or change the mysql command to INSERT the setting.
  
 
Now if you go back into MythWeb settings page -> MythTV global defaults, you should see the value you modified directly.  If you hit the recordings page and hold you mouse over a thumbnail, you should see in the status bar a link like:
 
Now if you go back into MythWeb settings page -> MythTV global defaults, you should see the value you modified directly.  If you hit the recordings page and hold you mouse over a thumbnail, you should see in the status bar a link like:

Revision as of 15:41, 10 January 2007


Introduction

Below are instructions on how users can browse the recordings via Mythweb on a Windows machine and with one click, have it play in VideoLan (VLC). Videos can also be played with one click from the MythWeb video listing, but it is necessary to modify code.

Notes

  • These instructions will not work through a firewall or over a slow < 5Mbps connection and assumes the computers are on the same LAN.
  • It just uses VLC to play the files, not the VLC server to stream the recordings.
  • These instructions only work on MythTV 0.20 (or greater)
  • These instructions won't work for slave backends (because of limitations with MythWeb) but the recordings can be shared.
  • Assumes Fedora Core

The instructions consist of three parts, first install and configure the necessary Windows applications, share the recordings directory via Samba, then modify Mythweb.

Other alternatives

MythTv Player - MythTv Player is a free and simple Myth client and player for Windows.

Tapeworm - TapeWorm is a "parasitic" Windows front end for MythTV

Time to implement

  • 1/2 hour for recordings and assumes access to MYSQL and setting up Samba via command line
  • or an hour for both recordings and videos and familiarity with symbolic links, editing php files

Installing Required Window Applications

First get and install these two applications on your Windows machine:

Now, with DSMyth, under the Start Menu -> MythTV Filters, run the "Configuration" program. It will bring up a screen called "MythTV DirectShow filter settings" which has a sidebar that has three tabs "MySQL database", "File associations" and "Network".

  • Note: The settings under "MySQL database" are not necessary for viewing recordings in Windows.
Under the "File Associations" tab (as shown right), change the bottom "MythTV Urls:" to VLC by hitting "browse" finding the VLC executable or, if you installed it in the default directory, just paste in everything below:
"C:\Program Files\VideoLAN\VLC\vlc.exe" "%1"

You can also place the same link in the two slots above, but it is not necessary. Then hit OK.

  • Note: You can use the pre-defined mplayer2.exe, but it really sucks because it can't seek with out crashing, takes a long time to come-up and VLC has much better seek hotkeys (try CTRL-right arrow or ALT-right arrow or the forward/backward buttons on your mouse!)

DSMyth is used as a bridge application, when "myth:\\" links are clicked in a browser, DSmyth takes it and passes it along to VLC.

Configuring Linux Samba Shares

On your MythTV backend we are going to add a Samba share which will allow any Windows machine on the network to see all the recordings in the recordings directory on a read-only basis. First make sure the Samba and Lisa daemons are running and will start automatically on bootup:

# /sbin/chkconfig lisa on
# /sbin/service lisa start
# /sbin/chkconfig smb on
# /sbin/service smb start

Now, you could edit "/etc/exports" file and add a line to it like "/video/recordings/ *(r,async,all_squash)" (and restart samba) but it is easier to use the graphical interface of KDE. From the start menu, go to Control Panel -> Internet & Network -> Samba Configuration. You can then click the "Administrator Mode", enter the Root password, and setup the "Base Settings", i.e. Workgroup, Netbios name (leave as default) and the description. Then click on "File Sharing" above in the sidebar and go into "Administrator Mode" again, and "Add" the directory that contains all the MythTV recordings, for example "/video/recordings". Set the share to "visible" but not "writable" to avoid having recordings deleted. The name of the share is used by windows, you could call it "recodings".

  • Note: If you can't see anything under the "Samba Configuration" or "File Sharing", check if the processes are running:
# ps -A | grep lisa
# ps -A | grep smb

You should also have set the hostname for the machine at this point by

# hostname MyMythBackend

and replace "MyMythBackend" with whatever you want.

  • Note: One of the benefits of having Samba running is that you can now access MythWeb with the hostname, for example http://MyMythBackend/mythweb

Now check if your Windows machine can see the recordings directory because there is little point in continuing if it can't. (Give it a few minutes, finding new shares can be slow as it discovers clients, figures out who is the master, etc.) One way to see the share is to enter the following in the Windows Explorer address bar:

\\MyMythBackend\recordings\

replacing the host and share name with yours. Another way is to click on the Start Menu, click Run, and type that into the run command. ie \\192.168.1.123\\recordings\

Modifying Mythweb to View Recordings

The next step is to pass to VLC a URL from Mythweb that it can then use to play the recording off the samba share.

This would have been dead easy through the MythWeb interface because you can modify the value needed under the MythWeb settings page (Click the icon next to the weather icon) -> "MythTV global defaults" -> "Video URL", but it doesn't work (as of v0.20). Once you hit "Save" any required backward slashes "\" are replaced with "/" forward slashes which windows and VLC won't recognize. In other words, what you need is something like:

myth:\\MyMythBackend\recordings

but hitting save changes it to

myth://MyMythBackend/recordings

The only way is to modify the field directly in the database from a terminal window:

# mysql -u root mythconverg
(enter the password)
mysql> UPDATE `settings` SET `data` = 'myth:\\\\MyMythBackend/recordings/',
`hostname` = NULL WHERE `value` = 'WebVideo_URL' AND `hostname` IS NULL LIMIT 1 ;
  • Note The multiple backslashes are required, and yes there are forward and back slashes in there but VLC figures it out.
  • Note Since this database setting does not exist by default you need to either save something in "MythTV global defaults" -> "Video URL" through MythWeb prior to executing the UPDATE, or change the mysql command to INSERT the setting.

Now if you go back into MythWeb settings page -> MythTV global defaults, you should see the value you modified directly. If you hit the recordings page and hold you mouse over a thumbnail, you should see in the status bar a link like:

myth:\\MyMythbackend/recordings/1043_20060919140000.mpg

and if you click on it, it should bring up VLC and start playing the recording.

Troubleshooting

There are lots of things that can go wrong and the best way to fix it is to track backwards.

  • Can you see the samba share on your windows machine?
  • Is the directory and file in the place you expect, i.e. \\MyMythbackend\recordings\<etc>
  • Can you open that file over the share manually with VLC?
  • Is the path being generated by MythWeb correct?

Modifying MythWeb to View Videos

If you have videos you want to view directly through MythWeb, you can also share it via samba and modify MythWeb to create the correct links, but it requires modifying one file (assuming you use the default skin): Modify

  • /mythweb/modules/video/handler.php

Change the line at the very bottom which starts with:

$this-url = root . implode (...)

with

$this->url = root . preg_replace('#^'.$mythvideo_dir.'/?#', 'myth:\\\\\\\\\\MyMythBackend\\videos\\', $this->filename);

Note:

  • That's eight backslashes
  • and the URL should point to your videos directory over the samba share.

Now when you visit the video section of MythWeb, the link should be correct and bring up the movie in VLC when clicked on. The link should look something like this:

myth:\\MyMythBackend\videos\myfavoritemovie.avi

Troubleshooting

  • Again, make sure you can get to the video share directly first.
  • It should also handle sub directories.

Modifying MythWEB to point at mapped drives

If you would like MythWEB to send a URL of a locally mapped drive to VLC, simply modify /mythweb/modules/tv/tmpl/default/recorded.php

Case:

  • Remote recordings directory is mapped to a local drive letter, ie:(/mnt/share == Z:)
  • VLC and video player is working correcly.
  • You want to click on the shows thumbnail to play.

--- Fix:

Modify line 274 in /mythweb/modules/tv/tmpl/default/recorded.php from:

echo "<a href=\"$show->url\" name=\"$row\">"

To:

(replace '///Z:/' with the drive and path of choice)

echo "<a href=\"myth:///Z:/".basename($show->filename)."\" name=\"$row\">"

Troubleshooting

  • Depending on your video player, it might not accept '/' in the URL. Change to accepted path format of video player.

--Derenma 02:56, 25 September 2006 (UTC)