/MythRokuPlayer

mythtv front end for Roku player

Primary LanguagePHPOtherNOASSERTION

MythRoku 2010 Peter Nevill
Unless otherwise stated (the @license tag at the top of the file), all files are distributed under 
the GNU General Public License.

MythRoku is for streaming mythtv recordings and video via Roku player
It is based on the videoplayer example from Roku

prerequisits:

-functioning mythtv backend and mythweb (with function streaming of recordings)
-handbrakecli (for converting recordings to H.264 format)
-Mythtv video are stored in H.264 format (mp4)
-web user (eg. apache) permission to delete recordings

for more information see the Roku developer site:
http://www.roku.com/developer


1) you need to set up you Roku box in developer mode to install new channels.
	Use remote and enter Home 3x, Up 2x, Right, Left, Right, Left, Right
	
	add the following to your .bashrc file "ROKU_DEV_TARGET=roku.ip" 
	Where roku.ip is the ip address of your Roku player.

2) you need to modify mythweb to enable streaming of mp4 files.
 	modify /usr/share/mythtv/mythweb/includes/utils.php by adding the 
	following around line 247
	
	case 'mp4' : return "$url.mp4";
	
        and in the following file /usr/share/mythtv/mythweb/modules/stream/stream_raw.pl

	add an additonal elseif in the file type section 

        elsif ($basename =~ /\.mp4$/) {
        $type = 'video/mp4';
        $suffix = '.mp4';
	}
	
	if you are using authentication to protect your mythweb (best practice)
	you need to add the following to your mythweb.conf file (near the top)
	
	<LocationMatch .*/mythroku*>
        	Allow from 192.168.1.0
    	</LocationMatch>


3) add the mythroku directory to your mythweb directory and change the permission
	to that of your webserver. Ensure that the .htaccess file is in that directory
        as well. The .htaccess file in the mythroku directory simply has:

	RewriteEngine off

	This is to stop mythweb adding its templates to the xml data.

	You need to edit the settings.php file with your local parameters for example
	ip or url of your webserver.

4) convert recordings from mpg to mp4
	create a user job in mythtv (mythbackend setup-> general-> Job Queue)
	add the following to a job command

	/pathtomythweb/mythroku/rokuencode.sh "%DIR%" "%FILE%"
	
	to make it a default job run after every recording. In your mythconverge->setting
	set the AutoRunUserJob1 (or whichever job you set it to) data = 1
	
	This will automatically encode a recording to mp4 format which can then be
	streamed by roku
	
5) install mythroku to your roku player
	in the mythroku directory (containing this read me,
		this has to be called "MythRokuPlayer") simply type
	
	make install

	once installed you will need to set the path to the mythroku directory
	on your webserver on the mythroku settings on roku

	eg. http//192.168.1.10/mythweb/mythroku

6) Debuging, you have a couple of options:
	
	telnet $ROKU_DEV_TARGET 8080

	will give you any output from the player for debug

	You may need to comment out the following line
	bind-address = 127.0.0.1 in /etc/my.cnf to allow access to mysql

	I have created two php files
	
	mythtv_movies_test.php
	mythtv_tv_test.php

	use these to check your setup. They draw the same data that is used to create
	the xml files for roku. If these do not work then mythroku will not.


Good luck and happy streaming.