2020-07-18, 15:46
I have had a Bluray drive hooked up to my kodi box for a while and have only just realised that I could setup my movies using media Disc stubs in the Kodi library.
I have added a bunch of movies using tiny media manager however when i click on an item, while I can eject and load a disc using the popup button when i click play nothing happens.
I enabled debug logging and there are no messages in the logs just "skipping unplayable item".
So i cant tell exactly what is going wrong, but it can play Blurays on auto insert and or via the context menu on the bluray so it should be able to find and play the disc without any problem on the Media stub play button?
Anyway prior to that I had setup a script in my favourites to find and play a bluray/dvd (i had issues with DVD's not playing properly unless they were unmounted/mounted immediately prior to playing, which may or may not be connected) and i figured i could make some modifications and get it playing blurays.
So ive added this as an menu option in the skin im using (basically using it as a context menu item) so when the script runs it will populate and play a listitem from the currently selected movie which is a media stub and will use the path to the movie of the disc in the drive.
In this way it has all the movies information and is linked to the database item.
So im posting this to ask does anyone have any ideas why the media stub wont play on its own? Could the drive mounting be an issue in any way do you think?
Also to provide my work around method for any interested people and maybe to see if anyone can provide any better methods of linking the movie library item to the playing bluray (i tired just grabbing the current listitem "listitem = xbmcgui.ListItem(listitem)" but that didnt seem to work hence all the variables).
I have added a bunch of movies using tiny media manager however when i click on an item, while I can eject and load a disc using the popup button when i click play nothing happens.
I enabled debug logging and there are no messages in the logs just "skipping unplayable item".
So i cant tell exactly what is going wrong, but it can play Blurays on auto insert and or via the context menu on the bluray so it should be able to find and play the disc without any problem on the Media stub play button?
Anyway prior to that I had setup a script in my favourites to find and play a bluray/dvd (i had issues with DVD's not playing properly unless they were unmounted/mounted immediately prior to playing, which may or may not be connected) and i figured i could make some modifications and get it playing blurays.
So ive added this as an menu option in the skin im using (basically using it as a context menu item) so when the script runs it will populate and play a listitem from the currently selected movie which is a media stub and will use the path to the movie of the disc in the drive.
In this way it has all the movies information and is linked to the database item.
So im posting this to ask does anyone have any ideas why the media stub wont play on its own? Could the drive mounting be an issue in any way do you think?
Also to provide my work around method for any interested people and maybe to see if anyone can provide any better methods of linking the movie library item to the playing bluray (i tired just grabbing the current listitem "listitem = xbmcgui.ListItem(listitem)" but that didnt seem to work hence all the variables).
python:
#!/usr/bin/python
import os
import xbmc, xbmcgui, xbmcplugin
wid = xbmcgui.getCurrentWindowId()
win = xbmcgui.Window(wid)
control = win.getFocus()
listitem = control.getSelectedItem()
poster = xbmc.getInfoLabel('listitem.Art(poster)')
fanart = xbmc.getInfoLabel('listitem.Art(fanart)')
clearlogo = xbmc.getInfoLabel('listitem.Art(clearlogo)')
landscape = xbmc.getInfoLabel('listitem.Art(landscape)')
banner = xbmc.getInfoLabel('listitem.Art(banner)')
thumb = xbmc.getInfoLabel('listitem.Art(thumb)')
director = xbmc.getInfoLabel('listitem.Director')
cast = xbmc.getInfoLabel('listitem.Cast')
cast_role = xbmc.getInfoLabel('listitem.CastAndRole')
duration = xbmc.getInfoLabel('listitem.Duration')
dbid = xbmc.getInfoLabel('listitem.DBID')
dbtype = xbmc.getInfoLabel('listitem.DBTYPE')
genre = xbmc.getInfoLabel('listitem.Genre')
imdb = xbmc.getInfoLabel('listitem.IMDBNumber')
icon = xbmc.getInfoLabel('listitem.Icon')
label = xbmc.getInfoLabel('listitem.Label')
label2 = xbmc.getInfoLabel('listitem.Label2')
MPAA = xbmc.getInfoLabel('listitem.MPAA')
originaltitle = xbmc.getInfoLabel('listitem.OriginalTitle')
plot = xbmc.getInfoLabel('listitem.Plot')
plotoutline = xbmc.getInfoLabel('listitem.PlotOutline')
premiered = xbmc.getInfoLabel('listitem.Premiered')
rating = xbmc.getInfoLabel('listitem.Rating')
rating_votes = xbmc.getInfoLabel('listitem.RatingAndVotes')
set = xbmc.getInfoLabel('listitem.Set')
setid = xbmc.getInfoLabel('listitem.SetID')
studio = xbmc.getInfoLabel('listitem.Studio')
tagline = xbmc.getInfoLabel('listitem.Tagline')
title = xbmc.getInfoLabel('listitem.Title')
votes = xbmc.getInfoLabel('listitem.Votes')
writer = xbmc.getInfoLabel('listitem.Writer')
year = xbmc.getInfoLabel('listitem.Year')
percent_played = xbmc.getInfoLabel('ListItem.PercentPlayed')
resumetime = xbmc.getInfoLabel('listitem.Resumetime')
listitem = xbmcgui.ListItem(listitem)
BDMV = ''
for root, subdirs, files in os.walk('/media'):
for d in subdirs:
if d == "BDMV":
BDMV = os.path.join(root, d + '/index.bdmv')
listitem.setPath(BDMV)
xbmcplugin.setContent(-1, 'movies')
li = xbmcgui.ListItem(title, iconImage=thumb)
import sqlite3
con = sqlite3.connect('/home/osmc/.kodi/userdata/Database/MyVideos116.db')
cur = con.cursor()
sql_result = cur.execute("SELECT resumeTimeInSeconds,C11 from movie_view where idMovie = " + dbid).fetchall()
resumeTimeInSeconds = sql_result[0][0]
duration = sql_result[0][1]
cur.close()
if percent_played > 0:
resume2 = (int(duration) * int(percent_played)) / 100
li.setProperty('fanart_image', fanart)
if resume2 > resumeTimeInSeconds:
li.setProperty('startoffset', str(resume2))
else:
li.setProperty('startoffset', str(resumeTimeInSeconds))
li.setProperty('DBID', dbid)
li.setProperty('Cast', cast)
li.setProperty('CastAndRole', cast_role)
li.setProperty('Duration', duration)
li.setArt({ 'poster': poster, 'fanart': fanart, 'banner': banner, 'clearlogo': clearlogo, 'landscape': landscape, 'thumb': thumb})
li.setProperty('IsPlayable', 'true')
li.setProperty('IsFolder', 'false')
li.setInfo('video', {'title': title,'genre': genre, 'plotoutline': plotoutline, 'plot': plot, 'path': BDMV,'premiered': premiered, 'dbid': dbid, 'mediatype': dbtype, 'writer': writer, 'director': director, 'duration': duration, 'IMDBNumber': imdb, 'MPAA': MPAA, 'Rating': rating, 'Studio': studio, 'Year': year, 'Tagline': tagline, 'Set': set, 'SetID': setid})
li.setPath(BDMV)
xbmcplugin.addDirectoryItem(handle=-1, url=BDMV, listitem=li, isFolder=True)
xbmcplugin.setResolvedUrl(-1, True, li)
xbmc.Player().play(item=BDMV, listitem=li)