added extra fanart sync
This commit is contained in:
parent
03416513cf
commit
28862b309c
4 changed files with 56 additions and 1 deletions
|
@ -300,6 +300,32 @@ class CreateFiles():
|
|||
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)
|
||||
cleanedFilename = unicodedata.normalize('NFKD', filename).encode('ASCII', 'ignore')
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -172,6 +172,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"], level=0)
|
||||
|
||||
|
@ -315,6 +319,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"])
|
||||
|
||||
|
@ -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"])
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
<category label="30235"> <!-- Extra Sync options -->
|
||||
<setting id="syncThemeMusic" type="bool" label="30236" default="false" visible="true" enable="true" />
|
||||
<!-- <setting id="syncExtraFanart" type="bool" label="30237" default="false" visible="true" enable="true" /> -->
|
||||
<setting id="syncExtraFanart" type="bool" label="30237" default="false" visible="true" enable="true" />
|
||||
</category>
|
||||
|
||||
<category label="30022"> <!-- Advanced -->
|
||||
|
|
Loading…
Reference in a new issue