tv tunes now accepts both music/video themes in the same nfo

This commit is contained in:
im85288 2015-06-22 20:18:00 +01:00
parent 6e56d259d4
commit f946f7ba69
2 changed files with 22 additions and 9 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.emby"
name="Emby"
version="1.0.13"
version="1.0.14"
provider-name="Emby.media">
<requires>
<import addon="xbmc.python" version="2.1.0"/>

View File

@ -201,6 +201,18 @@ def getThemeMedia():
playurl = playUtils.directStream(result, server, theme[u'Id'])
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(
'<tvtunes>%s</tvtunes>' % pathstowrite
)
@ -208,7 +220,7 @@ def getThemeMedia():
nfo_file.close()
# Get Ids with Theme songs
itemIds = {}
musicitemIds = {}
for view in userViews:
url = "{server}/mediabrowser/Users/{UserId}/Items?HasThemeSong=True&ParentId=%s&format=json" % view
result = doUtils.downloadUrl(url)
@ -217,21 +229,22 @@ def getThemeMedia():
itemId = item[u'Id']
folderName = item[u'Name']
folderName = utils.normalize_string(folderName.encode('utf-8'))
itemIds[itemId] = folderName
musicitemIds[itemId] = folderName
# Get paths
for itemId in itemIds:
nfo_path = xbmc.translatePath("special://profile/addon_data/plugin.video.emby/library/%s/" % itemIds[itemId])
for itemId in musicitemIds:
# 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
if not xbmcvfs.exists(nfo_path):
xbmcvfs.mkdir(nfo_path)
# Where to put the nfos
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
result = doUtils.downloadUrl(url)