Eubolist's Blog

about IT, Linux, the web and much more

Archive for the ‘MythTV’ Category

MythNetTV-Status Page

leave a comment »

I wrote a little script the other day so I could sporadically check on the progress and last downloaded shows of mythnettv on my mythtv-box.  The package “mythnettv-gui” sets up a nice cronjob that creates a log file, which my script uses to deliver the information. You can download the script here.

All you have to do is put the script in place and tell your system with crontab -e to execute it every now and then:

# m h  dom mon dow   command

* * * * * /usr/local/bin/mythnetstatus.py

For the lazy reader here is a complete set of commands, just copy-paste in a terminal to download and set everything up:

wget http://content.wuala.com/contents/Eubolist_/www/mythnetstatus.zip?dl=1 && mv mythnetstatus.zip?dl=1 mythnetstatus.zip && unzip mythnetstatus.zip && sudo mv mythnetstatus.py /usr/local/bin && sudo cp var/www/mythnettv-status /var/www && rm -Rf var && crontab -l > cron.tmp && echo “* * * * * /usr/local/bin/mythnetstatus.py” >> cron.tmp && crontab cron.tmp && rm cron.tmp

Written by eubolist

2010/12/24 at 12:36

Install MythTV 0.22 on Ubuntu 9.04 Jaunty Jackalope

with 2 comments

If you want to install the newest version of MythTV on Jaunty, here’s what you have to do:

  1. Add the following lines to your /etc/apt/sources.list:
    deb http://ppa.launchpad.net/mythbuntu/repos/ubuntu jaunty main
    deb-src http://ppa.launchpad.net/mythbuntu/repos/ubuntu jaunty main
  2. Add the Mythbuntu key by typing the following command: gpg –keyserver hkp://keyserver.ubuntu.com:11371 –recv-key 1504888C && gpg -a –export 1504888C | sudo apt-key add –
  3. Update your list and install Mythbuntu-repos: sudo aptitude update && sudo aptitude install mythbuntu-repos && sudo aptitude safe-upgrade

Written by eubolist

2010/02/07 at 21:04

Set up LIRC to control your Ubuntu/MythTV Box with a Microsoft Media Center Edition (MCE) infrared remote control

with one comment

I wanted to control my MythTV-Box like I used to control my old receiver with a good old fashioned IR remote rather than with keyboard and mouse. That’s why I went to eBay and bought myself a cheap MCE remote, you can have them shipped from China for less than 20 bucks:

I didn’t know whether the device was Linux compatible, so I just plugged it in and took it from there:

~$ lsusb

Bus 003 Device 002: ID 045e:006d Microsoft Corp. eHome Remote Control Keyboard keys

Looks good. Let’s install the latest version of lirc:

~$ sudo aptitude update && sudo aptitude install lirc

Then let’s check whether lirc picks up correct signals from our remote:

~$ irw

Then press the OK or any other button and the output should look somewhat like this:

000000037ff07bdd 00 OK mceusb

If it does: Congratulations, you’ve got a lirc compatible infrared remote! Exit irw by pressing [Ctrl + C].

LIRC normally runs at system start as a daemon (=runs in background). It reads a file called “.lircrc” in your home directory, in this file you can specify a command for each button. You can even specify custom keybindings for different programs, let’s have a look at my .lircrc file:

~$ cat .lircrc

include /home/eubolist/.mythtv/lircrc                             –> Here we specify which configuration
include /home/eubolist/.lircfiles/vlc                                       files to include in addition to this one
include /home/eubolist/.lircfiles/rhythmbox

begin
prog = irexec                –> irexec means that lirc will
button = Home                   pick up your command no matter which program is running
config = python /home/eubolist/ir-scripts/mythfrontend.real.py 
end

begin
prog = irexec
button = TV
config = python /home/eubolist/ir-scripts/miro.py
end

begin
prog = irexec
button = Videos
config = python /home/eubolist/ir-scripts/vlc.py
end

begin
prog = irexec
button = Music
config = python /home/eubolist/ir-scripts/rhythmbox.py
end

begin
prog = irexec
button = Power
config = python /home/eubolist/ir-scripts/onoff.py
end

Now you may ask yourself why I have some Python scripts specified as actions when I press certain buttons. The reason is simple, let’s have a look at vlc.py:

##!/usr/bin/python
import commands
import os
import sys
import subprocess

output = commands.getoutput(‘ps -A’)

## Check whether vlc is running:              –> As I usually don’t need multiple instances of the same
if ‘vlc’ in output:                                    program running I want to check whether it’s already open

## If yes: either shut the process down
#       os.system(‘/usr/bin/killall vlc’)

## or do nothing:
sys.exit(0)

## If not: Open vlc and end this script:

else: pid = subprocess.Popen(‘/usr/bin/vlc’).pid       –> If you just use os.system() again here the
sys.exit(0)                                        script will just stay open and keep irexec busy, if you press the button again it woud get queued and run again once you exit vlc

Now have fun toying around with Ubuntu and your ir remote control. If you have any questions, thoughts or criticism you are welcome to write a comment.