2021-02-22, 19:57
Ive built my own addon which can play items and gets the next item to play and adds it to a playlist. This all works fine and I can get all the correct metadata setup on a listitem and then linked to my playlist entries.
However I seem to be getting an issue where the VideoPlayer.DBTYPE is always empty, despite the mediatype being correctly set and on the 1st play of a file all the meta data displays correctly in Yatse. But if you stop and replay the same file it just displays basic meta data in yatse (eg date =1969 but date is actually set).
Similarly if you play a file, 1st time yatse shows all the correct metadata, 2nd time it doesnt, but when it plays the next file on the playlist everything is ok again.
The metadata for the 1st play list item and the playlist listitems are being setup in basically the same way. I've made a couple of changes here and there trying to get it to work consistently but nothing seems to work once its played once.
I think it has something to do with the Plugin content or plugin handle perhaps? Like the list item is in some way persistent on the same addon handle so it remembers and doesnt work properly the 2nd time? Or something similar but more directly tied to the DB?
However I seem to be getting an issue where the VideoPlayer.DBTYPE is always empty, despite the mediatype being correctly set and on the 1st play of a file all the meta data displays correctly in Yatse. But if you stop and replay the same file it just displays basic meta data in yatse (eg date =1969 but date is actually set).
Similarly if you play a file, 1st time yatse shows all the correct metadata, 2nd time it doesnt, but when it plays the next file on the playlist everything is ok again.
The metadata for the 1st play list item and the playlist listitems are being setup in basically the same way. I've made a couple of changes here and there trying to get it to work consistently but nothing seems to work once its played once.
I think it has something to do with the Plugin content or plugin handle perhaps? Like the list item is in some way persistent on the same addon handle so it remembers and doesnt work properly the 2nd time? Or something similar but more directly tied to the DB?
python:xbmcplugin.setContent(-1, 'episodes')
li = xbmcgui.ListItem(label, iconImage=thumb)
li.setProperty('fanart_image', fanart)
li.setProperty('startoffset', str(resumeTimeInSeconds))
li.setProperty('DBID', dbid)
li.setProperty('TVShowTitle', show_title)
li.setProperty('Episode', str(show_episode))
li.setProperty('Season', str(show_season))
#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})
try:
json_result = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "id":1, "method": "VideoLibrary.GetEpisodeDetails", "params": {"episodeid": '+str(dbid)+', "properties": ["art"]}}')
json_result = json.loads(json_result)
#xbmc.log(str(json_result['result']['episodedetails']['art'])+'===>PHIL', level=xbmc.LOGNOTICE)
li.setArt(json_result['result']['episodedetails']['art'])
except:
pass
li.setProperty('IsPlayable', 'true')
li.setProperty('IsFolder', 'false')
#li.setInfo('video', {'title': title,'genre': genre, 'plotoutline': plotoutline, 'plot': plot, 'path': PTN_download,'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.setInfo('video', {'title': title, 'TVShowTitle': show_title, 'Episode': str(show_episode), 'Season': show_season,'genre': genre, 'plotoutline': plotoutline, 'plot': plot, 'path': PTN_download,'premiered': premiered, 'dbid': dbid, 'mediatype': dbtype, 'duration': duration, 'IMDBNumber': imdb, 'Rating': rating, 'Year': year})
try:
json_result = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "id":1, "method": "VideoLibrary.GetEpisodeDetails", "params": {"episodeid": '+str(dbid)+', "properties": ["title","plot","votes","rating","writer","firstaired","playcount","runtime","director","productioncode","season","episode","originaltitle","showtitle","cast","streamdetails","lastplayed","fanart","thumbnail","file","resume","tvshowid","dateadded","uniqueid","specialsortseason","specialsortepisode","userrating","seasonid","ratings"]}}')
json_result = json.loads(json_result)
#xbmc.log(str(json_result['result']['episodedetails']['art'])+'===>PHIL', level=xbmc.LOGNOTICE)
json_result['result']['episodedetails']['mediatype'] = 'episode'
li.setInfo(type='Video', infoLabels=str(json_result['result']['episodedetails']))
except:
pass
li.setPath(PTN_download)
xbmcgui.Window(10000).setProperty('Next_EP.ResolvedUrl', 'true')
xbmcgui.Window(10000).setProperty('Next_EP.Url', PTN_download)
xbmcgui.Window(10000).clearProperty('Next_EP.TMDB_action')
playlist.add(PTN_download, li)
#xbmcplugin.addDirectoryItem(handle=-1, url=PTN_download , listitem=li, isFolder=False)
xbmcplugin.setResolvedUrl(-1, True, li)
xbmcplugin.endOfDirectory(-1)