MythTV is an excellent PVR, but on occasions thing can go wrong and it is useful to have a ready arsenal of utilities which you can run when things might go wrong!
Before your begin:
If you are not confident that a script won’t damage your database, it’s recommended you backup your database using the Backup and Restore feature in the Mythbuntu Control Centre
MythTV maintenance scripts are located in /usr/share/doc/mythtv-backend/contrib/maintenance
This a perl script to run MYSQL utilities Repair and Optimize on each table in your MythTV database. Whilst it is recommended to run this regularly from a Cron job (scheduled task), I prefer to run this manually so I can see what is happening.
From terminal, cd to the maintenance scripts directory and enter:
The script will analyise and repair/ optimise any damaged database tables.
This is a Python script which shows recordings with missing files or files with missing recordings. This is very useful if you are access your MythTV backend vis a DLNA enabled device like a TV as it will show all recordings listed in the database even if the files are no longer present on the MythTV backend. You can then use the script to clean things up.
By default it is not in the MythTV maintenance directory, but it can be easily added by creating a file of the same name in the maintenance directory and pasting in the code from the wiki.
To make the script executable enter:
chmod 755 Find_orphans.py
Now run the script by entering:
Below is an example of what you may see
At the bottom of the screen you will be given a menu of options:
Note: The menu will only display relevant options dependent on the problems it detects so may not look exactly like the screen shot.
In the above example I have orphaned recording entries, so I will select option 1 to delete the entries.
The script then lists the entries which will be deleted and then asks for confirmation (yes or no) before proceeding. Whilst the process appears to happen quickly, you will probably find that the orphaned entries are still being listed. This is because the listings are still being deleted in the background. Eventually they will disappear from the list.
Once finished press Ctrl-c to exit.
Once completed, I run the optimize_mythdv.pl script to make sure the database is optimised.
In my opinion this is a fantastic script and should be included by default in MythTV. In fact I would go further and say that it should be accessible from the Mythbuntu Control Centre menu, or MythTV Backend Setup.
MythTV Version Updates
Whilst not a command line utility, the Mythbuntu Control Centre is a very useful way for ensuring that your system us protected through backups, configured correctly and MythTV is up to date.
With Mythbuntu 12.04 being a LTS release there are by default no updates to MythTV 0.25 which ships with it. However, should you wish to receive the latest MythTV updates and fixes you can enable later MythTV repositories through the control centre.
Before you start the upgrade, make sure that /etc/mythtv/config.xml is not empty!
If it is your upgrade will fail and MythTV will be left in an unusable state. This is a know bug.
The contents of the file should look something like the example below:
Set the <LocalHostName> hostname override below only if you want to use
something other than the machine’s real hostname for identifying settings
in the database. This is useful if your hostname changes often, as
otherwise you’ll need to reconfigure mythtv every time.
NO TWO HOSTS MAY USE THE SAME VALUE
and should match the contents in /etc/mythtv/mysql.txt.
If empty this file will need to be corrected before proceeding with the upgrade.
Access the Mythbuntu Control Centre by selecting Applications> System > Mythbuntu Control Centre and select Repositories from the menu.
Check the box called Activate MythTV Updates repository
and select which version of MythTV you wish to upgrade to e.g. 0.27. If the version is not listed, press the Refresh button to the right of the version number.
Also check the box Activate Mythbuntu Update repositories.
Click Apply and then Quit the Mythbuntu Control Centre.
From Terminal (or from update manager) update Mythbuntu by entering:
sudo apt-get update
sudo apt-get upgrade
confirming that you wish to upgrade.
Once the upgrade has completed MythTV will be on the new version.