Let me start by saying that the DRM on Blu-Ray discs (BDs) is absolutely insane… to the point where new BDs are being distributed with tiny VM’s (Virtual Machines) on board that are run up by Blu-Ray players to detect any tampering with a player and possibly repair it. See WikiPedia for some insight in to the insane lengths Hollywood has gone to to stop people from doing virtually anything with the discs.
Anyway… what I set out to do was to be able to seamlessly play, at least most, protected discs from within the MythTV interface on my Linux PVR. Got pretty close I think…
Here are the basic steps:
- Download and install makemkv (Follow instructions here)
- Create following script in your homedir, I called it ‘bd’, note the general idea of the script was borrowed from another forum post which I can’t find now, and heavily modified:
#!/usr/bin/php -q <?php system('killall makemkvcon'); system('(makemkvcon --upnp=0 stream disc:0 --cache=128 --minlength=60 2>&1 >>/var/log/mythtv/bd-makemkvcon.log) >/dev/null &'); $c=1; while($c<100){ $c++; // if makemkvcon is ready, exit loop system("/bin/netstat -nl | grep -q 51000",$ret); if ($ret==0) $c=100; system('(osd_cat -p middle \ -f "-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*" \ -A center \ -b percentage \ --color="WHITE" \ --percentage='.$c.' \ --shadow=4 \ --text="Loading..." \ -d 1 ) >/dev/null &'); usleep(900000); } sleep(1); // Find titles and details from the web interface $f=fopen('http://127.0.0.1:51000/web/titles','r'); $titles=array(); if ($f){ while(!feof($f)){ if (preg_match('/\<td\>(?P<title>title[0-9]+)\<\/td\>/',fgets($f),$matches)){ $titles[$matches['title']]['url']="http://127.0.0.1:51000/stream/{$matches['title']}.ts"; $f1=fopen('http://127.0.0.1:51000/web/'.$matches['title'],'r'); if ($f1){ while(!feof($f1)){ if (preg_match('/\<tr\>\<td\>(?<attr>.*)\<\/td\>\<td\>(?<val>.*)\<\/td\>\<\/tr\>/',fgets($f1),$matches1)){ $titles[$matches['title']][$matches1['attr']]=$matches1['val']; } } fclose($f1); } } } fclose($f); } $f=fopen('/tmp/.tmp-bddata','w'); $vlccmd='vlc --fullscreen'; foreach ($titles as $title => $data){ $vlccmd.=" {$data['url']}"; fputs($f,"Title {$data['id']} Duration {$data['duration']} {$data['chaptercount']} chapters\n"); } fclose($f); //display details on screen for 10 seconds system('osd_cat -f "-adobe-helvetica-bold-*-*-*-24-*-*-*-*-*-*-*" -A center --color="WHITE" --shadow=2 --lines='.count($titles).' /tmp/.tmp-bddata -d 10'); unlink('/tmp/.tmp-bddata'); //open vlc if (count($titles)>0){ system("$vlccmd 2>&1 >>/var/log/mythtv/bd-vlc.log"); } system('killall makemkvcon'); ?> - Edit ‘/usr/share/mythtv/themes/defaultmenu/optical_menu.xml’ and insert the following just after the line ‘<mythmenu name=”OPTICAL_DISK”>’
<button> <type>BD_PLAY</type> <text>Play BD</text> <description>Play a film on BD</description> <action>EXEC ~/bd</action> <depends>mythvideo</depends> </button>
- Then edit the file ‘/usr/share/mythtv/themes/MY-THEME/menu-ui.xml’ and under the section ‘<!– ######## dvdmenu.xml ########–>’ add:
<state name="BD_PLAY"> <imagetype name="watermark"> <filename>watermark/dvd.png</filename> <position>0,0</position> </imagetype> </state>
With a bit of playing around you should then be presented with a loading bar, followed by some details on the various title lengths etc to help you work out which title you want to watch, followed by a vlc window that has all the titles in a playlist… about the best I could do without getting my hands too dirty! Enjoy!
