Bob's Notepad

Notes on projects I have done and things I have learned saved for my reference and for the world to share

Thursday, November 19, 2009

PVR-150 IR Blaster on MythBuntu 9.10 with Dish Network

Upgrading to MythBuntu 9.10 from 9.04 was a challenge on some respects but the biggest of the challenges was getting my PVR-150 IR Blaster working.... again. I don't know why Ubuntu loves to break this thing on every upgrade but they do. Thanks to Jimmybondo for the bulk of this work.



  • sudo apt-get install lirc-modules-source
  • cd /usr/src/lirc-0.8.6
  • wget http://www.skynet.ie/~shabba/zilog.diff
  • sudo patch -p0 < ~/Downloads/zilog.diff
  • sudo dpkg-reconfigure lirc-modules-source


Now edit your /etc/init.d/hardware.conf file and replace lirc_pvr150 with lirc_zilog and you should be set.

If you're not upgrading from MythBuntu 9.04 and/or don't have the rest of your configuration files, you can refer to my prior post for what your lircd.conf file needs to look like. You may also need to add the following to hardware.conf:
TRANSMITTER_DEVICE="/dev/lirc0"

Labels: , , , , , ,

Reference Link


Wednesday, October 15, 2008

MythNetTV on LinuxMCE

There is a utility for MythTV called MythNetTV which can be found here. This utility does a great job at grabbing videos from an RSS feed and importing them in to MythTV's database as recorded programs. Set up is quite simple in LinuxMCE but is done via the command line.

  • Login to a shell as linuxmce
  • Switch to a suitable directory. We'll just use /home/linuxmce
  • wget http://www.stillhq.com/mythtv/mythnettv/source/release-5/mythnettv-release-5.tgz
  • tar -xzvf mythnettv-release-5.tgz
  • cd mythnettv5-release
  • sudo apt-get install python-feedparser
  • sudo apt-get install python-ctypes
  • sudo apt-get install python-mysqldb
  • sudo apt-get install mencoder
  • mkdir data
  • Subscribe to Shows
  • ./mythnettv subscribe "URL" "Title of Show"

For example, if you want to subscribe to Tekzilla you would issue:

./mythnettv subscribe "http://revision3.com/tekzilla/feed/quicktime-large?subshow=false" "Tekzilla"

Repeat that step for any shows that you want to subscribe to

Get your shows and import them

./mythnettv update
./mythnettv download 1

(the number that follows "download" is how many of each show MythNetTV should download and import)

That's all there is to it.... The shows you subscribed to will now appear in LinuxMCE's Video category as well as in your MythTV Front Ends

Automating the process

In your mythnettv directory you can create a script that will automate this process and then add that to cron to automate the process.
touch get-shows
chmod +x get-shows
nano get-shows

When editting the get-shows script, just add the following lines:

cd /home/linuxmce/mythnettv-release-5/
./mythnettv update
./mythnettv download 1

Press Ctrl-X to save the file and then test it:
./get-shows

Now you can add it to cron so that it will be run automagically every day
cd /etc/cron.daily
sudo ln -s /home/linuxmce/mythnettv-release-5/get-shows mythnettv

Labels: , , , , ,

Reference Link


Wednesday, November 07, 2007

PVR150 with Set Top Box (KnoppMyth)

Last year I wrote a HOWTO that I put on the KnoppMyth Wiki. While I don't use KnoppMyth any longer and I feel that MythBuntu is a much easier solution I found myself needing information from that how-to and I apparently forget what I had named my document. After finding it I figured that I would post it here so I could find it if I needed to refer to it in the future. I included the updates that others had made as well.



Setting up KnoppMyth with one or more Hauppauge PVR-150 Cards using Dish Network or other Set Top Box

First, thanks to Mark who pointed me in the right direction at his site: http://www.blushingpenguin.com/mark/blog/?p=24

Reference System: KnoppMyth R5C7 with 2 Dish Network (Echostar) set top boxes running on two seperate Hauppauge PVR-150 PCI Cards (*NOT* the MCE version which does not have the IR Blaster)

