Netflix Streaming LIRC Integration

From MythTV Official Wiki
Jump to: navigation, search

Current Version

mythnetflix07
see changelog



This is a set of scripts and custom LIRC file to decently integrated Netflix with Mythfrontend on a Mythtv system.

The scripts will only work right if there is no other instances of Firefox running at the same time.

All of these steps must be performed as the same user that runs Mythfrontend

These are instruction for a Mythbuntu 12.04 install. I did get it to also work just fine on an Xubuntu 14.04 install. if you are using a dual monitor setup you may want to read write-mouse-position and set the x= and y= to just one of your monitors

Version 07 is extremely different than earlier versions.
If you want to upgrade:

  1. note any change you may have made to your .lirrc file
  2. delete your mythnetflix folder
    1. rm -rf ~/mythnetflix
  3. install unclutter
    1. sudo apt-get install unclutter
  4. follow the easy install instructions
  5. re-edit mythnetflix.lircrc


first thing, access the desktop by either exiting out of Mythfrontend completely or hitting Ctrl-Alt-Right Arrow

Install Extra Software

  1. lirc-x -- provides irxevent
  2. xdotool
  3. xautomation -- provides xte
  4. unclutter

sudo apt-get install lirc-x xdotool xautomation unclutter

Install Pipelight/Silverlight

  1. The first thing you need to do is install the Pipelight plugin and enable Sliverlight (directions for enabling are lower on install instructions page)
  2. Close Firefox if you are running it
  3. Start Firefox and wait for the Pipelight/Silverlight plugin to install
  4. Go to the test page to make sure Pipelight/Silverlight plugin is working
  5. Close Firefox

Mythnetflix Easy Install

open a terminal

  1. download the installer
  2. make the installer executable
  3. run the installer
  4. run Mythnetflix
    1. login -- make sure "Remember Me" checked
    2. make sure remote works right, if the buttons on the player window aren't working right see button-mapper
    3. exit mythnetflix with either the remote or hitting Ctrl-q
   wget http://www.schaderules.com/files/3413/9888/7080/mythnetflix-install07.sh
   chmod +x mythnetflix-install07.sh
   ./mythnetflix-install07.sh
   ~/mythnetflix/mythnetflix.sh


Edit Mythfrontend

To add a menu button for your theme you need to go to ~/.mythtv/themes/'the theme your using'/

note: I have been using the MythMediaStream theme

Open mainmenu.xml and add the following lines somewhere that you think fits (I put it below the videos section)

<button>
   <type>VIDEO</type>
   <text>Netflix</text>
   <description>Watch videos on</description>
   <action>EXEC ~/mythnetflix/mythnetflix.sh</action>
</button>

Now when you restart your Mythfrontend the Netflix option should show up

The Remote

the included LIRC file is a whole bunch of mouse position and click commands. you may need to edit it. I set it up to work with the remote I have but it should give you a good starting point to make it work. I will post some more advanced LIRC and xdtool stuff when I get a chance.

right now it will only work with mceusb remote

My remote:

Remote gms.jpg

Navigating with the remote

When in the Netflix choose video screen:

  • UP, DOWN, LEFT, RIGHT -- buttons jump 100 pixels, hold down enabled
  • 2, 8, 4, 6 -- small button steps 10 pixels at a time, hold down enabled
  • OK -- mouse click I use it to select profile (will start movie)
  • Channel UP, DOWN -- scroll the page up or down
  • ENTER -- will start movie and try to auto full screen, sometimes fails if video loading take too long
  • ← (back arrow) -- exit Netflix, returns you to Mythfrontend
  • 1 -- zooms-in
  • 7 -- zooms-out

When watching a video:

the UP, DOWN, LEFT, RIGHT, 2, 8, 4, 6, OK buttons do all the same thing and are to be used if needed.

Volume keys -- I added a control, but I don't use system volume controls YMMV

  • PLAY, PAUSE -- both buttons will play or pause the video
  • STOP -- sends you back to the Netflix video chooser screen
  • FF, REW -- will put the mouse on the position bar in the middle-- bar will disappear but if you use the buttons to move along it it will re-appear, OK selects
  • DVD -- puts the mouse on the audio menu -- my remote it's the little button to the right of the mute button
  • RecTV -- puts the mouse on the HD button -- my remote it's the button to the left of the mute button
  • GREEN BUTTON -- centers the mouse on the menu bar -- kinda worthless I think
  • ∗ -- Kills Silverlight plugin if mis-behaving. only use if necessary!

About: The LIRC File

I had to write a bunch of mouse position and mouse click commands for this file.

I also have it only set up for a MCEUSB remote.

Only 1 thing may need changing if at all in the mythnetflix.lircrc file.


If you want to change your exit Firefox/Mythnetflix button:

starts at line 48

begin
    ###firefox###
    ##exit Netflix/Firefox##
    #!!!!if you change any of the buttons make sure the button = KEY_BACK line is commented out!!!!#
    remote = mceusb
    prog = irexec
    ## to use "info" button uncomment
    #button = More
    ##to use "power" button uncomment
    #button = KEY_POWER
    button = KEY_BACK
    config = ~/mythnetflix/lirc/exit-firefox.sh
    repeat = 0
    delay = 0
end

About: Mythnetflix Scripts

If you need to edit the scripts I tried to make it relatively fool proof.

they can all be found in /home/'user'/mythnetflix

  • mythnetflix.sh -- found in /home/'user'/mythnetflix This is the mythnetflix script
  • write-mouse-position.sh -- found in /home/'user'/mythnetflix/build-lirc This script attempts to find current screen resolution and calculate the proper position of the buttons for use with LIRC. for more information see write-mouse-position for how to use and how to manually set screen resolution
  • mythnetflix-map.sh -- found in /home/'users'/mythnetflix/button-mapper This script allows you to easy set the button positions if they were not properly set by write-mouse-position.sh see button-mapper for how to use

Problems I Have Ran Into

Everything works fine when I launch the script from the command line but when I launch it from the Mythfrontend Silverlight always crashes.

This one took a while for me to figure out how to make it work, it's not a fix per say more of a workaround. make sure you have SSH client and server enable on the machine your running Netflix on

  1. from the terminal make sure you can ssh back into your mythtv box ssh 'user'@127.0.0.1 where user is the user running Mythfrontend.
  2. exit out of the ssh session
  3. set the ssh server to allow you to login over ssh without a password ssh-copy-id 'user'@127.0.0.1
  4. try logging in again ssh 'user'@127.0.0.1
  5. exit
  6. edit your mainmenu.xml <action> to look like this. Insert username where it says user:
<action>EXEC ssh user@127.0.0.1 'env DISPLAY=:0  ~/mythnetflix/mythnetflix.sh'</action>