Tricking Kodi into Thinking There is an Optical Drive Attached?

OK, I know this is a strange question, and I honestly expect the answer to be “no.” But here it is anyway.

We watch some of our media via streaming services on other boxes (Disney+, Netflix, etc). I’d like to have those episodes/movies in my Kodi library but just have them display a dialog telling me where to find them. I actually wrote a plugin (Where Are You) to do this, but today I found an inconsistency in how Kodi handles stream files with plugin URLs in them that I had to work around in a really crappy way that I don’t like, so I’m back to my original idea of using disc stubs in Kodi to display a message. The problem with disc stubs is that Kodi won’t display the message in the stub unless you have an optical drive attached. So I’m wondering if there’s some kind of virtual optical drive I could setup on OSMC to point to nowhere (or some way to map an “empty” device to an optical drive) that would trick Kodi into thinking there is an optical drive attached.

I know there are solutions to run many of these services on OSMC/Kodi (and even get them integrated into the library), but they are mostly restricted (for now) to 720p while I can get 1080p (and even 4K) if I use the apps on my TV. So that’s why I’d rather just have a dialog box.


I’m not sure I fully understand the question.
It sounds like you want a virtual drive but I don’t fully understand why.

I suspect you could create a virtual drive with CDEmu:

I’ll take a look at that thanks. I basically just want Kodi to think there is a drive attached. I don’t even care if the drive actually works. If Kodi thinks there is a drive attached, then when you try and “play” a disc stub (a text file with the .disc extension), it will display a dialog box with a title and message that’s embedded in the file). As I said, strange request, but maybe CDemu will do it.

If you just want the media info in your library you could just make dummy files by adding mkv to an empty text file. You could then use something like TMM to generate nfo files tweak the description. This seems like a lot of work to keep track of what you’ve watched though. Couldn’t you just keep track of what your watching with Trakt instead?

Thanks for the suggestion. This is a little bit of spouse acceptance factor. We often sit down and look at our list of stuff on Kodi (I have the PVR recordings integrated into the library) to figure out what we want to watch. If it’s not on that list, one or both of us forget what else we had. So having an item in the library reminds us, and the dialog reminds us what service it’s on.

Media stubs are the perfect solution for this, except the Kodi devs decided you couldn’t play a media stub unless you have an optical drive attached. So I hacked a stream file to point to a plugin that displays a dialog (based on the URL the plugin gets) and then plays a short MP4 file so Kodi thinks the file played OK. And I have a python script to generate the stream files. So it really does mostly work.

The problem I’m having with the Where Are You Script is that Kodi treats stream files played from the homescreen as playlists (anywhere else they are treated as files). So on the main home screen Kodi goes into a loop playing the same file over and over no matter how I set playlist playback. So I just faked another way to have Kodi think the file played OK, and it mostly works. But on the home screen I get a “no more items found in playlist” error popup after the dummy file plays. At this point I can live with that, and it’s simpler than generating NFO files.

Oh, and CDEmu didn’t work. I should have mentioned I’m on a Vero 4K+, and CDEmu requires X11 to work apparently. I’m not going down that road on the Vero.


If the only requirement is to have virtual drive, I think you do this with a blank ISO; can be generated with genisoimage:

sudo apt-get install genisoimage
mkdir ~/tmp
genisoimage -o ~/cd.iso ~/tmp/
rmdir ~/tmp

Mounting the virtual drive

sudo mkdir /mnt/disk
sudo mount -o loop ~/cd.iso /mnt/disk

Kodi reports mounted removable storage device CDROM.

to unmount:

sudo umount /mnt/disk

Thanks Tom.

1 Like

Thanks for the suggestion. Kodi does, in fact, see the image, but it doesn’t equate it with a physical optical disc drive. And that is the stupid requirement that Kodi has for a disc stub message to be displayed. I think I’m gonna file a bug report on the Matrix branch indicating that disc stub messages shouldn’t be overridden by the message that there is no optical disc drive present.

1 Like

Your not the first to follow this rabbit hole…