mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 12:16:12 +00:00
tv tunes now accepts both music/video themes in the same nfo
This commit is contained in:
parent
6e56d259d4
commit
f946f7ba69
2 changed files with 22 additions and 9 deletions
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<addon id="plugin.video.emby"
|
<addon id="plugin.video.emby"
|
||||||
name="Emby"
|
name="Emby"
|
||||||
version="1.0.13"
|
version="1.0.14"
|
||||||
provider-name="Emby.media">
|
provider-name="Emby.media">
|
||||||
<requires>
|
<requires>
|
||||||
<import addon="xbmc.python" version="2.1.0"/>
|
<import addon="xbmc.python" version="2.1.0"/>
|
||||||
|
|
|
@ -201,6 +201,18 @@ def getThemeMedia():
|
||||||
playurl = playUtils.directStream(result, server, theme[u'Id'])
|
playurl = playUtils.directStream(result, server, theme[u'Id'])
|
||||||
pathstowrite += ('<file>%s</file>' % playurl.encode('utf-8'))
|
pathstowrite += ('<file>%s</file>' % playurl.encode('utf-8'))
|
||||||
|
|
||||||
|
# Check if the item has theme songs and add them
|
||||||
|
url = "{server}/mediabrowser/Items/%s/ThemeSongs?format=json" % itemId
|
||||||
|
result = doUtils.downloadUrl(url)
|
||||||
|
|
||||||
|
# May be more than one theme
|
||||||
|
for theme in result[u'Items']:
|
||||||
|
if playback == "DirectPlay":
|
||||||
|
playurl = playUtils.directPlay(theme)
|
||||||
|
else:
|
||||||
|
playurl = playUtils.directStream(result, server, theme[u'Id'], "Audio")
|
||||||
|
pathstowrite += ('<file>%s</file>' % playurl.encode('utf-8'))
|
||||||
|
|
||||||
nfo_file.write(
|
nfo_file.write(
|
||||||
'<tvtunes>%s</tvtunes>' % pathstowrite
|
'<tvtunes>%s</tvtunes>' % pathstowrite
|
||||||
)
|
)
|
||||||
|
@ -208,7 +220,7 @@ def getThemeMedia():
|
||||||
nfo_file.close()
|
nfo_file.close()
|
||||||
|
|
||||||
# Get Ids with Theme songs
|
# Get Ids with Theme songs
|
||||||
itemIds = {}
|
musicitemIds = {}
|
||||||
for view in userViews:
|
for view in userViews:
|
||||||
url = "{server}/mediabrowser/Users/{UserId}/Items?HasThemeSong=True&ParentId=%s&format=json" % view
|
url = "{server}/mediabrowser/Users/{UserId}/Items?HasThemeSong=True&ParentId=%s&format=json" % view
|
||||||
result = doUtils.downloadUrl(url)
|
result = doUtils.downloadUrl(url)
|
||||||
|
@ -217,21 +229,22 @@ def getThemeMedia():
|
||||||
itemId = item[u'Id']
|
itemId = item[u'Id']
|
||||||
folderName = item[u'Name']
|
folderName = item[u'Name']
|
||||||
folderName = utils.normalize_string(folderName.encode('utf-8'))
|
folderName = utils.normalize_string(folderName.encode('utf-8'))
|
||||||
itemIds[itemId] = folderName
|
musicitemIds[itemId] = folderName
|
||||||
|
|
||||||
# Get paths
|
# Get paths
|
||||||
for itemId in itemIds:
|
for itemId in musicitemIds:
|
||||||
nfo_path = xbmc.translatePath("special://profile/addon_data/plugin.video.emby/library/%s/" % itemIds[itemId])
|
|
||||||
|
# if the item was already processed with video themes back out
|
||||||
|
if itemId in itemIds:
|
||||||
|
continue
|
||||||
|
|
||||||
|
nfo_path = xbmc.translatePath("special://profile/addon_data/plugin.video.emby/library/%s/" % musicitemIds[itemId])
|
||||||
# Create folders for each content
|
# Create folders for each content
|
||||||
if not xbmcvfs.exists(nfo_path):
|
if not xbmcvfs.exists(nfo_path):
|
||||||
xbmcvfs.mkdir(nfo_path)
|
xbmcvfs.mkdir(nfo_path)
|
||||||
# Where to put the nfos
|
# Where to put the nfos
|
||||||
nfo_path = "%s%s" % (nfo_path, "tvtunes.nfo")
|
nfo_path = "%s%s" % (nfo_path, "tvtunes.nfo")
|
||||||
|
|
||||||
# if the nfo already exists assume a theme video was added so back out because if both are added it rotates between theme video and theme music
|
|
||||||
if xbmcvfs.exists(nfo_path):
|
|
||||||
continue
|
|
||||||
|
|
||||||
url = "{server}/mediabrowser/Items/%s/ThemeSongs?format=json" % itemId
|
url = "{server}/mediabrowser/Items/%s/ThemeSongs?format=json" % itemId
|
||||||
result = doUtils.downloadUrl(url)
|
result = doUtils.downloadUrl(url)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue