mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-26 02:36:10 +00:00
added copying theme music - plus workaround for reported boxset issues
This commit is contained in:
parent
1ca1c55345
commit
851e65374b
2 changed files with 39 additions and 1 deletions
|
@ -265,6 +265,37 @@ class CreateFiles():
|
||||||
|
|
||||||
return changes
|
return changes
|
||||||
|
|
||||||
|
def copyThemeMusic(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"])
|
||||||
|
themeFile = os.path.join(itemPath,"theme.mp3")
|
||||||
|
if item_type == "Series":
|
||||||
|
itemPath = os.path.join(tvLibrary,item["Id"])
|
||||||
|
themeFile = os.path.join(itemPath,"theme.mp3")
|
||||||
|
|
||||||
|
|
||||||
|
if not xbmcvfs.exists(themeFile):
|
||||||
|
utils.logMsg("MB3 Syncer","creating Theme file " + themeFile,2)
|
||||||
|
#theme music link
|
||||||
|
themeMusicUrl = "http://" + server + "/mediabrowser/Items/" + item["Id"] + "/ThemeSongs?format=json"
|
||||||
|
jsonData = downloadUtils.downloadUrl(themeMusicUrl, suppress=True, popup=0 )
|
||||||
|
if(jsonData != ""):
|
||||||
|
themeMusic = json.loads(jsonData)
|
||||||
|
if(themeMusic != None and themeMusic["TotalRecordCount"] > 0):
|
||||||
|
themeItems = themeMusic["Items"]
|
||||||
|
if themeItems[0] != None:
|
||||||
|
mediasources = themeItems[0]["MediaSources"]
|
||||||
|
if mediasources[0]["Container"] == "mp3":
|
||||||
|
themeUrl = PlayUtils().getPlayUrl(server,themeItems[0]["Id"],themeItems[0])
|
||||||
|
xbmcvfs.copy(themeUrl,themeFile)
|
||||||
|
|
||||||
def CleanName(self, name):
|
def CleanName(self, name):
|
||||||
name = name.replace(":", "-")
|
name = name.replace(":", "-")
|
||||||
name = name.replace("\\", "-")
|
name = name.replace("\\", "-")
|
||||||
|
|
|
@ -683,6 +683,9 @@ class WriteKodiDB():
|
||||||
# create strm file
|
# create strm file
|
||||||
changes |= CreateFiles().createSTRM(item)
|
changes |= CreateFiles().createSTRM(item)
|
||||||
|
|
||||||
|
#add theme music
|
||||||
|
CreateFiles().copyThemeMusic(item)
|
||||||
|
|
||||||
if changes:
|
if changes:
|
||||||
utils.logMsg("MB3 Sync","Added movie to Kodi Library",item["Id"] + " - " + item["Name"])
|
utils.logMsg("MB3 Sync","Added movie to Kodi Library",item["Id"] + " - " + item["Name"])
|
||||||
|
|
||||||
|
@ -768,6 +771,9 @@ class WriteKodiDB():
|
||||||
#create nfo file
|
#create nfo file
|
||||||
changes = CreateFiles().createNFO(item)
|
changes = CreateFiles().createNFO(item)
|
||||||
|
|
||||||
|
#add theme music
|
||||||
|
CreateFiles().copyThemeMusic(item)
|
||||||
|
|
||||||
if changes:
|
if changes:
|
||||||
utils.logMsg("Added TV Show to Kodi Library ",item["Id"] + " - " + item["Name"])
|
utils.logMsg("Added TV Show to Kodi Library ",item["Id"] + " - " + item["Name"])
|
||||||
|
|
||||||
|
@ -972,4 +978,5 @@ class WriteKodiDB():
|
||||||
def updateBoxsetToKodiLibrary(self, boxsetmovie, boxset):
|
def updateBoxsetToKodiLibrary(self, boxsetmovie, boxset):
|
||||||
strSet = boxset["Name"]
|
strSet = boxset["Name"]
|
||||||
kodiMovie = ReadKodiDB().getKodiMovie(boxsetmovie["Id"])
|
kodiMovie = ReadKodiDB().getKodiMovie(boxsetmovie["Id"])
|
||||||
|
if kodiMovie != None:
|
||||||
WriteKodiDB().updateProperty(kodiMovie,"set",strSet,"movie",True)
|
WriteKodiDB().updateProperty(kodiMovie,"set",strSet,"movie",True)
|
Loading…
Reference in a new issue