Giter Club home page Giter Club logo

mythrokuplayer's Introduction

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 videos via Roku player.

Prerequisites:
 - Functioning MythTV backend and MythWeb with functional streaming of
   recordings.
 - All recordings and videos stored in H.264 format (.mp4, .m4v, .mov).
 - Web user (e.g. apache) permissions to delete recordings.
 - See 'Tools' section below for some optional prerequisites.

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

--------------------------------------------------------------------------------
Setup
--------------------------------------------------------------------------------

 1) Set your Roku to development mode

    With your Roku remote, enter the following:
        Home 3x, Up 2x, Right, Left, Right, Left, Right

 2) Modify MythWeb to enable streaming of H.264 files

    Modify /usr/share/mythtv/mythweb/includes/utils.php by adding the following
    around line 247:

        case 'mp4' : return "$url.mp4";

    Modify /usr/share/mythtv/mythweb/modules/stream/stream_raw.pl by adding an
    additonal elsif in the file type section:

        elsif ($basename =~ /\.mp4$/)
        {
            $type = 'video/mp4';
            $suffix = '.mp4';
        }

    Repeat instructions above for .m4v and .mov as well.

 3) Set up the mythroku directory

    You can simply copy the mythroku directory to your mythweb directory
    (typically /usr/share/mythtv/mythweb), but it is easier to just create a
    symbolic link. Regardless, make sure this directory has the same permissions
    as your webserver.

    Ensure that the .htaccess file is in the <pathto>/mythweb/mythroku/
    directory. This simply has:

        RewriteEngine off

    This will stop mythweb from adding its templates to the XML data.

    If you are using authentication to protect 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>

    Edit the settings.php file with your local parameters (i.e. webserver URL
    and MySQL credentials.

    NOTE: In order to be able to delete recordings from your Roku, the MythtWeb
          user (typically 'www-data' or 'apache') will need to have write
          permissions to your recordings. The recordings are typically owned by
          the 'mythtv' user and have group write permissions so it is easiest to
          just add the MythWeb user to the 'mythtv' group. For example:

              usermod -a -G mythtv www-data

          Note that a reboot is required for this to take affect.

 4) Convert all video files to MPEG-4 (H.264) format

    The Roku can only stream MPEG-4 video files (.mp4, .m4v, .mov) and
    recordings generally are stored as MPEG-2 video files.

    Create a user job in mythtv (mythbackend setup-> general-> Job Queue) and
    add the following to a job command:

        <pathtomythrokuplayer>/tools/rokuencode.sh "%DIR%" "%FILE%"

    In your mythconverge -> setting set the AutoRunUserJob1 (or whichever job
    you set it to) data = 1. This will make sure the job is run after every
    recording.

    rokuencode.sh can also be used in the command line to convert existing
    MPEG-2 files.

 5) Install MythRokuPlayer to your Roku

    Make sure you set the ROKU_DEV_TARGET environment variable to your Roku's IP
    address. See the details in <pathtomythrokuplayer>/Makefile to see how this
    is done.

    Once set, simply type the following command in <pathtomythrokuplayer>/:

        $ make install

    When you first open the newly installed MythRokuPlayer channel, you will
    need to set the path to the mythroku directory on your webserver. For
    example:

        http//192.168.1.10/mythweb/mythroku

--------------------------------------------------------------------------------
Additional Notes
--------------------------------------------------------------------------------

1) It has been reported in some cases that jpeg images are not being displayed.
   The issue is in using imagecreatefromjpeg() when GD is not enabled or
   installed. It can be installed as follows (add where appropriate):

    Ubuntu 12.04 (stable):
        sudo apt-get install php5-gd
        sudo service apache2 restart

2) Users may need to comment out the following line in /etc/my.cnf to allow
   access to MySQL:

    bind-address = 127.0.0.1

--------------------------------------------------------------------------------
Debugging and troubleshooting
--------------------------------------------------------------------------------

To access the MythRoku debug console, execute the following:

    telnet <roku_ip_address> 8085

For example:

    telnet $ROKU_DEV_TARGET 8085 or telnet 192.168.1.8 8085

You can use mythtv_test.php to check your setup. It draws from the same data
that is used to create the XML files for the Roku. If this does not work, then
MythRoku will not. Note that You may need to install php5-xsl to get the
mythtv_test.php script to output properly. It can be installed as follows (add
where appropriate):

    Ubuntu 12.04 (stable):
        sudo apt-get install php5-xsl
        sudo service apache2 restart

    Fedora:
        yum install php-xml

--------------------------------------------------------------------------------
Additional Tools
--------------------------------------------------------------------------------

There are a few tools in <pathtomythrokuplayer>/tools that may help you along
the way:

mythrokumake:
    A simple wrapper script for make that does two things:
        - Avoids the need to add an entry in your ~/.bashrc file for the
          ROKU_DEV_TARGET environment variable.
        - Allows you to specify multiple Roku targets if needed.

rokuencode.sh:
    Converts MPEG-2 files to MPEG-4 (H.264) using HandBradeCLI.

    Prerequisites:
        - HandBrakeCLI: To convert recordings into H.264 format.

