Difference between revisions of "User:Keithamus"

From MythTV Official Wiki
Jump to: navigation, search
(We don't support torrents here)
Line 129: Line 129:
==Scripts I have made to easy mythtv management==
==Scripts I have made to easy mythtv management==
I have a script to automatically name shows downloaded from bit-torrent. The script takes a list of files as arguments, and parses them for naming conventions, and then moves them to a well structured folder; for example it'll move The.IT.Crowd.S03E06.WS.PDTV.XviD-RiVER.[VTV].avi to /var/lib/mythtv/videos/TV/The IT Crowd/Season 3/06 - Episode Title.avi. I have this set up on my crontab so it'll check my "completed torrents" directory every half hour. It should be pointed out, that the script also creates a symbolic link back to the original location, so the file can still continue to be seeded.
# Set to a directory where you want the files to remain, for example /var/lib/mythtv/videos/
for file in "$@"; do
if [ ! -L $file ]; then
echo "$file..."
#Get the showname from the filename
SHOWNAME="" A="" B=""
SHOWNAME="`basename $file | sed 's/.[sS][0-9].*//' | sed 's/\./ /'`"
for i in $SHOWNAME; do B=`echo "${i:0:1}" | tr a-z A-Z`${i:1}; A="$A $B"; done
if [ -n "$SHOWNAME" ]; then
echo "Its $SHOWNAME"
        #Get the season number from the filename
        SEASON="`basename $file | grep -o ^.*[sS][0-9][0-9] | sed 's/.*[sS]//' | sed 's/^0//'`"
        if [ $SEASON -eq $SEASON 2> /dev/null ]; then
                echo "Season $SEASON"
                #Get the episode number from the filename
                EPISODE="`basename $file | grep ^.*[eE][0-9][0-9] -o | sed 's/.*[eE]//'`"
                if [ $EPISODE -eq $EPISODE 2> /dev/null ]; then
                        echo "Episode $EPISODE"
                        #Get the file extension
                        EXT="`echo $file | awk -F . '{print $NF}' | sed 's/^ *//;s/ *$//' `"
                        if [ -n "$EXT" ]; then
                                echo "An $EXT file"
                                #Get the series ID from thetvdb.com
                                SERIESID="`wget -qO- $URLID | awk '{ str1=str1 $0 }END{ print str1 }' | sed "s/<SeriesName>$SHOWNAME<.*//" | sed 's/.*<seriesid>//' | sed 's/<.*//' | awk '{ str1=str1 $0 }END{ print str1 }'`"
                                if [ $SERIESID -eq $SERIESID 2> /dev/null ]; then
                                        echo "TheTVDB series id is: $SERIESID"
                                        #Using seriesid, season, and episode, query thetvdb.com for the episode name
                                        EPNAME="`wget -qO- $URLID | awk '{ str1=str1 $0 }END{ print str1 }' | sed 's/.*<EpisodeName>//' | sed 's/<.*//'`"
                                        if [ -n "$EPNAME" ]; then
                                                LEN="`expr length $EPISODE`"
                                                if [ $LEN -eq 1 ]; then
                                                echo "Moving $file to $BASEDIR/$SHOWNAME/Season $SEASON/$EPISODE - $EPNAME.$EXT"
                                                mv "$file" "$BASEDIR/$SHOWNAME/Season $SEASON/$EPISODE - $EPNAME.$EXT"
                                                ln -s "$BASEDIR/$SHOWNAME/Season $SEASON/$EPISODE - $EPNAME.$EXT" "$file"

Revision as of 19:48, 9 April 2009


I currently have a single system setup, a front/back end, for SD/HD use.


The Asus Pundit P1 in White
  • Asus Pundit P3-PH5X
  • Intel Core 2 Duo E2160 1.8ghz - Stock cooler
  • 2048MB RAM
  • 500GB Samsung Spinpoint drive
  • Hauppauge WinTV Nova-T 500 PCI dual DVB-T tuner
  • ATi Radeon HD 3450 256mb Low Profile Passive PCIE XFX nVidia 8300GS 256mb Low Profile PCIE (I strongly advise anyone to avoid ATi, they are nightmarish)
  • Mythbuntu 8.04

Why I chose this system

  • The whole system was very cheap, around £200 ($400).
  • It has quite a small footprint, although much bigger than a set-top-box, it is no way as big as a desktop case.
  • It looks quite stylish, which is always good for the WAF
  • It'll run HD content.
  • I chose the cheapest Core2Duo I could find. Any Core2Duo PC should be able to run atleast 720p content. Although dedicated HD graphics is recommended.


  • The Pundit P3 is a low profile system, as such, you'll need low profile cards. The Nova T 500 is not a low profile card, so you'll have to remove the PCI plate, and have the card lose in the slot (this is not desirable, as the card can easily become de-seated!) support@hauppauge.com will send you out at blanking plate, don't expect any correspondance, I tried several times asking about it, then finally just emailed my address over in the hopes of getting it, and 2 days later a blanking plate was in the post!
  • The system isn't as quiet as I'd like - the stock cooler is quite whiny, and the stock case fan (attached with only 1 screw!) is very loud. Getting a good Scythe fan or two would definitely be recommended. With stock cooling the air runs cold - so you could probably get away with a small heatsink over the CPU and a good, quiet case fan.
  • Still having slight problems with Mythbuntu. Overall I would say the system is worth it, but has its annoyances.

Real world figures

In terms of crunching power, wattage and temperatures, this system really can't be complained about;

  • I've been able to record 2 channels and watch HD-720p content with NO lag. Even with integrated graphics.
  • 500GB is a hefty size for storing data. It'll easily store more content than you're likely to watch. Having said this, I'm beggining to run out of space, and 1TB is about £70, so cheap enough for consideration!
  • 1024mb seems to be enough. I would consider upgrading this if you have a bit more spare cash.
  • Because its a relatively "slow" core 2 duo, its cold to the touch - with the stock cooler, but more than capable of running 720p

Notes on getting Mythbuntu working properly

Hard Drive optimisation

A good partition setup is as follows:

  1. 20gb / ext3
  2. 1GB SWAP (make this the same as the installed memory for easy sleep/hibernation)
  3. Rest as /var/lib/ xfs

I would recommend setting the noatime and nodiratime options to your drives, for less intensive harddisk access. To do this, go to your /etc/fstab which may look like this, for example:

# /dev/sda1
UUID=6e039164-c59f-49f1-9b96-e658a24aac2d /               ext3    errors=remount-ro 0       1
# /dev/sda3
UUID=d8af15ba-f63e-465d-848e-9c8d3d020e4a /var/lib        xfs     relatime        0       2
# /dev/sda2
UUID=07a339be-0944-4a04-a71a-9b1e173cbb6e none            swap    sw              0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto,exec,utf8 0       0

Change this file to look more like this:

# /dev/sda1
UUID=6e039164-c59f-49f1-9b96-e658a24aac2d /               ext3    noatime,errors=remount-ro 0       1
# /dev/sda3
UUID=d8af15ba-f63e-465d-848e-9c8d3d020e4a /var/lib        xfs     noatime,nodiratime,logbufs=8        0       2
# /dev/sda2
UUID=07a339be-0944-4a04-a71a-9b1e173cbb6e none            swap    sw              0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto,exec,utf8 0       0

Fixing LIRC for Hauppauge remotes

Mythbuntu uses the incorrect lircrc for the Hauppauge remote, you should copy and paste the one from the Hauppauge WinTV Nova-T 500 PCI page. Save this as ~/.lircrc and make links from this to ~/.mythtv/lircrc and ~/.lircrc/mythtv

Another annoying problem stems from the "events" on the system. These don't stay put, so on one boot you'll have your receiver on event6, the next, it'll be event3. Obviously Lirc can't magically detect this for you, but luckily, other system processes can.

First you want to find the event the receiver is currently running on:

cat /proc/bus/input/devices | grep -iA4 receiver

Now, run the following command:

udevinfo -a -p $(udevinfo -q path -n /dev/input/[OUTPUT_FROM_ABOVE_COMMAND]) | grep -i vendor

Hopefully you'll get one line saying "SYSFS{vendor}="0x99999" or something to that effect, if you get more than one, then usually its the first you need. Now, using your favourite editor, open /etc/udev/rules.d/10-local.rules:

sudo mousepad /etc/udev/rules.d/10-local.rules

Add the following line:


Obviously this is bit you replace 0x99999 with the code you received from one of the above commands. Once this is done, restart the udev server:

/etc/init.d/udev restart

And voilas. To test, you can check the listing of lirc0;

ls -la /dev/lirc*

It should output "lirc0 --> event6" or whatever your receivers eventid is.

For reference: /etc/lirc/hardware.conf

# /etc/lirc/hardware.conf
REMOTE="Hauppauge TV Card"
REMOTE_MODULES="lirc_dev lirc_i2c"


Recommended extra packages

If using wireless, install WICD!, this will enable mythbuntu to silently connect to your wireless network, without nagging you for keyrings, or d/cing after a sleep. To do this; add

#WICD, Wireless network manager
deb http://apt.wicd.net hardy extras

to your /etc/apt/sources.list file. From this point, just run "sudo apt-get install wicd" and you should be good to go; you might need to add /opt/wicd/tray.py to your startup programs, to get a tray icon.

Also perhaps add wine, depending on how you use the machine, I personally run some windows games I own, so wine is helpful:

# Wine
deb http://wine.budgetdedicated.com/apt gutsy main
deb-src http://wine.budgetdedicated.com/apt gutsy main

Then apt-get install wine!

Mysql Crashing

It would be a good idea to get mythbuntu to repair the tables on reboot. Having to manually repair the tables when the box crashes is annoying, so why not automate. Add this to your system startup, whichever way you prefer:

mysqlcheck -umythtv -pPASSWORD --auto-repair mythconverg

Scripts I have made to easy mythtv management