mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-26 02:36:10 +00:00
fixed artwork on Playback
fixed playcount reporting on Movies improved playcount reporting after playback (refresh the listing)
This commit is contained in:
parent
3be9f9e50e
commit
8b29222446
3 changed files with 11 additions and 10 deletions
|
@ -630,26 +630,27 @@ class LibrarySync():
|
||||||
if type=='Movie':
|
if type=='Movie':
|
||||||
MB3Movie = ReadEmbyDB().getItem(itemID)
|
MB3Movie = ReadEmbyDB().getItem(itemID)
|
||||||
kodiItem = ReadKodiDB().getKodiMovie(itemID)
|
kodiItem = ReadKodiDB().getKodiMovie(itemID)
|
||||||
|
print MB3Movie
|
||||||
if(self.ShouldStop()):
|
if(self.ShouldStop()):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if(MB3Movie == None):
|
if(MB3Movie == None):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if(allKodiMovies == None):
|
if(kodiItem == None):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
userData=API().getUserData(MB3Movie)
|
userData=API().getUserData(MB3Movie)
|
||||||
timeInfo = API().getTimeInfo(MB3Movie)
|
timeInfo = API().getTimeInfo(MB3Movie)
|
||||||
if kodiItem != None:
|
if kodiItem != None:
|
||||||
WriteKodiDB().updateProperty(kodiItem,"playcount",int(userData.get("PlayCount")),"movie")
|
|
||||||
kodiresume = int(round(kodiItem['resume'].get("position")))
|
kodiresume = int(round(kodiItem['resume'].get("position")))
|
||||||
resume = int(round(float(timeInfo.get("ResumeTime"))))*60
|
resume = int(round(float(timeInfo.get("ResumeTime"))))*60
|
||||||
total = int(round(float(timeInfo.get("TotalTime"))))*60
|
total = int(round(float(timeInfo.get("TotalTime"))))*60
|
||||||
if kodiresume != resume:
|
if kodiresume != resume:
|
||||||
WriteKodiDB().setKodiResumePoint(kodiItem['movieid'],resume,total,"movie")
|
WriteKodiDB().setKodiResumePoint(kodiItem['movieid'],resume,total,"movie")
|
||||||
|
#write property forced will refresh the item in the list so playcount change is immediately visible
|
||||||
|
WriteKodiDB().updateProperty(kodiItem,"playcount",int(userData.get("PlayCount")),"movie",True)
|
||||||
if(self.ShouldStop()):
|
if(self.ShouldStop()):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -664,14 +665,13 @@ class LibrarySync():
|
||||||
userData=API().getUserData(MB3Episode)
|
userData=API().getUserData(MB3Episode)
|
||||||
timeInfo = API().getTimeInfo(MB3Episode)
|
timeInfo = API().getTimeInfo(MB3Episode)
|
||||||
if kodiItem != None:
|
if kodiItem != None:
|
||||||
if kodiItem['playcount'] != int(userData.get("PlayCount")):
|
|
||||||
WriteKodiDB().updateProperty(kodiItem,"playcount",int(userData.get("PlayCount")),"episode")
|
|
||||||
kodiresume = int(round(kodiItem['resume'].get("position")))
|
kodiresume = int(round(kodiItem['resume'].get("position")))
|
||||||
resume = int(round(float(timeInfo.get("ResumeTime"))))*60
|
resume = int(round(float(timeInfo.get("ResumeTime"))))*60
|
||||||
total = int(round(float(timeInfo.get("TotalTime"))))*60
|
total = int(round(float(timeInfo.get("TotalTime"))))*60
|
||||||
if kodiresume != resume:
|
if kodiresume != resume:
|
||||||
WriteKodiDB().setKodiResumePoint(kodiItem['episodeid'],resume,total,"episode")
|
WriteKodiDB().setKodiResumePoint(kodiItem['episodeid'],resume,total,"episode")
|
||||||
|
#write property forced will refresh the item in the list so playcount change is immediately visible
|
||||||
|
WriteKodiDB().updateProperty(kodiItem,"playcount",int(userData.get("PlayCount")),"episode",True)
|
||||||
if(self.ShouldStop()):
|
if(self.ShouldStop()):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
@ -105,8 +105,9 @@ class PlaybackUtils():
|
||||||
WINDOW.setProperty(playurl+"SubtitleStreamIndex", str(mediaSources[0].get('DefaultSubtitleStreamIndex')))
|
WINDOW.setProperty(playurl+"SubtitleStreamIndex", str(mediaSources[0].get('DefaultSubtitleStreamIndex')))
|
||||||
|
|
||||||
#this launches the playback
|
#this launches the playback
|
||||||
|
#artwork only works with both resolvedurl and player command
|
||||||
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, listItem)
|
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, listItem)
|
||||||
|
xbmc.Player().play(playurl,listItem)
|
||||||
|
|
||||||
def setArt(self, list,name,path):
|
def setArt(self, list,name,path):
|
||||||
if name=='thumb' or name=='fanart_image' or name=='small_poster' or name=='tiny_poster' or name == "medium_landscape" or name=='medium_poster' or name=='small_fanartimage' or name=='medium_fanartimage' or name=='fanart_noindicators':
|
if name=='thumb' or name=='fanart_image' or name=='small_poster' or name=='tiny_poster' or name == "medium_landscape" or name=='medium_poster' or name=='small_fanartimage' or name=='medium_fanartimage' or name=='fanart_noindicators':
|
||||||
|
|
|
@ -310,7 +310,7 @@ class WriteKodiDB():
|
||||||
return changes
|
return changes
|
||||||
|
|
||||||
# adds or updates the given property on the videofile in Kodi database
|
# adds or updates the given property on the videofile in Kodi database
|
||||||
def updateProperty(self,KodiItem,propertyName,propertyValue,fileType):
|
def updateProperty(self,KodiItem,propertyName,propertyValue,fileType,forced=False):
|
||||||
if fileType == "tvshow":
|
if fileType == "tvshow":
|
||||||
id = KodiItem['tvshowid']
|
id = KodiItem['tvshowid']
|
||||||
jsoncommand_i = '{"jsonrpc": "2.0", "method": "VideoLibrary.SetTVShowDetails", "params": { "tvshowid": %i, "%s": %i}, "id": 1 }'
|
jsoncommand_i = '{"jsonrpc": "2.0", "method": "VideoLibrary.SetTVShowDetails", "params": { "tvshowid": %i, "%s": %i}, "id": 1 }'
|
||||||
|
@ -329,7 +329,7 @@ class WriteKodiDB():
|
||||||
jsoncommand_s = '{"jsonrpc": "2.0", "method": "VideoLibrary.SetMovieDetails", "params": { "movieid": %i, "%s": "%s"}, "id": 1 }'
|
jsoncommand_s = '{"jsonrpc": "2.0", "method": "VideoLibrary.SetMovieDetails", "params": { "movieid": %i, "%s": "%s"}, "id": 1 }'
|
||||||
|
|
||||||
changes = False
|
changes = False
|
||||||
if propertyValue != KodiItem[propertyName]:
|
if ((propertyValue != KodiItem[propertyName]) or forced):
|
||||||
if propertyValue != None:
|
if propertyValue != None:
|
||||||
if type(propertyValue) is int:
|
if type(propertyValue) is int:
|
||||||
xbmc.sleep(sleepVal)
|
xbmc.sleep(sleepVal)
|
||||||
|
|
Loading…
Reference in a new issue