mythrokuplayer's People

Contributors

zane131 avatar ear9mrn avatar

Stargazers

 avatar

Watchers

 avatar James Cloos avatar  avatar

mythrokuplayer's Issues

HTTP Response error message

This does tell the user that the player didn't go AWOL but it really isn't very informative. I found myself ignoring it and annoyed by it pretty quickly. It's also very tech-ese in language. The most common would be 404 and this could be interpreted with a message to say what was looked for was not found. otherwise, the http code would be helpful, if technical. Great idea, needs work. (imho)

hidden breakages

There's some stuff we should look in to. it breaks for me and I don't think it should be merged.

PHP Warning: getimagesize(http://192.168.1.50/mythweb/data/video_covers/1904_20121226100900.mpg.png): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found\r\n in /usr/share/mythweb/zane/MythRokuPlayer/mythroku/resizeimage.php on line 10

is followed by several video_* directory problems then it finally crashes

PHP Fatal error: Call to undefined function imagecreatefrompng() in /usr/share/mythweb/zane/MythRokuPlayer/mythroku/resizeimage.php on line 24
192.168.1.10 - - [26/Dec/2012:10:32:36 -0600] "GET /mythweb/mythroku/image.php?image=1904_20121226100900.mpg.png HTTP/1.1" 500 - "-" "Roku/DVP-4.9 (024.09E05060A)"

Global Setting for job prevents recording Play

I scheduled a recording and was able to play it. I disabled the job type MetadataLookup in the global settings and using MythWeb I initiated that job. The recording is no longer included in the Playable list.

mythconverg.jobqueue has an entry for this recording and it's Type is not easily linkable to mythconverg.settings where, for example, jobAllowMetadata is unset. Complicating this problem is that Settings are distinguished by Hostname so a system of multiple recorders need to evaluate to the proper recording host (eg. not just any job<==>setting is accurate)

testing from two Roku players

I'm not able to test the multi-resume and will assume that if one player resumes correctly then some other will also.

Deployment plan

identified so far: contact Pete Neville about his willingness to promote a channel update with Roku; Then announce upcoming channel update to forum; Get Pete's feedback about the changes; Incorporate forum and Pete feedback; Identify beta testers (beta being Release Candidate upon which only critical issues force code changes); document remaining bugs and update README final; deploy.

tracking issue. first draft

suggest we resolve #17, #18, #20, #21 before contacting Pete. Need something pretty stable for him to evaluate.

in process job on recording but it is displayed

while rokuencode.sh is running the recording is listed and when the user tries to play it the system just returns with no warning or information.

it also affects the way previews are generated (they are not for this case)

initial setup data directory

when playing a recording, an HTTP request 404 for resource "File does not exist: /usr/share/mythweb/data/recordings..." which exists at '/DVR/1261_20121226065300.mp4'

recordings is a Storage Group location and may not reside in a relative filesystem. Default storage group is /DVR/recordings. Other locations might not be under DVR.

[Wed Dec 26 08:48:21 2012] [error] [client 192.168.1.10] File does not exist: /usr/share/mythweb/data/recordings
192.168.1.10 - - [26/Dec/2012:08:48:21 -0600] "GET /mythweb/data/recordings/1261_20121226065300.mp4 HTTP/1.1" 404 323 "-" "Roku/DVP-4.9 (024.09E05060A)"

initial setup data/video directory

a symlink in mythweb/data to mythtv storagegroup Videos is req'd. I notice some/all of the storage group code removed that is on dev branch. This is not mentioned in the readme (already pretty intense reading) and would be worth fixing by looking up the location of Videos.

 [error] [client 192.168.1.10] File does not exist: /usr/share/mythweb/data/video   

refresh of detail screen

press up while watching a recording. the menu does not present the "resume playing" option.

go up again to the listing of that recording then OK to select it, the menu now shows the resume option.

regressive delete problem with roku UP after delete

this may have been fixed but due to Issue #16 I can't try it. It would be a big problem in a channel release.

When I delete I'm returned to categories[0] in the main screen. I wish this was the top level menu instead, but... I press the Roku UP key and am presented with the detail screen of the show I just deleted. If I chose delete then some other show will unexpectedly be deleted.

after Delete we need to more carefully re-initialize internal data

mythpreviewgen never runs

recorded 4 shows in an empty system (no other recordings). no preview image files are created. no mythpreviewgen log file is created. no errors from httpd access/error or mythbackend logs

don't pick item on entering a menu selection

When I pick a top level like Recordings, the UI automatically jumps to the first sub-menu (title) item. To go to Date sorting I have to click UP. This is annoying because almost always I more want to select some other sub-menu before I want to select some item.

I can understand a personal preference but it probably breaks my backend flow. At the least there should be a setting to allow configuring between the drilling down or the shortcut to item behavior.

errata on commit 03e4bb03a00553bb80b8c41742e03fdff3df93ef

  1. pic is not defined - xml_data.php line 637, can be removed.
  2. add test for done to SQL in xml_data in checkPendingJobs() line 661
AND CAST(0x0100 AS UNSIGNED) > J.status
  1. remove queryJobs.php
  2. add (if necessary) to README install php-xml (for tests only I think?)
  3. add to README warning to check jobqueue for errored jobs if playing some items is erratic..
  4. suggest rokuencode as-shipped use iphone default; (much) faster and likely to work in broader cases

rokuencode does not create output file

[]# ls /tmp/rok*
/tmp/rokuencode.sh.log
[]# cat /tmp/rokuencode.sh.log
=================================================================
Sat Jun  1 03:57:05 CDT 2013
SOURCE:      /PVR/recordings/1904_20130601035400.mpg
DESTINATION: /PVR/recordings/1904_20130601035400.m4v

nice: 10: No such file or directory
=================================================================
[]# ls -l /PVR/recordings/1904_20130601035400.mpg
-rw-r--r-- 1 mythtv users 87M Jun  1 03:57 /PVR/recordings/1904_20130601035400.mpg
[]# ls -l -d /PVR/
drwxrwsrwx. 12 mythtv users 4.0K May  3 08:13 /PVR/
[]# ls -l -d /PVR/recordings/
drwsrwsrwx 3 mythtv users 4.0K Jun  1 05:26 /PVR/recordings/
[]# 

can't delete a recording

PHP Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /usr/share/mythweb/git-zane/MythRokuPlayer/mythroku/mythtv_tv_del.php on line 45

dirname seems ok:

mysql> SELECT A.chanid,
-> A.starttime AS act_start,
-> B.starttime AS sch_start,
-> D.dirname
-> FROM recorded A
-> INNER JOIN recordedprogram B
-> ON A.programid = B.programid
-> LEFT OUTER JOIN recordedrating C
-> ON B.starttime = C.starttime AND B.chanid = C.chanid
-> LEFT OUTER JOIN storagegroup D
-> ON A.storagegroup = D.groupname
-> WHERE A.basename LIKE '1904_20130601055600.%';
+--------+---------------------+---------------------+------------------+
| chanid | act_start | sch_start | dirname |
+--------+---------------------+---------------------+------------------+
| 1904 | 2013-06-01 05:56:00 | 2013-06-01 05:00:00 | /PVR/recordings/ |
+--------+---------------------+---------------------+------------------+

Job control for in-process recordings

recordings that are still being recorded are displayed to the user. The user is allowed to Delete them while recording is in progress. The status of the recording then is unchanged, the files are deleted, my HDHomerun continues to try to record. The mythbackend seems not to notice as I get nothing in mythbackend.log about it.

User jobs (like convert-to-mp4) that are running when the user deletes a recording are left running; HandBrake goes to 90% CPU usage. It did end cleanly after some time, afaict.

There are two real impact to the user: unexpectedly high cpu usage and recording channel that can't (easily) be re-assigned. They're both temporary That's good. They both decrease confidence. That's bad.

An obvious testcase would be deleting while mythtranscode. I need a much larger recording and hope to try that asap. i suspect mythbackend is resilient enough in this. hopes would be that mythrokuplayer was also...

support MythTV v0.26

convert_datetime needs to return UTC if DBSchemaVer is 1307. It can be replaced with:

function convert_datetime($str)
{
        if(UseUTC)
                return convert_datetime_utc($str);
        else
                return convert_datetime_pre($str);

}

function convert_datetime_utc($str) 
{
        //function to convert mysql timestamp to unix time
        return strtotime( $str. ' UTC' );
}

function convert_datetime_pre( $str ) //mythtv  0.25
{
    list($date, $time)            = explode(' ', $str);
    list($year, $month,  $day)    = explode('-', $date);
    list($hour, $minute, $second) = explode(':', $time);

    if ( 0 == $year  ) { $year  = 1900; }
    if ( 0 == $month ) { $month = 1;    }
    if ( 0 == $day   ) { $day   = 1;    }

    return mktime($hour, $minute, $second, $month, $day, $year);
}

Not familiar enough with your use of convert_date so if it is given datetime from the new UTC data then it needs to be updated too.

initial setup video directory

[error] [client 192.168.1.50] Directory index forbidden by Options directive: /usr/share/mythweb/data/video_covers/

there is a link to video_covers in mythweb/data and its target is world writeable.

there are several other of the Videos housekeeping directories which are creating error_log web server entries

ls -a /usr/share/mythweb/data/
. .. cache recordings tv_icons video video_covers Videos

Play menu for MPG files

I recorded a program and unset the user job so that the file remained an MPG. It shows up in the Recordings menu and I can select to play it. It won't, of course, play but there is no indication of a problem cause, just that the play immediately returns.

While a recording is in progress, the program will also be presented like the above except that "NOT TRANSCODED" as added to the shows name in the display. For long show names this could be a problem and I'm not sure how useful it really is. My take is that I really only want to see playable recordings (unless the system lets me do something about it, like launch a mythtranscode and/or convert-to-mp4 job).

If mythtranscode has been run on the recording, there is no indication that the program should not play and the user is left with no feedback that the recording is not playable.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.