Remote notification

I have been playing around with a way to get my Ubuntu box (that is running VLC on startup to stream our satellite TV across the network) to notify other boxes that it is awake and broadcasting. This is so that my wife can start the box up from a WOL script on the kitchen PC and then, once it is booted up, turn on the modded Xbox and run XBMC to connect to the stream and pick up TV downstairs.

Nice enough. 🙂

I managed to get it working using the following steps.

  1. On the PC that broadcasts TV, I added passwordless SSH (via this link) for the user that the kitchen PC runs under.
  2. On the kitchen PC, I created a script in the /usr/bin called notifier that has the following in it:
    export DISPLAY=:0 && export XAUTHORITY=/home/[KITCHEN COMPUTER USERNAME]/.Xauthority && sudo -u [KITCHEN COMPUTER USERNAME] /usr/bin/notify-send "TV is now broadcasting" 2>&1.

    Most of this is via this page.

  3. After adding the same user to the TV PC, I have a line in the TV PC /etc/rc.local that says
    su [KITCHEN COMPUTER USERNAME] -c notifyKitchen
    The notifyKitchen is a /usr/bin script that simply says
    ssh [KITCHEN COMPUTER USERNAME]@[KITCHEN COMPUTER] 'notifier'.

Done and done. When the TV PC boots, it calls this command and the Kitchen PC gets a pop-up notification that TV is running.

Advertisements

Streaming PVR-150 via VLC

So, after some pretty massive renovations, I now have Cat-5E cable throughout the house. Sweet. 🙂

I also have a need to somehow get the feed from my Sky box upstairs to the TV downstairs so the younglings can watch Playhouse Disney. In the past, I’ve done this through ye ol’ UHF backfeed, but the new HD box doesn’t allow that without an RF modulator.

What to do? Oh, well I do have an Xbox softmodded with XBMC downstairs. And I do have a Shuttle running Ubuntu with a Hauppauge PVR-150 TV card beside the Sky box upstairs. How abouts a little VLC streaming? 🙂

I’ve added the following line of code to my

/etc/rc.local

file on the Shuttle:

su [A NON-ROOT USER] -c "vlc pvr:// :pvr-device=/dev/video0 :pvr-norm=0 --sout '#standard{access=http,mux=ts,dst=[IP ADDRESS OF SHUTTLE]:8080}' --daemon"

Then, on my XBMC install, I have a file called

Sky.strm

which has this one simple line in it:

http://%5BIP ADDRESS OF SHUTTLE]:8080

and is sitting under the Playlists folder in the Videos directory of my UserData folder. When I go and select it, after a couple of seconds I get full MPEG-2 streaming across my network!

I can also access the stream from any VLC player on my other machines too.

Super sweet!

EDIT: After upgrading to 10.04, I inexplicably needed to add the line :pvr-channel=2 to make this pick up more than static.

PVR150/Gutsy/Sky NZ MythTV configuration tips and tricks

Here are some other things I’ve learnt you need to do to get MythTV working with a Sky box, Ubuntu Gutsy and a PVR-150:

General

  1. Make a directory called /usr/src/mythtv

EPG setup

  1. Create and run channelsetup.sh to import the channels into the MythTV database

    #!/bin/bash
    wget http://epg.pvr.geek.nz/epg/listings-sky.xml.gz
    gunzip -f listings-sky.xml.gz
    mythfilldatabase --file 1 listings-sky.xml --do-channel-updates
  2. Create a file called getEPG in /usr/local/bin (and chmod +x to make it executable) to get the channel data. Copy the following code into it:

    #!/bin/bash
    cd /usr/src/mythtv
    wget http://epg.pvr.geek.nz/epg/listings-sky.xml.gz /usr/src/mythtv/listings-sky.xml.gz
    gunzip -f /usr/src/mythtv/listings-sky.xml.gz /usr/src/mythtv
    mythfilldatabase --no-delete --file 1 -1 /usr/src/mythtv/listings-sky.xml --update

    If you have webmin installed, set up a cron job to run this script once a week.

