[mythtv-users] Restoring "Import DVD" (Light) to MythTV 0.24+ menu (hopefully fairly noob-friendly)

Udo Langen udo.langen at gmail.com
Tue Nov 5 10:47:55 UTC 2013


First of all, the reason I am posting this is that I was not able to find an easy solution to get 
DVD ripping back into the MythTV menu after it was removed from MythTV after version 
0.23. I am currently still on 0.23 but have installed a test installation of Mythbuntu 12.04 and 
version 0.27 of MythTV to try things out on.

I am therefore posting this for anyone else who might miss this functionality and has not 
been able to find any instructions on how to do this. I am not really a coder, so this is literally 
cobbled together from a number of other scripts. It crudely gets the job done, but I'm sure 
there is possibly a better way to do this, e.g. one that uses a single script instead of two, and 
maybe a solution that offers more of the options that were available in the original "Import 
DVD" menu item back in 0.23. This solution only offers a rip of the main title of a movie 
DVD to MP4 format using a single preset. It has also only been tested on a combined 
backend/frontend setup without any complicated storage group scenario.

Firstly, some things you would have to get in place after installing Mythbuntu 12.04:

1) If you ticked the instal Fluendo components box during installation and want to be able to 
rip DRM protected DVDs (be sure you are comfortable with the legal implications of this 
where you may be located), chances are you still have to instal the css component:

sudo /usr/share/doc/libdvdread4/install-css.sh

2) You will also need to instal lsdvd. You can either search for it in the Software Centre, or if 
you have Synaptic installed:

sudo apt-get install lsdvd

3) You also need to instal HandBrakeCLI using a PPA. See here:

https://launchpad.net/~stebbins/+archive/handbrake-releases

Next you will need to edit the Optical Disks menu of the default theme:

Open the terminal and type in:

gksudo thunar

Now browse to:

/usr/share/mythtv/themes/defaultmenu/

Save a copy of optical_menu.xml (e.g. with a .bak extension). Now edit optical_menu.xml, 
e.g. with gedit, and add the following button at your preferred location within the menu 
structure and save the changes:

    <button>
        <type>DVD</type>
        <text>Import DVD</text>
        <description>Import video from a DVD</description>
        <action>EXEC /usr/bin/lsdvdrip.sh</action>
    </button>

You are advised to have a backup copy of this file too, as it will be overwritten whenever the 
themes in MythTV are updated in its default location.

Now copy the following 2 scripts to:

/usr/bin/

Make them executable and check the mythtv user has sufficient rights.

lsdvdrip.sh:

#!/bin/bash

#Location of my vid files
cd /var/lib/mythtv/videos/

#Get the filename from DVD
filename="$(lsdvd /dev/dvd | head -1 | awk '{print $3}')"

echo $filename

#Confirm ok
zenity  --question --title "Alert"   --text "Film is $filename. Are you sure you wish to continue 
?"

continue=$?

echo $continue

#If title not correct prompt for correct title using external script and rip
if [ $continue == 1 ] 
    then
	cd /usr/bin/
           ./Handbrakedvdrip.sh
	exit
fi

#Do the rip if originally prompted title is correct
echo nice -n 20 HandBrakeCLI -i /dev/dvd t- --main-feature -N eng -o "$filename" --
preset="Normal" | at now + 2 min

Handbrakedvdrip.sh:

#!/bin/bash

#Location of my vid files
cd /var/lib/mythtv/videos/

#Get the filename
filmname=$(zenity --entry --title="Enter film name" --text="Enter the title of the film : ")
filename=${filmname}".mp4"

filename=$(echo $filename | sed 's/ /_/g')

echo $filename

#Confirm ok
zenity  --question --title "Alert"   --text "Film is $filmname. Are you sure you wish to continue 
?"

continue=$?

echo $continue

if [ $continue == 1 ] 
    then
    echo Requested stop
        exit 0
fi

#Do the rip
echo nice -n 20 HandBrakeCLI -i /dev/dvd1 t- --main-feature -N eng -o "$filename" --
preset="Normal" | at now + 2 min 

Important: make sure the video file location and DVD drive details are correct in the above 
scripts.

Now, when selecting the Import DVD item from the Optical Disks menu in MythTV, you 
should be prompted to confirm the name of the inserted DVD. If it is not correct (e.g. the 
DVD title is sometimes a contraction of the full title), you can reject it and should then be 
presented with a box allowing you to type in the film title. Once confirmed, the ripping job 
should be placed in a queue for 2 minutes before executing in the background outside 
MythTV. Give it approximately the time it takes to watch the movie to complete. You are 
free to use other options within the frontend interface in the interim. Once the job has 
completed, go to Media Library > Watch Videos and access the menu (M button on a 
keyboard) and scan for changes. If the rip has been successful, your video should appear in 
the list and, if set up, metadata should be downloaded for it.

Requests for other improvements to other forum members:

It would be nice to be able to get a confirmation that the ripping job has completed via 
mythmessage or similar. Does anyone have any suggestions? I guess one option would be 
to add a line to the scripts to eject the DVD upon completion, which may be sufficient for a 
lot of people. Any other improvement suggestions would be welcomed by me, and I'm sure 
others interested in having this functionality restored.

Some other more general tips for those installing Mythbuntu 12.04:

1) I have found that the Optimize Tables button under MySQL in the Mythbuntu Control 
Centre does not work out of the box. To fix this, change the path to optimize_mythdb.pl in:

/usr/share/mythbuntu/plugins/python/mysql_configuration.py

to:

/usr/share/doc/mythtv-backend/contrib/maintenance/optimize_mythdb.pl

2) The Mythbuntu 26.21 theme does not seem to work properly with some of the MythTV 
plugins (at least when using MythTV 0.27), so choose a different theme in that case. 

Hope the above is useful and can perhaps be made even more useful by others here.

There was talk of maybe restoring DVD ripping to MythTV in a later version at one stage, so 
hopefully it will still happen at some stage once the MTD has been replaced and the storage 
group issues have been sorted out. 

Full 0.23 DVD rip functionality can be restored in certain circumstances by way of a patch 
and recompiling thanks to the efforts of another user on this forum if you are willing to go to 
those lengths. I have not attempted this myself, as it seems too daunting to me. See here:

http://www.gossamer-threads.com/lists/mythtv/users/497644

Hope the above helps someone, and it is at least nice that, unlike on Windows, one can 
tinker a bit under the hood to customise if one feels the need.

Still think MythTV is still a great way to enjoy audio-visual entertainment. Thanks to all those 
who work on it to make it possible!

One last query:

I only get channel icons in the Programme Guide, but not, e.g. in the OSD when switching 
channels or elsewhere. Is this normal functionality now, or is something wrong somewhere? 
(Does not seem to be specific to any theme BTW.) TIA

P.S. If the above scripts get garbled in some way during the posting process, I apologise in 
advance.



More information about the mythtv-users mailing list