mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 02:06:09 +00:00
added extra fanart sync
This commit is contained in:
parent
03416513cf
commit
28862b309c
4 changed files with 56 additions and 1 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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"])
|
||||
|
||||
|
|
|
@ -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