diff --git a/addon.xml b/addon.xml index ffe99310..63cee45a 100644 --- a/addon.xml +++ b/addon.xml @@ -1,7 +1,7 @@ diff --git a/resources/lib/API.py b/resources/lib/API.py index 03e3b0f1..cfc7a210 100644 --- a/resources/lib/API.py +++ b/resources/lib/API.py @@ -316,7 +316,7 @@ class API(): tempDate = "01.01.2000" return tempDate - def getArtwork(self, data, type, index = "0", userParentInfo = False): + def getArtwork(self, data, type, mediaType = "", index = "0", userParentInfo = False): addonSettings = xbmcaddon.Addon(id='plugin.video.emby') id = data.get("Id") @@ -371,11 +371,21 @@ class API(): id = data.get("ParentBackdropItemId") query = "" - height = "10000" - width = "10000" + maxHeight = "10000" + maxWidth = "10000" + height = "" + width = "" played = "0" totalbackdrops = 0 + if addonSettings.getSetting('coverArtratio') == "true": + if mediaType in ("movie","boxset","tvshow"): + if "Primary" in type: + # Only force ratio for cover art for main covers + aspectratio = data.get("PrimaryImageAspectRatio") + width = "&Width=1000" + height = "&Height=1480" + if originalType =="BackdropNoIndicators" and index == "0" and data.get("BackdropImageTags") != None: totalbackdrops = len(data.get("BackdropImageTags")) if totalbackdrops != 0: @@ -392,7 +402,7 @@ class API(): if imageTag == None: imageTag = "e3ab56fe27d389446754d0fb04910a34" - artwork = "%s/mediabrowser/Items/%s/Images/%s/%s?MaxWidth=%s&MaxHeight=%s&Format=original&Tag=%s%s" % (server, id, type, index, width, height, imageTag, query) + artwork = "%s/mediabrowser/Items/%s/Images/%s/%s?MaxWidth=%s&MaxHeight=%s%s%s&Format=original&Tag=%s%s" % (server, id, type, index, maxWidth, maxHeight, height, width, imageTag, query) #artwork = "%s/mediabrowser/Items/%s/Images/%s/%s/%s/original/%s/%s/%s?%s" % (server, id, type, index, imageTag, width, height, played, query) <- broken if addonSettings.getSetting('disableCoverArt')=='true': artwork = artwork + "&EnableImageEnhancers=false" diff --git a/resources/lib/Entrypoint.py b/resources/lib/Entrypoint.py index 02556930..8500748e 100644 --- a/resources/lib/Entrypoint.py +++ b/resources/lib/Entrypoint.py @@ -650,12 +650,12 @@ def doMainListing(): addDirectoryItem(label, path) # some extra entries for settings and stuff. TODO --> localize the labels - addDirectoryItem("Settings", "plugin://plugin.video.emby/?mode=settings", False) - addDirectoryItem("Perform manual sync", "plugin://plugin.video.emby/?mode=manualsync", False) - addDirectoryItem("Add user to session", "plugin://plugin.video.emby/?mode=adduser", False) - addDirectoryItem("Configure user preferences", "plugin://plugin.video.emby/?mode=userprefs", False) - addDirectoryItem("Perform local database reset (full resync)", "plugin://plugin.video.emby/?mode=reset", False) - addDirectoryItem("Cache all images to Kodi texture cache (advanced)", "plugin://plugin.video.emby/?mode=texturecache", False) - addDirectoryItem("Sync Emby Theme Media to Kodi", "plugin://plugin.video.emby/?mode=thememedia", False) + addDirectoryItem("Settings", "plugin://plugin.video.emby/?mode=settings") + addDirectoryItem("Perform manual sync", "plugin://plugin.video.emby/?mode=manualsync") + addDirectoryItem("Add user to session", "plugin://plugin.video.emby/?mode=adduser") + addDirectoryItem("Configure user preferences", "plugin://plugin.video.emby/?mode=userprefs") + addDirectoryItem("Perform local database reset (full resync)", "plugin://plugin.video.emby/?mode=reset") + addDirectoryItem("Cache all images to Kodi texture cache (advanced)", "plugin://plugin.video.emby/?mode=texturecache") + addDirectoryItem("Sync Emby Theme Media to Kodi", "plugin://plugin.video.emby/?mode=thememedia") xbmcplugin.endOfDirectory(int(sys.argv[1])) diff --git a/resources/lib/WriteKodiVideoDB.py b/resources/lib/WriteKodiVideoDB.py index 5de8f6b6..239aa0d2 100644 --- a/resources/lib/WriteKodiVideoDB.py +++ b/resources/lib/WriteKodiVideoDB.py @@ -218,14 +218,14 @@ class WriteKodiVideoDB(): self.AddPeopleToMedia(movieid,MBitem.get("People"),"movie", connection, cursor) #update artwork - self.addOrUpdateArt(API().getArtwork(MBitem, "Primary"), movieid, "movie", "thumb", cursor) - self.addOrUpdateArt(API().getArtwork(MBitem, "Primary"), movieid, "movie", "poster", cursor) - self.addOrUpdateArt(API().getArtwork(MBitem, "Banner"), movieid, "movie", "banner", cursor) - self.addOrUpdateArt(API().getArtwork(MBitem, "Logo"), movieid, "movie", "clearlogo", cursor) - self.addOrUpdateArt(API().getArtwork(MBitem, "Art"), movieid, "movie", "clearart", cursor) - self.addOrUpdateArt(API().getArtwork(MBitem, "Thumb"), movieid, "movie", "landscape", cursor) - self.addOrUpdateArt(API().getArtwork(MBitem, "Disc"), movieid, "movie", "discart", cursor) - self.addOrUpdateArt(API().getArtwork(MBitem, "Backdrop"), movieid, "movie", "fanart", cursor) + self.addOrUpdateArt(API().getArtwork(MBitem, "Primary", mediaType = "movie"), movieid, "movie", "thumb", cursor) + self.addOrUpdateArt(API().getArtwork(MBitem, "Primary", mediaType = "movie"), movieid, "movie", "poster", cursor) + self.addOrUpdateArt(API().getArtwork(MBitem, "Banner", mediaType = "movie"), movieid, "movie", "banner", cursor) + self.addOrUpdateArt(API().getArtwork(MBitem, "Logo", mediaType = "movie"), movieid, "movie", "clearlogo", cursor) + self.addOrUpdateArt(API().getArtwork(MBitem, "Art", mediaType = "movie"), movieid, "movie", "clearart", cursor) + self.addOrUpdateArt(API().getArtwork(MBitem, "Thumb", mediaType = "movie"), movieid, "movie", "landscape", cursor) + self.addOrUpdateArt(API().getArtwork(MBitem, "Disc", mediaType = "movie"), movieid, "movie", "discart", cursor) + self.addOrUpdateArt(API().getArtwork(MBitem, "Backdrop", mediaType = "movie"), movieid, "movie", "fanart", cursor) #update genres self.AddGenresToMedia(movieid, genres, "movie", cursor) @@ -379,14 +379,14 @@ class WriteKodiVideoDB(): self.AddPeopleToMedia(idMVideo,MBitem.get("People"),"musicvideo", connection, cursor) #update artwork - self.addOrUpdateArt(API().getArtwork(MBitem, "Primary"), idMVideo, "musicvideo", "thumb", cursor) - self.addOrUpdateArt(API().getArtwork(MBitem, "Primary"), idMVideo, "musicvideo", "poster", cursor) - self.addOrUpdateArt(API().getArtwork(MBitem, "Banner"), idMVideo, "musicvideo", "banner", cursor) - self.addOrUpdateArt(API().getArtwork(MBitem, "Logo"), idMVideo, "musicvideo", "clearlogo", cursor) - self.addOrUpdateArt(API().getArtwork(MBitem, "Art"), idMVideo, "musicvideo", "clearart", cursor) - self.addOrUpdateArt(API().getArtwork(MBitem, "Thumb"), idMVideo, "musicvideo", "landscape", cursor) - self.addOrUpdateArt(API().getArtwork(MBitem, "Disc"), idMVideo, "musicvideo", "discart", cursor) - self.addOrUpdateArt(API().getArtwork(MBitem, "Backdrop"), idMVideo, "musicvideo", "fanart", cursor) + self.addOrUpdateArt(API().getArtwork(MBitem, "Primary", mediaType = "musicvideo"), idMVideo, "musicvideo", "thumb", cursor) + self.addOrUpdateArt(API().getArtwork(MBitem, "Primary", mediaType = "musicvideo"), idMVideo, "musicvideo", "poster", cursor) + self.addOrUpdateArt(API().getArtwork(MBitem, "Banner", mediaType = "musicvideo"), idMVideo, "musicvideo", "banner", cursor) + self.addOrUpdateArt(API().getArtwork(MBitem, "Logo", mediaType = "musicvideo"), idMVideo, "musicvideo", "clearlogo", cursor) + self.addOrUpdateArt(API().getArtwork(MBitem, "Art", mediaType = "musicvideo"), idMVideo, "musicvideo", "clearart", cursor) + self.addOrUpdateArt(API().getArtwork(MBitem, "Thumb", mediaType = "musicvideo"), idMVideo, "musicvideo", "landscape", cursor) + self.addOrUpdateArt(API().getArtwork(MBitem, "Disc", mediaType = "musicvideo"), idMVideo, "musicvideo", "discart", cursor) + self.addOrUpdateArt(API().getArtwork(MBitem, "Backdrop", mediaType = "musicvideo"), idMVideo, "musicvideo", "fanart", cursor) #update genres self.AddGenresToMedia(idMVideo, genres, "musicvideo", cursor) @@ -418,7 +418,7 @@ class WriteKodiVideoDB(): timeInfo = API().getTimeInfo(MBitem) userData=API().getUserData(MBitem) - thumbPath = API().getArtwork(MBitem, "Primary") + #thumbPath = API().getArtwork(MBitem, "Primary") # If the item already exist in the local Kodi DB we'll perform a full item update # If the item doesn't exist, we'll add it to the database @@ -540,14 +540,14 @@ class WriteKodiVideoDB(): self.AddTagToMedia(showid, "Favorite tvshows", "tvshow", cursor, True) #update artwork - self.addOrUpdateArt(API().getArtwork(MBitem, "Primary"), showid, "tvshow", "thumb", cursor) - self.addOrUpdateArt(API().getArtwork(MBitem, "Primary"), showid, "tvshow", "poster", cursor) - self.addOrUpdateArt(API().getArtwork(MBitem, "Banner"), showid, "tvshow", "banner", cursor) - self.addOrUpdateArt(API().getArtwork(MBitem, "Logo"), showid, "tvshow", "clearlogo", cursor) - self.addOrUpdateArt(API().getArtwork(MBitem, "Art"), showid, "tvshow", "clearart", cursor) - self.addOrUpdateArt(API().getArtwork(MBitem, "Thumb"), showid, "tvshow", "landscape", cursor) - self.addOrUpdateArt(API().getArtwork(MBitem, "Disc"), showid, "tvshow", "discart", cursor) - self.addOrUpdateArt(API().getArtwork(MBitem, "Backdrop"), showid, "tvshow", "fanart", cursor) + self.addOrUpdateArt(API().getArtwork(MBitem, "Primary", mediaType = "tvshow"), showid, "tvshow", "thumb", cursor) + self.addOrUpdateArt(API().getArtwork(MBitem, "Primary", mediaType = "tvshow"), showid, "tvshow", "poster", cursor) + self.addOrUpdateArt(API().getArtwork(MBitem, "Banner", mediaType = "tvshow"), showid, "tvshow", "banner", cursor) + self.addOrUpdateArt(API().getArtwork(MBitem, "Logo", mediaType = "tvshow"), showid, "tvshow", "clearlogo", cursor) + self.addOrUpdateArt(API().getArtwork(MBitem, "Art", mediaType = "tvshow"), showid, "tvshow", "clearart", cursor) + self.addOrUpdateArt(API().getArtwork(MBitem, "Thumb", mediaType = "tvshow"), showid, "tvshow", "landscape", cursor) + self.addOrUpdateArt(API().getArtwork(MBitem, "Disc", mediaType = "tvshow"), showid, "tvshow", "discart", cursor) + self.addOrUpdateArt(API().getArtwork(MBitem, "Backdrop", mediaType = "tvshow"), showid, "tvshow", "fanart", cursor) #update season details self.updateSeasons(MBitem["Id"], showid, connection, cursor) @@ -705,7 +705,7 @@ class WriteKodiVideoDB(): self.AddStreamDetailsToMedia(API().getMediaStreams(MBitem), fileid, cursor) #update artwork - self.addOrUpdateArt(API().getArtwork(MBitem, "Primary"), episodeid, "episode", "thumb", cursor) + self.addOrUpdateArt(API().getArtwork(MBitem, "Primary", mediaType = "episode"), episodeid, "episode", "thumb", cursor) def deleteItemFromKodiLibrary(self, id, connection, cursor ): @@ -749,13 +749,13 @@ class WriteKodiVideoDB(): seasonid = result[0] #update artwork - imageUrl = API().getArtwork(season, "Thumb") + imageUrl = API().getArtwork(season, "Thumb", mediaType = "season") self.addOrUpdateArt(imageUrl, seasonid, "season", "landscape", cursor) - imageUrl = API().getArtwork(season, "Primary") + imageUrl = API().getArtwork(season, "Primary", mediaType = "season") self.addOrUpdateArt(imageUrl, seasonid, "season", "poster", cursor) - imageUrl = API().getArtwork(season, "Banner") + imageUrl = API().getArtwork(season, "Banner", mediaType = "season") self.addOrUpdateArt(imageUrl, seasonid, "season", "banner", cursor) # Set All season poster MBitem = ReadEmbyDB().getFullItem(embyTvShowId) @@ -770,7 +770,7 @@ class WriteKodiVideoDB(): cursor.execute("INSERT into seasons(idSeason, idShow, season) values(?, ?, ?)", (seasonid, kodiTvShowId, seasonNum)) else: seasonid = result[0] - imageUrl = API().getArtwork(MBitem, "Primary") + imageUrl = API().getArtwork(MBitem, "Primary", mediaType = "season") self.addOrUpdateArt(imageUrl, seasonid, "season", "poster", cursor) def addOrUpdateArt(self, imageUrl, kodiId, mediaType, imageType, cursor): @@ -1147,13 +1147,13 @@ class WriteKodiVideoDB(): existing_type_map[row[0] ] = row[1] artwork = {} - artwork["poster"] = API().getArtwork(boxset, "Primary") - artwork["banner"] = API().getArtwork(boxset, "Banner") - artwork["clearlogo"] = API().getArtwork(boxset, "Logo") - artwork["clearart"] = API().getArtwork(boxset, "Art") - artwork["landscape"] = API().getArtwork(boxset, "Thumb") - artwork["discart"] = API().getArtwork(boxset, "Disc") - artwork["fanart"] = API().getArtwork(boxset, "Backdrop") + artwork["poster"] = API().getArtwork(boxset, "Primary", mediaType = "boxset") + artwork["banner"] = API().getArtwork(boxset, "Banner", mediaType = "boxset") + artwork["clearlogo"] = API().getArtwork(boxset, "Logo", mediaType = "boxset") + artwork["clearart"] = API().getArtwork(boxset, "Art", mediaType = "boxset") + artwork["landscape"] = API().getArtwork(boxset, "Thumb", mediaType = "boxset") + artwork["discart"] = API().getArtwork(boxset, "Disc", mediaType = "boxset") + artwork["fanart"] = API().getArtwork(boxset, "Backdrop", mediaType = "boxset") art_types = ['poster','fanart','landscape','clearlogo','clearart','banner','discart'] for update_type in art_types: @@ -1184,13 +1184,13 @@ class WriteKodiVideoDB(): existing_type_map[row[0] ] = row[1] artwork = {} - artwork["poster"] = API().getArtwork(boxset, "Primary") - artwork["banner"] = API().getArtwork(boxset, "Banner") - artwork["clearlogo"] = API().getArtwork(boxset, "Logo") - artwork["clearart"] = API().getArtwork(boxset, "Art") - artwork["landscape"] = API().getArtwork(boxset, "Thumb") - artwork["discart"] = API().getArtwork(boxset, "Disc") - artwork["fanart"] = API().getArtwork(boxset, "Backdrop") + artwork["poster"] = API().getArtwork(boxset, "Primary", mediaType = "boxset") + artwork["banner"] = API().getArtwork(boxset, "Banner", mediaType = "boxset") + artwork["clearlogo"] = API().getArtwork(boxset, "Logo", mediaType = "boxset") + artwork["clearart"] = API().getArtwork(boxset, "Art", mediaType = "boxset") + artwork["landscape"] = API().getArtwork(boxset, "Thumb", mediaType = "boxset") + artwork["discart"] = API().getArtwork(boxset, "Disc", mediaType = "boxset") + artwork["fanart"] = API().getArtwork(boxset, "Backdrop", mediaType = "boxset") art_types = ['poster','fanart','landscape','clearlogo','clearart','banner','discart'] for update_type in art_types: diff --git a/resources/settings.xml b/resources/settings.xml index 32a2d37f..6eaca198 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -33,6 +33,7 @@ +