My ongoing experiences with Ubuntu, and later Mythbuntu, as a media center with MythTV. I'm also using the system for a virtual machine server, a mediawiki server and a general all around home infrastructure base.

Showing posts with label mythtv. Show all posts
Showing posts with label mythtv. Show all posts

Tuesday, June 8, 2010

Back in the saddle again with Mythbuntu and HDTV OTA...

Well, after deciding I didn't need MythTV any more, I've changed my mind. Mainly because we dropped cable tv and are now relying on over the air (OTA) HDTV, so my old Series 1 Tivo, with only an analog tuner, doesn't do me a lot of good any more.

So, I bought a Hauppauge HVR-1600 (model 1099) with the idea of running MythTV again, this time tuning in OTA HDTV. I've going to install Mythbuntu 10.04 from scratch and go from there.

Stay tuned...

Thursday, May 28, 2009

MythTV Volume too low

I noticed the volume on MythTV seemed rather low. Poking around the net I found this thread and followed the directions as follows:
% alsamixer
And set Master and PCM volume to 100% (Master was down at 70%). That fixed my problem.

Then as suggested later in the thread, I saved the results (has to be done as root):
% sudo alsactl store

Saturday, March 7, 2009

Fixing MythTV Database: Table './mythconverg/credits' is marked as crashed

