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. This no longer works with MythTV v0.20+

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.

Time to implement

1/2 hour for recordings and assumes access to MYSQL and setting up Samba via command line

1 hour for recordings from both master and slave back ends.

Installing Required Window Applications

First get and install VideoLan on your Windows machine. Then place the following code (with notepad) into a file called "myth_shellx_vlc_handler.reg" (filename is arbitrary but has to end in .reg). Save the file and run it - "Yes" you want to modify the registry.

Note: You can use other media players but VLC has much better seek hotkeys, i.e. try the forward/backward buttons on your mouse, CTRL-right arrow or ALT-right arrow!

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:

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:

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: You should only have to do this once and no modifications are necessary for future upgrades (Yah!!)

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.

Slave Back End

The problem with the above code is that some of the recordings could be on a slave backend which means the path to the samba share will not work. The code below will modify the path based on which backend the file resides on.
Note:

It only works for one slave back end

It uses the difference in the .filename attribute, which for slave backends in my case starts with "mythtv" and for files on my master backend start with "/MythTV". It maybe different on your system - check the HTML source of the recordings page to know for sure.

The first line tests where in the recording's filename the word mythtv is. It then gets the path to the slave's samba share from the database (WebVideo_URL_slave). The IF statement then tests the position of "mythtv" is at the start of the filename, i.e. if the filename starts with "mythtv%2F//192.168.xxx.xxx...", then it is a slave recording. Otherwise if the position of "mythtv" is 1 or greater, i.e. "mythtv" is here "/MythTV/...." then it uses the normal URL. It isn't elegant but it works.

The last change to code is in three places, directly below the IF statement, where it creates the links for the thumbnail, the title and the subtitle, change

"$show->url" to "$modified_url".

Reload the recordings page and if it works, then backup your file

#cp recorded.php recorded.php_modified

When the next update overwrites your modified file, copy your custom file back over the new file.

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?

After working through the section above for Playing Recordings On Windows From MythWeb, when I went to the recordings page and held my mouse over a thumbnail, I didn't see, in the status bar, a link like:

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

and, therefore, clicking on the link did nothing. All of the thumbnail links had only the base URL:

myth:\\MyMythbackend/recordings/

The only way I could fix the problem was to edit the utils.php file (on my system, it's in /var/www/html/mythweb/includes). In the function video_url, I changed it from:

Modifying MythWeb to View Videos

Big Note: This no longer works in the latest versions and I got sick of modifying the files after every upgrade. This needs to be properly address in the root code tree.

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