diff --git a/resources/lib/CreateFiles.py b/resources/lib/CreateFiles.py
index fdb8f9fd..63a6239d 100644
--- a/resources/lib/CreateFiles.py
+++ b/resources/lib/CreateFiles.py
@@ -299,6 +299,32 @@ class CreateFiles():
if mediasources[0]["Container"] == "mp3":
themeUrl = PlayUtils().getPlayUrl(server,themeItems[0]["Id"],themeItems[0])
xbmcvfs.copy(themeUrl,themeFile)
+
+ def copyExtraFanart(self,item):
+ downloadUtils = DownloadUtils()
+ userid = downloadUtils.getUserId()
+ port = addon.getSetting('port')
+ host = addon.getSetting('ipaddress')
+ server = host + ":" + port
+ item_type=str(item.get("Type"))
+
+ if item_type == "Movie":
+ itemPath = os.path.join(movieLibrary,item["Id"])
+ fanartDir = os.path.join(itemPath,"extrafanart" + os.sep)
+ if item_type == "Series":
+ itemPath = os.path.join(tvLibrary,item["Id"])
+ fanartDir = os.path.join(itemPath,"extrafanart" + os.sep)
+
+ if not xbmcvfs.exists(fanartDir):
+ utils.logMsg("MB3 Syncer","creating extrafanart directory ",2)
+ xbmcvfs.mkdir(fanartDir)
+ fullItem = ReadEmbyDB().getFullItem(item["Id"])
+ if(fullItem != None and fullItem["BackdropImageTags"] != None and len(fullItem["BackdropImageTags"]) > 1):
+ totalbackdrops = len(fullItem["BackdropImageTags"])
+ for index in range(1,totalbackdrops):
+ backgroundUrl = API().getArtwork(fullItem, "Backdrop",str(index))
+ fanartFile = os.path.join(fanartDir,"fanart" + str(index) + ".jpg")
+ xbmcvfs.copy(backgroundUrl,fanartFile)
def CleanName(self, filename):
validFilenameChars = "-_.() %s%s" % (string.ascii_letters, string.digits)
diff --git a/resources/lib/ReadEmbyDB.py b/resources/lib/ReadEmbyDB.py
index efc54838..232f3242 100644
--- a/resources/lib/ReadEmbyDB.py
+++ b/resources/lib/ReadEmbyDB.py
@@ -87,6 +87,23 @@ class ReadEmbyDB():
return result
+ def getFullItem(self, id):
+ result = None
+
+ addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
+ port = addon.getSetting('port')
+ host = addon.getSetting('ipaddress')
+ server = host + ":" + port
+
+ downloadUtils = DownloadUtils()
+ userid = downloadUtils.getUserId()
+
+ jsonData = downloadUtils.downloadUrl("http://" + server + "/mediabrowser/Users/" + userid + "/Items/" + id + "?format=json", suppress=False, popup=1 )
+ if jsonData != None and jsonData != "":
+ result = json.loads(jsonData)
+
+ return result
+
def getTVShows(self, fullinfo = False, fullSync = False):
result = None
diff --git a/resources/lib/WriteKodiDB.py b/resources/lib/WriteKodiDB.py
index 143cdb2d..fee8406c 100644
--- a/resources/lib/WriteKodiDB.py
+++ b/resources/lib/WriteKodiDB.py
@@ -171,6 +171,10 @@ class WriteKodiDB():
#add theme music
if addon.getSetting("syncThemeMusic") == "true":
CreateFiles().copyThemeMusic(MBitem)
+
+ #add extra fanart
+ if addon.getSetting("syncExtraFanart") == "true":
+ CreateFiles().copyExtraFanart(MBitem)
if(changes):
utils.logMsg("Updated item to Kodi Library", MBitem["Id"] + " - " + MBitem["Name"], level=0)
@@ -314,6 +318,10 @@ class WriteKodiDB():
#add theme music
if addon.getSetting("syncThemeMusic") == "true":
CreateFiles().copyThemeMusic(MBitem)
+
+ #add extra fanart
+ if addon.getSetting("syncExtraFanart") == "true":
+ CreateFiles().copyExtraFanart(MBitem)
if changes:
utils.logMsg("Updated item to Kodi Library", MBitem["Id"] + " - " + MBitem["Name"])
@@ -380,6 +388,10 @@ class WriteKodiDB():
if addon.getSetting("syncThemeMusic") == "true":
CreateFiles().copyThemeMusic(MBitem)
+ #add extra fanart
+ if addon.getSetting("syncExtraFanart") == "true":
+ CreateFiles().copyExtraFanart(MBitem)
+
if changes:
utils.logMsg("Updated item to Kodi Library", MBitem["Id"] + " - " + MBitem["Name"])
diff --git a/resources/settings.xml b/resources/settings.xml
index db460547..805b0cce 100644
--- a/resources/settings.xml
+++ b/resources/settings.xml
@@ -27,7 +27,7 @@
-
+