My MythTV box became unresponsive earlier this week, prompting a power cycle. It seemed to come back up OK, except a cron job was spitting out the following email every 10 minutes:
DBD::mysql::st execute failed: Table './mythconverg/credits' is marked as crashed and last (automatic?) repair failed at /usr/share/perl5/MythTV/
Program.pm line 195.
DBD::mysql::st fetchrow_array failed: fetch() without execute() at /usr/share/perl5/MythTV/Program.pm line 196.
I tried backing up the database manually and got a similar error:
#/etc/cron.weekly/mythtv-database
mythconverg.credits
warning : Table is marked as crashed and last repair failed
warning : 1 client is using or hasn't closed the table properly
error : Found 123809 keys of 124267
error : Corrupt
mysqldump: Got error: 144: Table './mythconverg/credits' is marked as crashed and last (automatic?) repair failed when using LOCK TABLES
Using google turned up the solution. But I didn't find the optimize_mythdb.pl script where the poster indicated. I did find it elsewhere, copied it over and set permissions on it:
# mkdir /usr/share/mythtv/contrib
# cp /usr/share/doc/mythtv-backend/contrib/optimize_mythdb.pl /usr/share/mythtv/contrib
# chmod 755 /usr/share/mythtv/contrib/optimize_mythdb.pl
At this point I was able to run the script as the poster indicated:
# /usr/share/mythtv/contrib/optimize_mythdb.pl
Repaired/Optimized: `mythconverg`.`archiveitems`
Analyzed: `mythconverg`.`archiveitems`
....snip...
Now the backup script ran cleanly:
# /etc/cron.weekly/mythtv-database
#
The last thing I did, as the comments in the optimize_mythdb.pl script suggest, was add the script to the daily anacron list (update March 15, 2009: anacron apparently doesn't run scripts with a .pl suffix, so need to link this to a filename without the suffix):
# ln -s /usr/share/mythtv/contrib/optimize_mythdb.pl /etc/cron.daily/optimize_mythdb

Saturday, January 31, 2009

MythTV and disk management

Just a quick note that I've watched MythTV manage the disk space I've allocated it and it seems to do a good job without any help from me. Logwatch sends me a daily email with the disk allocation, so I watch how MythTV handles things. I have allocated two disks partitions to MythTV, and while they are constantly almost full (with logwatch giving me the warning you see below), MythTV deletes old stuff deletes old recordings before anything becomes a problem.


--------------------- Disk Space Begin ------------------------

Filesystem Size Used Avail Use% Mounted on
...
/dev/sda6 183G 170G 3.0G 99% /mnt/data
/dev/sdb3 220G 203G 6.6G 97% /mnt/data2

/dev/sda6 => 99% Used. Warning. Disk Filling up.
/dev/sdb3 => 97% Used. Warning. Disk Filling up.

---------------------- Disk Space End -------------------------

Sunday, October 12, 2008

MythMusic

Just a quick entry about getting music playing working on MythBuntu. Basically just follow the directions at the MythTV MythMusic page.

Some configuration I did:
  1. Under Utilities/Setup->Setup->Media Settings->Music Settings ->Player Settings->screen 1 check "show entire music tree"
  2. On screen 3 set up some vizualizers
  3. Under Utilities/Setup->Setup->Media Settings->Music Settings ->Ripper settings->screen 2, set the following:
    • Encoding: Lame (MP3)
    • Default Rip Quality: Medium
    • Enable "Use variable bitrates"
That's it for playing. I still can't import CD's at this point - it causes mythtv-frontend to crash! Looks like this bug.

Adding more space for MythTV

I noticed that my mythtv data directory was almost full:
# df | grep data
/dev/sda6 190957912 176125932 5208248 98% /mnt/data


Since I had 256GB of disk I wasn't using, I decided to add that as a second data directory for MythTV. So I mounted this partition as /mnt/data2 and then created /mnt/data2/mythtv

I then made sure mythtv owned the new directory:
# chown mythtv:mythtv /mnt/data2/mythtv


Then I added this directory to the default MythTV storage group, which was the usual MythTV menu hell:

  1. Select "Utilities/Setup"

  2. Select "Setup"

  3. Select "MythBuntu" and enter root password when prompted

  4. Select "MythTV Configuration"

  5. Select "Launch MythTV Setup"

  6. Select "Storage Directories"

  7. Select "Default"

  8. Select "Add New Directory"

  9. Enter the name of the new directory (e.g. "/mnt/data2/mythtv")

  10. Hit Escape 3 times to start exiting out

  11. At this point I was presented with a warning that *none* of my mythtv data directories were writable. After double checking that I entered it right and that the directories were actually writable by themythtv user, I selected "No, I know what I'm doing"
  12. Continue to exit out of menus by selecting "OK"

  13. I canceled running mythfilldatabase

  14. At this point things seemed to hang for 20-30 seconds with me just starting at a blank MythTV background. I think you just wait it out. I hit escape a couple times, but don't know that actually did anything.

  15. Select "Quit"

  16. Hit Escape until you get back to the top-level MythTV menu and then select "Information Center"

  17. Select "System Status"

  18. Under "Machine" you should now see the second directory listed.

Wednesday, September 24, 2008

MythBuntu MythTV Tweaks

After getting MythBuntu installed, I did the following tweaks to MythTV:
  • Disabling DPMS (screen power saver): Previously I did it with the session manager, but Mythbuntu doesn't have the equivalent. So based on this thread, I did the following:
    $ vi ~/.xsessionrc
    $ cat ~/.xsessionrc
    xset s noblank
    xset s off
    xset -dpms
    Now restart desktop so changes take effect
    $ sudo /etc/init.d/gdm restart
    Updated Oct 24, 2008: I later also disabled the gnome-screensaver
  • I was still getting commercials during playback of recorded shows. Poking around it seemed like all the options for commercial remove were select, but then I found under Utilities/Setup -> Setup -> TV Settings -> Playback on screen 8 "Automatically Skip Commercials" which I set to "Automatically Skip"
  • I wanted my familiar Blootube theme back. I found this under Utilities/Setup -> Setup -> Appearance on screen 1.
  • I wanted channel changing during live TV to take effect immediately. This was done with a combination of two options: Utilities/Setup -> Setup -> TV Settings -> General screen 1, select "Change channels immediately without select", and Utilities/Setup -> Setup -> TV Settings -> Playback OSD screen 1, unselect "Always use Browse Mode"
  • Under Utilities/Setup -> Setup -> TV Settings -> Playback, screen 2, I set "Action on playback exit" to "Save Position and exit" and "Prompt at end of Recording".
  • Configured MythFillDatbase to run automatically. Utilities/Setup -> Setup -> TV Settings -> General screen 6, enable "Automatically run mythfilldatabase". For "Arguments" I used "--refresh-all --quiet" and for "Log Path" I used "/tmp/mythfilldatabase.log". Everything else I left as is.
  • Next I wanted to get the extra buttons on my remote working. So under Utilities/Setup -> Edit Keys I bound keys to the various screens I wanted shortcuts to under "JumpPoints". (Hint: to jump to the "Watch Recordings" screen, use the "TV Recording Playback" action as the target.)

    A hint, run "irw" as root and press keys on your remote to figure out their names, e.g. the following shows me pressing the Blue and Go keys:
    # irw
    00000000000017a9 00 Blue Hauppauge_350
    00000000000017a9 01 Blue Hauppauge_350
    00000000000017a9 02 Blue Hauppauge_350
    00000000000017bb 00 Go Hauppauge_350
    00000000000017bb 01 Go Hauppauge_350
    00000000000017bb 02 Go Hauppauge_350


    The I edited ~/.lirc/mythtv and bound the remote commands to those keys (the "config" option).
    $ cd ~/.lirc
    $ cp mythtv mythtv.orig
    $ vi mythtv
    $ diff -c mythtv.orig mythtv
    *** mythtv.orig 2008-09-24 21:05:35.000000000 -0500
    --- mythtv 2008-09-24 21:39:34.000000000 -0500
    ***************
    *** 733,738 ****
    --- 733,774 ----
    begin
    remote = Hauppauge_350
    prog = mythtv
    + button = Blue
    + config = d
    + repeat = 0
    + delay = 0
    + end
    +
    + begin
    + remote = Hauppauge_350
    + prog = mythtv
    + button = Videos
    + config = r
    + repeat = 0
    + delay = 0
    + end
    +
    + begin
    + remote = Hauppauge_350
    + prog = mythtv
    + button = TV
    + config = l
    + repeat = 0
    + delay = 0
    + end
    +
    + begin
    + remote = Hauppauge_350
    + prog = mythtv
    + button = RED
    + config = m
    + repeat = 0
    + delay = 0
    + end
    +
    + begin
    + remote = Hauppauge_350
    + prog = mythtv
    button = 7
    config = 7
    repeat = 0

    Next I tried restarting lirc:

    sudo /etc/init.d/lirc restart

    But that just caused my remote to stop working with mythtv all together, so I rebooted and all worked fine.


Wow, if it is possible for something to have too many options, MythTV is guilty...

Wednesday, September 3, 2008

Running MythWeb remotely



DO NOT FOLLOW THESE DIRECTIONS: They've messed with my MythTV install, causing it to become unstable and forget all its recording scheduling information.
I strongly suspect it has to do with the database tweaking I did at the end, but I'm not going to try and fix it. I'm just going to run MythWeb locally, probably on a fest mythbuntu install.



This describes my installation of MythWeb on a server (192.168.1.11) that was separate from the system running my MythTV front end, back end and mysql database (192.168.1.10)

First, on the mythtv system, configure MySQL to accept remote connections:

# grep bind /etc/mysql/my.cnf
bind-address = 0.0.0.0
# /etc/init.d/mysql restart
* Stopping MySQL database server mysqld [ OK ]
* Starting MySQL database server mysqld [ OK ]
* Checking for corrupt, not cleanly closed and upgrade needing tables.


Now create a mythweb user in the mysql database. Replace "XXXXXXXX" here with an actual password you'll use again later. (I think you could get away with skipping this step and then using the mythtv user later. I'm also not sure you need to "grant all" permissions.)

