Ok so i’ve had a chance to play around with this some more. So i’ve tested the drive attached to my PC and any DVD I have tried has played reliably. I haven’t ripped a DVD as I don’t have any did ripping software setup but i’m fairly confident that the drive is ok.
I’ve now been watching some DVD’s with Kodi and i’ve written a couple of scripts which seem to (almost) guarantee reliable playback.
So the first is the “eject” script which is fairly straightforward
#!/usr/bin/python
import os
kodi_command = 'kodi-send --action=\"Stop\"'
os.system(kodi_command)
try: os.system("eject cdrom")
except:
try: os.system('sudo umount /dev/sr0')
except : pass
kodi_command = 'kodi-send --action=\"ActivateWindow(Favourites)\"'
os.system(kodi_command)
So it stops anything currently playing, ejects the disc and reloads the favourites screen (so you can launch the next script when you have swapped the disc).
The next is a script i’ve called “DVD_Fix” which seems to work more often than not:
#!/usr/bin/python
import os
import shutil
kodi_command = 'kodi-send --action=\"Stop\"'
os.system(kodi_command)
os.system("eject cdrom")
os.system('sudo umount /dev/sr0')
os.system('sudo mount /dev/sr0 /mnt/DVD')
#print(os.path.ismount('/mnt/DVD'))
BDMV = ''
i = 1
while BDMV == '' or i < 5000:
print(i)
i = i +1
for root, subdirs, files in os.walk('/media'):
for d in subdirs:
if d == "VIDEO_TS":
BDMV = os.path.join(root, d)
BDMV = 'DVD'
if d == "BDMV":
BDMV = os.path.join(root, d + '/index.bdmv')
if BDMV <> '':
break
if BDMV == 'DVD':
kodi_command = 'kodi-send --action=\"PlayDVD\"'
os.system(kodi_command)
else:
kodi_command = 'kodi-send --action=\"PlayMedia(\"' + BDMV + "\")\""
os.system(kodi_command)
if i > 20000:
exit()
print(BDMV)
exit()
So this script will eject the DVD (if inserted), otherwise it will stop anything playing, inject the drive tray, then test if its a DVD or Bluray inserted and play each disc with the appropriate method.
The important part for DVD seems to be launching “play disc” immediatley after the disc is inserted, before the kodi “removable drive message” pops up.
So i think udiscs is mounting it correctly as a drive but when it gets mounted as a removable drive a few seconds later this then seems to prevent it playing properly as a DVD?
But if you insert the disk and then immediately launch “Play Disc” it mostly seems to work (tested on yatse remote too with just the “Eject Disc” command and the “Play Disc” command).
So it seems to be a timing issue?
I have noticed that when it doesnt work and an inserted dvd has refused to play or played incorrectly (menus get stuck, warning messages with garbled top half of screen) the “Eject” script often needs to be run twice before the disc ejects.
If that is significant do you think?
So i can provide logs if necessary but unless there is something about DVD mounting that can be easily changed within Kodi I think i may just have to live with this.
To be fair my two scripts are a pretty acceptable workaround for me, launch the eject script from the favourites and then the Dvd_Fix script to play the disc. I had thought about maybe making an addon and maybe monitor the drive or something, but anything more automated i think is likely to be more annoying than useful as you need to swap discs anyway and apart from occasionally having to eject and reinsert the same disc this mostly works from the favourites pretty well.
And given I cant watch any newer blurays I can use Kodi for DVD/Older Bluray and just use my not very good bluray player for anything with newer encryption.
Im hoping in the future Kodi can support BD+ as there is a bluray boxset from another region i’ve had my eye on and having a fully capable multi region bluray player would be sweet.