Setting up KnoppMyth to use a set top box with the Hauppauge PVR-150's IR Blaster is actually pretty simple but there seems to be a lack of directions on exactly what needs to be done. Hopefully this will shed some light.

First of all, KnoppMyth already has lircd installed and running and should have already installed the drivers for the IR Blaster on the PVR-150. You can confirm this by checking for /dev/lircd. You should also see /dev/lirc and if you have a second PVR-150, you should see /dev/lirc1 (but you wont see an lircd1 at this time - we'll fix that later).
Step One

Make sure the lirc_pvr150 module is loading (needed for R5F27).

In some KnoppMyth distributions (like R5F27), lirc_i2c is loaded instead of lirc_pvr150. lirc_pvr150 is needed for the IR Blaster to work. To use lirc_pvr150, change following line in /etc/lirc/hardware.conf from:
MODULES="lirc_dev lirc_i2c"

to
MODULES="lirc_dev lirc_pvr150"

and reboot.
Step Two

Grab the latest firmware file. You can find a copy over at Mark's blog: http://www.blushingpenguin.com/mark/lmilk/haup-ir-blaster.bin

Note that this loads the firmware into RAM so it will increase your RAM usage. The alternative would be throwing the card in a windows machine and flashing it using Hauppauge's utilities.

Place that file in /usr/lib/hotplug/firmware on your KnoppMyth system and reboot. This step may be able to be skipped but there are some versions of the cards that have issues with IR lock ups.
Step Three

We need to find the codeset that your set top box uses. For my Dish Network / Echostar units, I used code set 1_28. If you need to find your code set, check out the blog listed at the top of this wiki and look at step #9 (you may need to look at step #6 to get an lircd.conf file as well). He has a script that you can download and use to find the code set for your set top box. If you have Dish Network tuner(s), then here is what you need in your lircd.conf file:
--- Begin file insert ---

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
2149318656
name 1
2149318657
name 2
2149318658
name 3
2149318659
name 4
2149318660
name 5
2149318661
name 6
2149318662
name 7
2149318663
name 8
2149318664
name 9
2149318665
name POWER
2149318666
name CH_UP
2149318671
name CH_DOWN
2149318672
name MUTE
2149318673
name VOL_DOWN
2149318674
name CH_PREVIOUS
2149318675
name VOL_UP
2149318676
name DISPLAY
2149318677
name EXIT
2149318680
name GUIDE
2149318683
name SELECT
2149318686
name AV
2149318697
name ENTER
2149318699
name MENU
2149318703
name MUP
2149318704
name MDOWN
2149318705
name MLEFT
2149318706
name MRIGHT
2149318707
end raw_codes

end remote

--- End File Insert ---

If you did the installation of KnoppMyth correctly and told the installer what remote you had, your remote control and IR receiver should already be up and running.
Step Four

We're actually almost done if you have only one tuner. All that is needed now is to have a script that mythtv can point to when it needs to change the channel. Again, Mark wrote a great script that works well. Paste this into a file called "change_channel" or something else that makes you happy and do "chmod +x change_channel". A good location for this script would be /usr/local/bin. Make sure your mythtv user has access to this script.
--- Begin Script ---
#!/usr/bin/perl

# make sure to set this string to
# the corresponding remote in /etc/lircd.conf
$remote_name = "blaster";

# Let's assume you don't need to press enter after you punch in a
# channel number. Change this to 1 if your cable box expects you press
# enter after each command
$needs_enter = 0;

# Change this to point to your rc executable
$rc_command = "/usr/local/bin/irsend";

# This subroutine actually sends the signal to the cable box
sub change_SIGNAL {
my($SIGNAL) = @_;
system ("$rc_command SEND_ONCE $remote_name $SIGNAL");
}

$SIGNAL=$ARGV[0];
open F, ">> /var/log/channel.log";
print F "channel changing $SIGNAL\n";
close F;
print "channel changing $SIGNAL\n";

# Checks if $SIGNAL begins with a digit
# If it detects that the string is made up of digits, then it puts
# spaces between the digits. Ex. 1234 becomes 1 2 3 4
if ( $SIGNAL =~ /^\d+$/ )
{
my $length = length($SIGNAL);
my $counter = 0;
my $temp;

while( $counter < $length )
{
$temp .= substr($SIGNAL,$counter,1) ." ";
$counter++;
}

change_SIGNAL($temp);
}
else
{
# argument we passed was not made up of digits, so it must be a
# command that does something other than channel changing on the
# cable box
change_SIGNAL($SIGNAL);
}

# Do we need to send enter
if ( $needs_enter )
{
system ("$rc_command SEND_ONCE $remote_name ENTER");
}

--- End Script ---

If your set top box needs an enter key pressed after a channel is entered, change the appropriate value to "1" in the script instead of "0" ... For Dish Network, 0 works fine.
Step Five

Test your script. Simply do a "./change_channel xxx" where xxx is a valid channel number on your set top box. With a little luck, your set top box will change channels.

If your script changes the channel without issue, you're set. Now just tell MythTV to use the script when it needs to change the channel. Run mythtv-setup and go to the Input Connections and in the appropriate tuner fill in the blank for the script to change channels. Just put "/usr/local/bin/change_channel" and MythTV will automatically append the channel number each time it is needed.
Stop here unless you have more than one tuner
Step Six

If you have more than one tuner, you'll need to create a seperate PID for the second PVR-150 card. You do NOT need a seperate configuration file. If you only have one tuner, what are you doing reading this section? :)

Creating the second PID is rather simple. This command will start another process of lircd without affecting the first.

/usr/sbin/lircd --device=/dev/lirc1 --output=/dev/lircd1 --pidfile=/var/run/lircd1.pid

This is dependant on the fact that /dev/lirc1 is already created -- If KnoppMyth was installed properly, it should have already detected your second PVR-150 and created that device. If this command worked properly, you should now see a /dev/lircd1 device.
Step Seven

Now you need to create a separate change channel script for this tuner. Just copy the change_channel script you created above to something such as change_channel_1 and do a chmod +x on it as well. Edit the file and change the $rc_command line to this:
$rc_command = "/usr/local/bin/irsend --device=/dev/lircd1";
Step Eight

Tell the second tuner to use this script when changing channels the same way we did in Step Four above
Step Nine

Now you probably want KnoppMyth to start the second instance of lircd on boot. To do that, create /etc/init.d/lirc1 and include these 2 lines:
#! /bin/sh
/usr/sbin/lircd --device=/dev/lirc1 --output=/dev/lircd1 --pidfile=/var/run/lircd1.pid

Do a chmod +x on this file and now tell the system to export it to all run levels by doing "update-rc.d lirc1 defaults".
--
Howto by bibleboy @ 3:31am EDT 07/07/06
Edited by Bigbro @ 16:50 PT 09/18/06 -Fixed the ARG statement syntax.
Wikimarkup made the bracket 0 bracket appear incorrectly.
inserted a tilde infront of first bracket. Works with R5C7!
Edited by RBucci @ 7:59 ET 10/15/07 - Added new Step 1 for R5F27.

Labels: ,

Reference Link


Sunday, September 09, 2007

MythArchive on a seperate front end machine

Apparently MythBuntu (and MythTV under Ubuntu) will only support MythArchive if it is on the same machine as the backend. Basically, if you have a backend only machine you are unable to burn your recordings to a DVD from your front end machine. There is currently a bug open (118700) but, sadly, it doesnt seem like anyone has an interest in fixing it soonish. The good news is there is a very easy solution to the problem.

First, mount your recordings directory from your backend server on to your front end machine. This requires installing nfs.

apt-get install nfs-user-server
nano /etc/exports


Add this line: /var/lib/mythtv/recordings 192.168.1.5(ro)
(Make sure you replace the IP address with your front end's IP)

/etc/init.d/nfs-user/server restart

Now you need to mount that on your front end machine.

apt-get install nfs-client
nano /etc/fstab

Add this line: 192.168.1.3:/var/lib/mythtv/recordings /mnt/recordings nfs
(Replace that IP address with your backend's IP; Make sure /mnt/recordings exists)

mount -a

Now you need to add an entry to the mythconverg database. You can do this from either machine.

mysql -h 192.168.1.3 -u mythtv -p mythconverg
(Replace the IP with your database server - usually same as your backend)

Now you need to run this command at the mysql prompt:

insert into settings (value, data, hostname) VALUES ('RecordFilePrefix', '/mnt/recordings', 'myth-frontend');
(You'll need to change myth-frontend to whatever the hostname is of your front end)

That should take care of it
DISCLAIMER: I am not a database guy.... I don't even fully understand what that command does. I am simply taking information from the bug report and putting it in to a step by step list. I can confirm that this worked for me in my situation and it most likely will work for you.

Labels: , ,

Reference Link


Saturday, September 08, 2007

MythMusic with iTunes

Now that I am putting more effort into MythTV being the control of entertainment in my house, I've begun working on the MythMusic application. Currently I use iTunes on my iMac for my music library which syncs with my iPod and scrobbles tracks to Last.fm. The last thing I want is another application that I need to keep synced. Here are things I found to make life a little easier/

Trick #1: Share your iTunes Music folder via NFS

On my Mac I moved my iTunes store folder to /music-lib/ rather than the directory it uses by default. My primary reason for doing this was nothing more than the default folder contains a space in the name and this makes things a little harder for NFS. Once all your MP3 files are there, we need to set up the NFS share.... which really isn't all that hard. I used the following guide to do this:
http://mactechnotes.blogspot.com/2005/09/mac-os-x-as-nfs-server.html

Note: On Windows you could substitute this process to use Samba and adjust accordingly

Now you need to mount that share on all applicable MythTV machines. Currently I use Mythbuntu and I have a primary backend machine and 2 front end only machines. First thing you'll need to do is "apt-get install nfs-client" to allow Mythbuntu to connect to an NFS share. Once that's installed, create an empty directory to mount your music in. I created /mnt/music/ for my systems. Now add the following line into your /etc/fstab file on all of your myth machines:

SERVER:/music-lib /mnt/music nfs
(Substitue SERVER with your iTunes' machines IP address and adjust the share names as needed)

Now what's left is to go into the mythmusic settings and change the recordings directory to /mnt/music.

You're ready to listen to music!

Trick #2: iTunes Playlists

So MythMusic has an extreme lack of intuitive playlist editting.... actually, you can't even call it a playlist editor. I want an easy was to use my iTunes playlists. Two people have done an amazing job at a perl script that takes care of a conversion and imports the iTunes playlists into your mythconverg database.

http://www.mickelson.org/2006/11/07/mythmusic-mac-os-x-and-itunes/
http://simonster.com/mt/archives/000038.html

Grab that perl script and throw it on the machine that serves as your mythtv backend. On mythbuntu you need to install XML:Parser which can be done by "apt-get install libxml-parser-perl". Edit the variables at the top of that script and do a chmod +x on the perl script. If you have multiple machines, you will need to run the script different times with the hostname set as each of the myth machines you want the playlists to be active on.

Before you run that script, you need to make sure the iTunes library XML file is in your music-lib directory. I renamed mine to exclude spaces and then copied it to the music-lib directory on my iMac.

Run the script and you should now have playlists in MythMusic.

Trick #3: Automate Trick #2

I have a lot of smart playlists and I am often creating new playlists and, of course, always adding new music to my library. I don't want to have to do this everytime I make an update so I automated the process. I created a script on my iMac to copy the "real" iTunes XML file into the music-lib directory every hour. OSX has dropped the use of cron and replaced it with launchd. Here is a guide you can use to get this set up:
http://www.macdevcenter.com/pub/a/mac/2005/11/15/terminal5.html?page=3

Once that's set up, you need to set up a crontab on your myth system(s) to run the perl script. If you do this hourly, make sure you set your iTunes computer to copy the file before the crontab runs on your myth machines. For instance, make your itunes machine run on minuet 05 and the myth machines run on 08.

Now you're set.... things should automatically update for you.

Trick #4: Scrobble to your Last.fm account

I use Last.fm an awful lot and if I start using MythMusic over iTunes, I lose that scrobbling. I have not completed this yet (or even really began looking at it) but here is a link where you can get a patch. I need to figure out how to apply this on an active mythbuntu system. I'll report back when/if I come up with something :)

http://yaron.org/mythscrobbler/

Labels: , , , , , ,

Reference Link


Tuesday, September 04, 2007

Mythbuntu: My new favorite MythTV solution

As much as I love KnoppMyth and it's ease of installation I have constantly ended up haunted by the lack of upgradeability. If you even think about using apt-get, the system cries and stops working. It's an amazing distro but if you run into a problem with it not playing nicely with some hardware device you have or you get a cool idea that you want to implement, you're most likely going to render your box useless once you start tinkering.

So I installed Mythbuntu last night and.... WOW. I ran into a hardware incompatibility with the new machine I was building. I have a dual opteron 246 mainboard that I wanted to use as my mythbuntu system but the issue was with compatibility with PCI-X and PVR-150's. I have 2 of the older PVR-150 retail versions (these are the cards that the new knoppmyth and it's ivtv version were having issues with) and a PVR-150 MCE version. I also have a Chaintech 710 sound card (*HIGHLY* recommended by me for anyone who wants 5.1). The mainboard only has 1 32 bit (5v) slot and the sound card runs only at 5v. All of the PVR-150's run at either 3.3v or 5v but there is apparently something in the chipsets of the PVR-150 retail versions that make them inoperable in a PCI-X slot. The MCE version works fine so I had a choice of either my chaintech card or a second tuner because the PVR-150 Retails would work fine in the 32 bit slot but the machine wouldnt boot if they were in a PCI-X slot. I have a Sound Blaster Live card so I figured I'd try it and it worked until I wanted to do the digital 5.1 and then hell broke lose which is the same results in ANY distro including KnoppMyth..... so I opted to make that my server and build a seperate front end machine.
Note: Hauppauge will apparently update your PVR-150 to work with PCI-X but who has time for that? :P See this link.)

I can not tell you how easy the install was. In Mythbuntu you can select advanced configuration and select any configuration you want. You have options of the following:


  • Master backend and Front end
  • Secondary backend and Front end
  • Master backend only
  • Secondary backend only
  • Front end only


In all of these configurations, the plugins are installed and 100% working..... installation of the frontend machine asks you for the address and login information for the primary backend and.... it's running.

One thing even more amazing about Mythbuntu.... since I wasn't going to have any PVR-150's in my front end, the use of my Hauppauge remote control wasn't an option. Years ago I bought a StreamZap USB remote control which I previously tried to use on KnoppMyth and I eventually gave up. I decided I'd fight with it in this scenario and dug it out of the "archives" .... Mythbuntu asked me what remote I had and StreamZap was actually an option. When the system booted the remote worked without a single bit of configuration from me. The only thing that I think I need to do is configure the red button for delete like my Hauppauge remote was.... other than that, it's working great even in the DVD program.

Mythbuntu also puts the display to sleep automagically.... if you're sitting at a menu for a while, the screen will go into sleep mode and as soon as you press a button on the remote it will turn back on. This is a huge advantage for me because there are times I'll fall asleep while watching TV and the fact that my 19" CRT is going to sleep is a great savings in energy costs.

Another thing is the DVD player. I adjusted my general settings to use /dev/adsp for the SPDIF port and I figured I'd have to set up the DVD seperately.... I put a DVD in to see what state it was in and not only did my audio come out of the SPDIF optical port but my receiver went to digital mode..... Mythbuntu handles everything with the DVD player internally so there aren't any options that you need to pass... it's very impressive.

For everyone's reference, here is my configuration

  • Server:
    • Tyan S-2882D Mainboard
    • (Qty: 2) Opteron 246 - 2ghz
    • 4GB DDR333 Crucial (128bit mode)
    • 3ware 7500-8 Raid Controller
    • (Qty: 8) 250GB Western Digital SATA drives (Raid 5)
    • Hauppauge PVR-150 Retail version (26052)
    • Hauppauge PVR-150 MCE

  • Front End:
    • Intel 815 Server Board
    • Pentium 3 @ 1.2ghz
    • 512MB PC133 Ram
    • 40GB IDE Seagate
    • Lite-On DVD Burner
    • Chaintech AV-710 with optical out
    • StreamZap USBIR2 Remote Control


I really like the front end being the configuration it is. I was a bit concerned about the Pentium 3 with only 512MB of RAM (thats all the 815 chipset supports) but it runs incredibly smooth.... the network keeps up, the CPU keeps up.... no slow downs at all. The best part about it is all it has is a VERY low speed fan on the power supply and a cpu cooler.... the box makes almost no noise at all. Right now the server is sitting next to eat but I will be moving that to my crawlspace eventually and it should get really quiet in my living room :)

Here are some URLs for anyone interested in some of the things above:

  • http://techgage.com/article/chaintech_av-710_71_sound_card/ (Chaintech AV-710)

    • I really can not recommend this card highly enough. It worked flawlessly on my KnoppMyth box as well as this Mythbuntu box. The quality is amazing.... and the Envy24 chipset is so much enjoyed by linux distros. If you're just getting into MythTV I would highly recommend not even thinking about touching a Creative Labs sound card (that is, if you want anything more than standard 2 channel). Their chipsets are a 3 ring circus and it's always a nightmare

  • StreamZap USB Remote control
  • Mythbuntu
    • My installation was based on Alpha 4..... so far I have seen no reason why this is still considered Alpha.... I havent run into an issue yet.


Keep in mind I have only been running this set up for 24 hours but I have had a very large queue of recordings and I'd say more than half of that time the system was recording two shows at the same time. I haven't tested all of the plug ins yet (like mythweb, archive, etc) but from navigation it appears they are installed and operating.

Overview

  • Installation is quite easy. KnoppMyth may be a touch easier for someone who hasn't a clue about linux but if you know even a tiny bit of computer hardware and the ideas behind the OS, this is a piece of cake.
  • MythBuntu has a sleep function for the monitor out of the box
  • Mythbuntu has a front end only installation option as well as a front end live CD option
  • Mythbuntu is designed from the ground up to be placed in multiple machine configurations. Having mutliple backends and frontends is a breeze
  • Using 5.1 optical on the Chaintech is as simple as changing your audio device in myth setup to /dev/adsp - and it takes it from there (including DVD player)
  • The base system is 100% Ubuntu and is designed with the Ubuntu repositories in mind. Updating packages appears to be no issue at all.
  • Supports my StreamZap USB remote which I previously had not been able to get to work easily
  • Gives you the option to set up VNC access during the install
  • Allows you to select plugins rather than forcing you to install all of them


There is no doubt that this is now my MythTV distro of choice. MythDora has got some great reviews but I'm not such a fan of RPM based distros so when looking for a KnoppMyth replacement I decided to try Mythbuntu - and I'm glad I did.

Please keep in mind that KnoppMyth is still considered a great distro to me. It works flawlessly in what it does but I just sometimes feel trapped by it. That trapped feeling is a trade off, however, as it is designed with the widest automatic support of hardware and it can generally have you set up and running without many technical questions at all.

As far as I'm concerned, KnoppMyth, Mythdora, and Mythbuntu are all very great options but I think Mythbuntu fits into my scenario (as well as many other's) the best.

Labels: , ,

Reference Link


Thursday, August 02, 2007

KnoppMyth SPDIF in Xine with Chaintech

Reference Version: R5F1

After doing a lot of searching to try to find the solution to this problem, it turns out it is a really simple one. I have a KnoppMyth system set up that I am using a ChainTech AV710 sound card on (I give high recommendations to this card) and I configured MythTV to use SPDIF to get audio output but simply changing my audio output device from /dev/dsp to /dev/adsp and everything worked a-OK except for playing DVDs. I tried playing with the settings in Xine to get it to work and I couldn't obtain ANY audio (5.1 or not). After doing some googling on the subject, I found a HOWTO over at the Ubuntu forums and the solution was quite simple.

For the applicable output devices, simply use "plug:iec958" and select the speaker configuration as pass through.

Thats it, your done. Restart Xine and all should be merry. As soon as I started playing a DVD I didn't just have audio but my receiver's little DIGITAL light came on.

Labels: , , , , ,

Reference Link