mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 18:26:15 +00:00
added genres to the properties
This commit is contained in:
parent
2d3f81a059
commit
7b45de29e1
1 changed files with 29 additions and 9 deletions
|
@ -169,16 +169,13 @@ class LibrarySync():
|
||||||
trailerUrl = "plugin://plugin.video.mb3sync/?id=" + trailerItem[0].get("Id") + '&mode=play'
|
trailerUrl = "plugin://plugin.video.mb3sync/?id=" + trailerItem[0].get("Id") + '&mode=play'
|
||||||
self.updateProperty(KodiItem,"trailer",trailerUrl,"movie")
|
self.updateProperty(KodiItem,"trailer",trailerUrl,"movie")
|
||||||
|
|
||||||
|
#update genres
|
||||||
#update genre
|
self.updateGenres(KodiItem,MBitem.get("Genres"),"movie")
|
||||||
if KodiItem['genre'] != MBitem.get("Genres") and MBitem.get("Genres") != None:
|
|
||||||
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.SetMovieDetails", "params": { "movieid": %i, "genre": %s}, "id": 1 }' %(KodiItem['movieid'], "\"{koekoek,pannekoek} \""))
|
|
||||||
|
|
||||||
|
|
||||||
#update strm file - TODO: only update strm when path has changed
|
#update strm file - TODO: only update strm when path has changed
|
||||||
self.createSTRM(MBitem["Id"])
|
self.createSTRM(MBitem["Id"])
|
||||||
|
|
||||||
#update nfo file - needed for testing
|
#create nfo file if not exists
|
||||||
nfoFile = os.path.join(movieLibrary,MBitem["Id"],MBitem["Id"] + ".nfo")
|
nfoFile = os.path.join(movieLibrary,MBitem["Id"],MBitem["Id"] + ".nfo")
|
||||||
if not xbmcvfs.exists(nfoFile):
|
if not xbmcvfs.exists(nfoFile):
|
||||||
self.createNFO(MBitem)
|
self.createNFO(MBitem)
|
||||||
|
@ -217,12 +214,35 @@ class LibrarySync():
|
||||||
else:
|
else:
|
||||||
method = "VideoLibrary.SetMovieDetails"
|
method = "VideoLibrary.SetMovieDetails"
|
||||||
|
|
||||||
if not propertyValue in KodiItem[propertyName]:
|
if propertyValue != KodiItem[propertyName]:
|
||||||
if type(propertyValue) is int:
|
if type(propertyValue) is int:
|
||||||
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "%s", "params": { "movieid": %i, "%s": %i}, "id": 1 }' %(method,KodiItem['movieid'], propertyName, propertyValue))
|
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "%s", "params": { "movieid": %i, "%s": %i}, "id": 1 }' %(method,KodiItem['movieid'], propertyName, propertyValue))
|
||||||
else:
|
else:
|
||||||
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "%s", "params": { "movieid": %i, "%s": "%s"}, "id": 1 }' %(method,KodiItem['movieid'], propertyName, propertyValue))
|
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "%s", "params": { "movieid": %i, "%s": "%s"}, "id": 1 }' %(method,KodiItem['movieid'], propertyName, propertyValue))
|
||||||
|
|
||||||
|
# adds or updates the genres on the videofile in Kodi database
|
||||||
|
def updateGenres(self,KodiItem,genreCollection,fileType="movie"):
|
||||||
|
if fileType == "tvshow":
|
||||||
|
method = "VideoLibrary.SetTVShowDetails"
|
||||||
|
elif fileType == "episode":
|
||||||
|
method = "VideoLibrary.SetEpisodeDetails"
|
||||||
|
elif fileType == "musicvideo":
|
||||||
|
method = "VideoLibrary.SetMusicVideoDetails"
|
||||||
|
else:
|
||||||
|
method = "VideoLibrary.SetMovieDetails"
|
||||||
|
|
||||||
|
pendingChanges = False
|
||||||
|
if genreCollection != None:
|
||||||
|
currentgenres = set(KodiItem["genre"])
|
||||||
|
genrestring = ""
|
||||||
|
for genre in genreCollection:
|
||||||
|
if not genre in currentgenres:
|
||||||
|
pendingChanges = True
|
||||||
|
json_genres = json.dumps(genreCollection)
|
||||||
|
|
||||||
|
if pendingChanges:
|
||||||
|
print genreCollection
|
||||||
|
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "%s", "params": { "movieid": %i, "genre": %s}, "id": 1 }' %(method,KodiItem['movieid'],json_genres))
|
||||||
|
|
||||||
def createSTRM(self,id):
|
def createSTRM(self,id):
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue