zane131 / mythrokuplayer Goto Github PK
View Code? Open in Web Editor NEWThis project forked from ear9mrn/mythrokuplayer
mythtv front end for Roku player
Home Page: tbd
License: Other
This project forked from ear9mrn/mythrokuplayer
mythtv front end for Roku player
Home Page: tbd
License: Other
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.
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)
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)"
Recorded table does not have season, episode columns.
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)
I'm not able to test the multi-resume and will assume that if one player resumes correctly then some other will also.
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.
a Feed::Item should allow a fully qualified path to a resource like sdimg
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)
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)"
I know there is some commentary about tweaking but this has changed since the last commit. it's about 5-10 seconds to far into the playback.
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
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.
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
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
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.
AND CAST(0x0100 AS UNSIGNED) > J.status
[]# 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/
[]#
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/ |
+--------+---------------------+---------------------+------------------+
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...
I'll need some time to adapt my codebase to the new UI fields before we seek to promote this. This is just a tracking issue, assign to me if you like.
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.
[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
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.