# mysql --user=root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 163
Server version: 5.0.51a-3ubuntu5.2 (Ubuntu)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> grant all privileges on mythconverg.* to mythweb@192.168.1.11 identified by 'XXXXXXXX';
Query OK, 0 rows affected (0.06 sec)
mysql> select host,user from user;
+--------------+------------------+
| host | user |
+--------------+------------------+
| 192.168.1.11 | mythweb |
| casey | root |
| localhost | debian-sys-maint |
| localhost | mythtv |
| localhost | root |
+--------------+------------------+
5 rows in set (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.04 sec)


Mythweb uses the MasterServerIP value from the settings table to find the backend. In my case this was set to 127.0.0.1, which was fine if Mythweb is on the same system, but breaks things if they are are different systems. So change that to tell mythweb where to find the mythtv back end:

mysql> update settings set data='192.168.1.10' where value='MasterServerIP';
Query OK, 1 row affected (0.02 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> select data from settings where value='MasterServerIP';
+--------------+
| data |
+--------------+
| 192.168.1.10 |
+--------------+
1 row in set (0.00 sec


Ok, now on web server system install mythweb:

# apt-get install mythweb


And tell mythweb where to find the mysql database. Replace 'XXXXXXXX' here with the password for the mythweb user you created in the mysql database previously. (If you skipping creating the mythweb user earlier, this is where you would put in your mysql mythtv login and password instead.)

# cd /etc/apache2/sites-available/
# vi mythweb.conf
# grep db_ mythweb.conf
setenv db_server "192.168.1.10"
setenv db_name "mythconverg"
setenv db_login "mythweb"
setenv db_password "XXXXXXXX"
# apache2ctl restart


And things should be working. Don't forget to require authentication.

Saturday, April 26, 2008

Updated mythfilldatabase cron job

Based on this post I changed my crontab entry to:
0 6 * * * /usr/bin/mythfilldatabase --refresh-all --quiet

Saturday, September 8, 2007

Updating MythTV to use Schedules Direct

I needed to upgrade to MythTV 0.20.2 to use Schedules Direct. I started by following the directions in http://ubuntuforums.org/showthread.php?t=536555 to upgrade.

Then to use Schedules Direct I following the directions at
http://www.mythtv.org/pipermail/mythtv-users/2007-August/191369.html , with my annotations as sub-bullets:
  1. Go to Schedules Direct and create lineups from the identical provider with the identical set of channels as your existing labs account. [Hint: if you see channels you would like to add or delete, keep them the same for now and fix those problems after converting].
  2. Shutdown all myth processes.
    1. Exit the frontend.
    2. Execute:
      /etc/init.d/mythtv-backend stop
  3. Backup your mysql database as described in the HOWTO.
    1. Execute:
      mysqldump -u mythtv -pmythtv mythconverg -c > mythtv_backup.sql
  4. Run mythtv-setup. Select your existing video sources to change the grabber and login info, "Retrieve Lineups", select the corresponding lineup name then "Finish".
  5. Run mythfilldatabase checking the log to see that things worked correctly.
  6. Restart myth processes.
    1. I just rebooted.

Sunday, July 8, 2007

Updating Guide information

I let my zap2it subscription lapse and then my MythTV PC was off for a few days (power glitch while I was traveling) and I noticed that it was completely out of guide information. So I started by renewing my zap2it subscription (and noticed that after September 29th, another source would need to be found for guide information).

But still I wasn't getting new guide information after a couple days, so I wondered how to manually pull down new guide information. Poking around the net I found this link which gave the following command:
/usr/bin/mythfilldatabase --no-delete
Which I went ahead and added to the mythv crontab:
crontab -u mythtv -e
0 6 * * * /usr/bin/mythfilldatabase --no-delete --quiet

Sunday, May 6, 2007

Automatic MythTV Front End Start on Boot

So I wanted MythTV to start automatically when the system boots. Here are the steps that causes this to work for me.

Under System / Administration select Login Window. Select Security Tab and click "Enable Automatic Login" and select the username for the account you want to run MythTV from. Click Close.

Then, running as the automatic login user from the first step, under System / Perferences select Sessions. Select the Startup Programs tab. Click Add and enter /usr/bin/mythfrontend. Click Close.

Reboot and you should get logging in automatically and MythTV should fire up.

Friday, May 4, 2007

A few other MythTV Configuration Settings

To get channel changing working right:
  • Under "Utilities / Setup" / Setup / TV Settings / General (Basic) set "Change channels immediately without select"
  • Under "Utilities / Setup" / Setup / TV Settings / Playback / View Recordings (Recording Groups) unselect "Show 'LiveTV' recordsings when using "All Programs" filter" and make sure "Default group filter to apply" is "All programs"

Tuesday, May 1, 2007

Blootube-wide MythTV Theme

On the avice of a friend, I added the BlooTube-Wide MythTV Theme:

# cd/tmp
# wget http://downloads.mythtvtalk.com/mythtv/themes/blootube-wide.tar.bz2
# wget http://downloads.mythtvtalk.com/mythtv/themes/blootube-osd.tar.bz2
# cd /usr/share/mythtv/themes/
# tar xvjpf /tmp/blootube-wide.tar.bz2 -C /usr/share/mythtv/themes/
# tar xvjpf /tmp/blootube-osd.tar.bz2 -C /usr/share/mythtv/themes

Then enable it under "Utilities/Setup" / Setup / Appearances / Theme by selecting blootube-wide for Theme and then under "Utilities/Setup" / Setup / TV Settings / Playback / On-screen Display by selecting blootube-osd for OSB theme.

Sunday, March 25, 2007

LIRC and Remote working with Ubuntu and MythTV

Next step was setting up the remote. I have the Grey Hauppauge remote with the 4 color buttons at the bottom, model A415-HPG (confirmed via a sticker inside the battery compartment).

I followed the directions on the LIRC_on_Ubuntu_Edgy_Eft page, with the following exceptions:
  • My lirc device was /dev/lirc/0 and not /dev/lirc0
At this point I fired up the lirc deamons and things seemed to be working in that irw reported key presses (although, yes it was reporting "Hauppauge_350" when I have a 250):
$ irw
00000000000017b7 00 Record Hauppauge_350
0000000000001790 00 Vol+ Hauppauge_350
00000000000017b5 00 Play Hauppauge_350
00000000000017b2 00 Rewind Hauppauge_350
00000000000017a4 00 Replay/SkipBackward Hauppauge_350
00000000000017a4 01 Replay/SkipBackward Hauppauge_350
0000000000001790 00 Vol+ Hauppauge_350
But it still wasn't working with MythTV at this point.

So I poked around on the following sites:
I didn't seem to have lirc support build into MythTV ("native LIRC support"), at least creating a ~mythtv/.mythtv/lircrc file didn't do anything (as described here). I'm not sure how you determine this for certain.

I also didn't have irxevent installed. I figured out I had to install the lirc-x package to get irxevent:
# apt-get install !$
# which irxevent
/usr/bin/irxevent
I then created ~/.lircrc from http://gentoo-wiki.com/HOWTO_Setup_MythTV/Hauppauge_lircrc

Update 4/20/2007:
Looks like adding irxevent to my ~/.xinitrc file doesn't work with Gnome. Instead under System/Preferences select Sessions. Then click on the Startup Programs tab, then Add and enter irxevent --daemon. Then Close.

Back to original text...

At this point I could run irxevent and I could see that IR events were being translated into keystrokes for my Terminal window. I fired up MythFrontend and things sorta worked. By that I mean the arrow keys didn't work for the opening menu and once I started watching TV things worked after I hit enter on the keyboard once. Not ideal.

So after some editing to my .lircrc file it looks like the following. It's working fairly well, but changing channels is still clunky. It seems like I have to hit enter after channel up/down to make the change take effect. I suspect some problem with MythTV since I see the same issue with hitting the up/down keys on the keyboard.

begin
prog = irxevent
button = UP
repeat = 3
config = Key Up CurrentWindow
end
begin
prog = irxevent
button = DOWN
repeat = 3
config = Key Down CurrentWindow
end
begin
prog = irxevent
button = LEFT
repeat = 3
config = Key Left CurrentWindow
end
begin
prog = irxevent
button = RIGHT
repeat = 3
config = Key Right CurrentWindow
end
begin
prog = irxevent
button = OK
repeat = 3
config = Key Return CurrentWindow
end
begin
prog = irxevent
button = CH+
repeat = 3
config = Key Up CurrentWindow
end
begin
prog = irxevent
button = CH-
repeat = 3
config = Key Down CurrentWindow
end
begin
prog = irxevent
button = MENU
repeat = 3
config = Key Return CurrentWindow
end
begin
prog = irxevent
button = RECORD
repeat = 3
config = Key Return CurrentWindow
end
begin
prog = irxevent
button = RED
repeat = 3
config = Key X CurrentWindow
end
begin
prog = irxevent
button = GREEN
repeat = 3
config = Key I CurrentWindow
end
begin
prog = irxevent
button = YELLOW
repeat = 3
config = Key bracketleft CurrentWindow
end
begin
prog = irxevent
button = BLUE
repeat = 3
config = Key bracketright CurrentWindow
end
begin
prog = irxevent
button = BLANK
repeat = 3
config = Key D CurrentWindow
end
begin
prog = irxevent
button = VOL-
repeat = 3
config = Key Left CurrentWindow
end
begin
prog = irxevent
button = REV
repeat = 3
config = Key Left CurrentWindow
end
begin
prog = irxevent
button = PLAY
repeat = 3
config = Key P CurrentWindow
end
begin
prog = irxevent
button = MUTE
repeat = 3
config = Key backslash CurrentWindow
end
begin
prog = irxevent
button = VOL+
repeat = 3
config = Key Right CurrentWindow
end
begin
prog = irxevent
button = FFW
repeat = 3
config = Key Right CurrentWindow
end
begin
prog = irxevent
button = BACK/EXIT
repeat = 3
config = Key Escape CurrentWindow
end
begin
prog = irxevent
button = FULL
repeat = 3
config = Key Escape CurrentWindow
end
begin
prog = irxevent
button = PAUSE
repeat = 3
config = Key P CurrentWindow
end
begin
prog = irxevent
button = 0
config = Key 0 CurrentWindow
end
begin
prog = irxevent
button = 1
config = Key 1 CurrentWindow
end
begin
prog = irxevent
button = 2
config = Key 2 CurrentWindow
end
begin
prog = irxevent
button = 3
config = Key 3 CurrentWindow
end
begin
prog = irxevent
button = 4
config = Key 4 CurrentWindow
end
begin
prog = irxevent
button = 5
config = Key 5 CurrentWindow
end
begin
prog = irxevent
button = 6
config = Key 6 CurrentWindow
end
begin
prog = irxevent
button = 7
config = Key 7 CurrentWindow
end
begin
prog = irxevent
button = 8
config = Key 8 CurrentWindow
end
begin
prog = irxevent
button = 9
config = Key 9 CurrentWindow
end

Saturday, March 24, 2007

MythTV on Ubuntu

My next project was to install my WinTV PVR-250 and MythTV. I followed the directions at the Ubuntu Community Documentation site and specifically the directions for a Backend/Frontend/Desktop install with the exception I was building on a existing Ubuntu install so I skipped most of the initial steps and I started with installing the XFS Utilities:
# apt-get install xfsprogs
Then I set up NTP as specified. I did a "Synchronize Now" before since my clock was 10 minutes off. NTP was not installed, but I selected the auto installaion and all went fine.

For the WinTV-PVR 250 drivers I installed IVTV.

Now I installed MythTV. I skipped the mysql install since I already had it installed when I installed MediaWiki.
# apt-get install mythtv-frontend mythtv-backend mythtv-database
Now set up MythTV following the directions provided. Some details
  • Under Video Source setup, I set the Channel frequency table to "us-cable" since I have cable.
  • Chose the MPEG-2 encoder card (PVR-x50, PVR-500)
  • I registered with Zap2It as specified and got a username and password which I used for MythTV.
I synchronized the channel line up as specified:
# /etc/cron.daily/mythtv-backend
And launched the backend:
# /etc/init.d/mythtv-backend start
Starting MythTV server: mythbackend.
As suggested on the page I installed phpmyadmin:
sudo apt-get install phpmyadmin
And added the channel icons.

And installed the mythplugins. Note I had to restart Apache for the /etc/group change to take effect:
# /etc/init.d/apache2 restart
At this point I could run mythfrontend and everything seemed to be working great except for the remote control, which isn't working at this point. That will be the next post.