Nest emby video nodes logically (#55)

* Nest emby video nodes logically

* Node cleanup
This commit is contained in:
delphiactual 2016-11-04 04:14:35 -06:00 committed by angelblue05
parent 4f7c63d5df
commit 83ab855999
2 changed files with 13 additions and 6 deletions

View file

@ -47,11 +47,11 @@ def window(property_, value=None, clear=False, window_id=10000):
def settings(setting, value=None): def settings(setting, value=None):
# Get or add addon setting # Get or add addon setting
addon = xbmcaddon.Addon(id='plugin.video.emby') addon = xbmcaddon.Addon(id='plugin.video.emby')
if value is not None: if value is not None:
addon.setSetting(setting, value) addon.setSetting(setting, value)
else: # returns unicode object else: # returns unicode object
return addon.getSetting(setting) return addon.getSetting(setting)
def language(string_id): def language(string_id):
# Central string retrieval - unicode # Central string retrieval - unicode
@ -572,6 +572,13 @@ def deleteNodes():
# Clean up video nodes # Clean up video nodes
import shutil import shutil
path = xbmc.translatePath("special://profile/library/video/emby/").decode('utf-8')
if (xbmcvfs.exists(path)):
try:
shutil.rmtree(path)
except:
log.warn("Failed to delete directory: %s" % path)
# Old cleanup code kept for cleanup of old style nodes
path = xbmc.translatePath("special://profile/library/video/").decode('utf-8') path = xbmc.translatePath("special://profile/library/video/").decode('utf-8')
dirs, files = xbmcvfs.listdir(path) dirs, files = xbmcvfs.listdir(path)
for dir in dirs: for dir in dirs:

View file

@ -58,7 +58,7 @@ class VideoNodes(object):
path = xbmc.translatePath("special://profile/library/video/").decode('utf-8') path = xbmc.translatePath("special://profile/library/video/").decode('utf-8')
nodepath = xbmc.translatePath( nodepath = xbmc.translatePath(
"special://profile/library/video/Emby - %s/" % dirname).decode('utf-8') "special://profile/library/video/emby/%s/" % dirname).decode('utf-8')
# Verify the video directory # Verify the video directory
if not xbmcvfs.exists(path): if not xbmcvfs.exists(path):
@ -86,7 +86,7 @@ class VideoNodes(object):
# Create index entry # Create index entry
nodeXML = "%sindex.xml" % nodepath nodeXML = "%sindex.xml" % nodepath
# Set windows property # Set windows property
path = "library://video/Emby - %s/" % dirname path = "library://video/emby/%s/" % dirname
for i in range(1, indexnumber): for i in range(1, indexnumber):
# Verify to make sure we don't create duplicates # Verify to make sure we don't create duplicates
if window('Emby.nodes.%s.index' % i) == path: if window('Emby.nodes.%s.index' % i) == path:
@ -178,7 +178,7 @@ class VideoNodes(object):
for node in nodes: for node in nodes:
nodetype = nodetypes[node] nodetype = nodetypes[node]
nodeXML = "%s%s_%s.xml" % (nodepath, viewid, nodetype) nodeXML = "%s%s.xml" % (nodepath, nodetype)
# Get label # Get label
stringid = nodes[node] stringid = nodes[node]
if node != "1": if node != "1":
@ -207,7 +207,7 @@ class VideoNodes(object):
# Custom query # Custom query
path = "plugin://plugin.video.emby/?id=%s&mode=inprogressepisodes&limit=25"% tagname path = "plugin://plugin.video.emby/?id=%s&mode=inprogressepisodes&limit=25"% tagname
else: else:
path = "library://video/Emby - %s/%s_%s.xml" % (dirname, viewid, nodetype) path = "library://video/emby/%s/%s.xml" % (viewid, nodetype)
if mediatype == "photos": if mediatype == "photos":
windowpath = "ActivateWindow(Pictures,%s,return)" % path windowpath = "ActivateWindow(Pictures,%s,return)" % path