mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 10:16:11 +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":
|
if mediasources[0]["Container"] == "mp3":
|
||||||
themeUrl = PlayUtils().getPlayUrl(server,themeItems[0]["Id"],themeItems[0])
|
themeUrl = PlayUtils().getPlayUrl(server,themeItems[0]["Id"],themeItems[0])
|
||||||
xbmcvfs.copy(themeUrl,themeFile)
|
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):
|
def CleanName(self, filename):
|
||||||
validFilenameChars = "-_.() %s%s" % (string.ascii_letters, string.digits)
|
validFilenameChars = "-_.() %s%s" % (string.ascii_letters, string.digits)
|
||||||
|
|
|
@ -87,6 +87,23 @@ class ReadEmbyDB():
|
||||||
|
|
||||||
return result
|
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):
|
def getTVShows(self, fullinfo = False, fullSync = False):
|
||||||
result = None
|
result = None
|
||||||
|
|
||||||
|
|
|
@ -171,6 +171,10 @@ class WriteKodiDB():
|
||||||
#add theme music
|
#add theme music
|
||||||
if addon.getSetting("syncThemeMusic") == "true":
|
if addon.getSetting("syncThemeMusic") == "true":
|
||||||
CreateFiles().copyThemeMusic(MBitem)
|
CreateFiles().copyThemeMusic(MBitem)
|
||||||
|
|
||||||
|
#add extra fanart
|
||||||
|
if addon.getSetting("syncExtraFanart") == "true":
|
||||||
|
CreateFiles().copyExtraFanart(MBitem)
|
||||||
|
|
||||||
if(changes):
|
if(changes):
|
||||||
utils.logMsg("Updated item to Kodi Library", MBitem["Id"] + " - " + MBitem["Name"], level=0)
|
utils.logMsg("Updated item to Kodi Library", MBitem["Id"] + " - " + MBitem["Name"], level=0)
|
||||||
|
@ -314,6 +318,10 @@ class WriteKodiDB():
|
||||||
#add theme music
|
#add theme music
|
||||||
if addon.getSetting("syncThemeMusic") == "true":
|
if addon.getSetting("syncThemeMusic") == "true":
|
||||||
CreateFiles().copyThemeMusic(MBitem)
|
CreateFiles().copyThemeMusic(MBitem)
|
||||||
|
|
||||||
|
#add extra fanart
|
||||||
|
if addon.getSetting("syncExtraFanart") == "true":
|
||||||
|
CreateFiles().copyExtraFanart(MBitem)
|
||||||
|
|
||||||
if changes:
|
if changes:
|
||||||
utils.logMsg("Updated item to Kodi Library", MBitem["Id"] + " - " + MBitem["Name"])
|
utils.logMsg("Updated item to Kodi Library", MBitem["Id"] + " - " + MBitem["Name"])
|
||||||
|
@ -380,6 +388,10 @@ class WriteKodiDB():
|
||||||
if addon.getSetting("syncThemeMusic") == "true":
|
if addon.getSetting("syncThemeMusic") == "true":
|
||||||
CreateFiles().copyThemeMusic(MBitem)
|
CreateFiles().copyThemeMusic(MBitem)
|
||||||
|
|
||||||
|
#add extra fanart
|
||||||
|
if addon.getSetting("syncExtraFanart") == "true":
|
||||||
|
CreateFiles().copyExtraFanart(MBitem)
|
||||||
|
|
||||||
if changes:
|
if changes:
|
||||||
utils.logMsg("Updated item to Kodi Library", MBitem["Id"] + " - " + MBitem["Name"])
|
utils.logMsg("Updated item to Kodi Library", MBitem["Id"] + " - " + MBitem["Name"])
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
<category label="30235"> <!-- Extra Sync options -->
|
<category label="30235"> <!-- Extra Sync options -->
|
||||||
<setting id="syncThemeMusic" type="bool" label="30236" default="false" visible="true" enable="true" />
|
<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>
|
||||||
|
|
||||||
<category label="30022"> <!-- Advanced -->
|
<category label="30022"> <!-- Advanced -->
|
||||||
|
|
Loading…
Reference in a new issue