IR Blaster

  1. The guide for setting up the PVR-150’s built-in IR blaster working is Mark’s guide from BlushingPenguin. Follow them, and the tip I found for the Gutsy patch, to get it so that your IR blaster is working. Key things to remember:
    • Gutsy comes with it’s own copy of IVTV so you don’t need to download that.
    • Run with the pre-patched version of lirc as Mark directs
    • The firmware goes in /lib/firmware
    • Sky Zenith boxes are code 482 in his master lircd.conf. Specifically, your /etc/lirc/lircd.conf needs to have the following for the blaster to work:

      begin remote
      name blaster
      bits 32
      flags RAW_CODES
      eps 0
      aeps 0
      plead 0
      gap 333333
      repeat_bit 0
      begin raw_codes
      name 0
      2179072000
      name 1
      2179072001
      name 2
      2179072002
      name 3
      2179072003
      name 4
      2179072004
      name 5
      2179072005
      name 6
      2179072006
      name 7
      2179072007
      name 8
      2179072008
      name 9
      2179072009
      name POWER
      2179072010
      name CH_UP
      2179072015
      name CH_DOWN
      2179072016
      name CH_PREVIOUS
      2179072019
      end raw_codes
      end remote
  2. Make sure you have MythWeb installed. Go to the Channel Editor in Mythweb and make sure you have a channel number beside each channel to make them appear in the guide and MythWeb
  3. Add a channel number to the freqid field too – otherwise the IR blaster won’t work
  4. Create the following change-channel-lirc.pl in the /usr/local/bin folder (chmod +x so it can run):

    #!/usr/bin/perl
    # make sure to set this string to
    # the corresponding remote in /etc/lircd.conf
    $remote_name = “blaster”;

    sub change_channel {
    my($channel_digit) = @_;
    system (“irsend SEND_ONCE $remote_name $channel_digit”);
    sleep 1;
    }

    $channel=$ARGV[0];
    sleep 1;
    if (length($channel) > 2) {
    change_channel(substr($channel,0,1));
    change_channel(substr($channel,1,1));
    change_channel(substr($channel,2,1));
    } elsif (length($channel) > 1) {
    change_channel(substr($channel,0,1));
    change_channel(substr($channel,1,1));
    } else {
    change_channel(substr($channel,0,1));
    }

  5. Run mythtv-setup and put change_channel_lirc.pl in the external change channel field on the input card.

MythTV, PVR 150 and Gutsy

After installing a fresh Gutsy (7.10) box, I found that I had no end of problems getting the IR blaster on my PVR-150 to work – despite the fantastic instructions and work by Mark from BlushingPenguin.com. A number of problems presented themselves – including “hardware does not support sending” errors and a hard lock when I changed /etc/lirc/hardware.conf to have MODULES=”lirc_pvr150″ only, which you should have.

Finally, I stumbled across these instructions from UbuntuForums.org:

Add this deb line into Applications->System->Software Sources->Third Party Sources (or to your /etc/apt/sources.list).

deb http://ppa.launchpad.net/superm1/ubuntu gutsy main restricted universe multiverse

Update your package lists and a new linux-ubuntu-modules should be available.

Now it looks like I’m up and running! Maybe…

XBMCMythTV and MySQL

Just got the xbmcmythtv python script (sort of) working on my modded xboxes. However, I couldn’t get it to connect to my master MythTV server. After a lot of gnashing of teeth and internet searching, there are basically three steps to get this working:

  1. Make sure your MythTV master backend is set up for having remote hosts connecting to it. This is primarily done by giving the backend its actual IP address, rather than localhost/127.0.0.1.
  2. Make sure your MySQL server is set to receive remote connections as well. Doing this changes with different versions, but in my case, it was a matter of commenting out the bind_address line in my /etc/mysql/my.cnf.
  3. Depending on the version, make sure that the username and passwords are using the OLD_PASSWORD command in MySQL:

    mysql -u root
    login as: james
    update user set password=old_password('mythtv') where host = '192.168.whatever.yours.is';

Now you should be able to connect.

MythWeb mobile in English

For some reason MythWeb on a mobile device seems to be stuck in German. I can’t find a way of changing it, so in the meantime if this happens you can comment out the three lines in translate.php that try and find out the language:

// Need to detect the language?
// if (empty($_SESSION['language']))
// $_SESSION['language'] = get_browser_lang();
// if (empty($_SESSION['language']))
$_SESSION['language'] = 'English';

Therefore it will default to English.