Attempt to fix video nodes.
Still getting 18:55:33 T:7956 ERROR: XFILE::CDirectory::GetDirectory - Error getting library://video/Plex-1/1_sets.xml/ 18:55:33 T:7956 ERROR: CGUIMediaWindow::GetDirectory(library://video/Plex-1/1_sets.xml/) failed
This commit is contained in:
parent
91c5cb4608
commit
525c59c75b
3 changed files with 47 additions and 49 deletions
|
@ -1910,10 +1910,10 @@ class Music(Items):
|
||||||
|
|
||||||
# Plex works a bit differently
|
# Plex works a bit differently
|
||||||
# if self.directstream:
|
# if self.directstream:
|
||||||
paths = "%s%s" % (self.server, item[0][0].attrib.get('key'))
|
path = "%s%s" % (self.server, item[0][0].attrib.get('key'))
|
||||||
paths = paths.rsplit('/', 1)
|
filename = API.addPlexCredentialsToUrl(path)
|
||||||
path = paths[0] + '/'
|
# Keep path empty to not let Kodi scan it
|
||||||
filename = API.addPlexCredentialsToUrl(paths[1])
|
path = None
|
||||||
# else:
|
# else:
|
||||||
# path = "plugin://plugin.audio.plexkodiconnect.music/"
|
# path = "plugin://plugin.audio.plexkodiconnect.music/"
|
||||||
# filename = API.getKey()
|
# filename = API.getKey()
|
||||||
|
|
|
@ -416,6 +416,7 @@ class LibrarySync(Thread):
|
||||||
|
|
||||||
# Get current media folders from emby database
|
# Get current media folders from emby database
|
||||||
view = emby_db.getView_byId(folderid)
|
view = emby_db.getView_byId(folderid)
|
||||||
|
self.logMsg("playlist: %s, nodes: %s, sorted_views: %s, folderid: %s, foldername: %s, viewtype: %s" % (playlists, nodes, sorted_views, folderid, foldername, viewtype))
|
||||||
try:
|
try:
|
||||||
current_viewname = view[0]
|
current_viewname = view[0]
|
||||||
current_viewtype = view[1]
|
current_viewtype = view[1]
|
||||||
|
@ -547,13 +548,22 @@ class LibrarySync(Thread):
|
||||||
# total nodes for window properties
|
# total nodes for window properties
|
||||||
vnodes.clearProperties()
|
vnodes.clearProperties()
|
||||||
totalnodes = 0
|
totalnodes = 0
|
||||||
|
# For whatever freaking reason, .copy() or dict() does NOT work?!?!?!
|
||||||
self.nodes = {
|
self.nodes = {
|
||||||
'movie': [],
|
'movie': [],
|
||||||
'show': [],
|
'show': [],
|
||||||
'artist': []
|
'artist': []
|
||||||
}
|
}
|
||||||
self.playlists = self.nodes.copy()
|
self.playlists = {
|
||||||
self.sorted_views = self.nodes.copy()
|
'movie': [],
|
||||||
|
'show': [],
|
||||||
|
'artist': []
|
||||||
|
}
|
||||||
|
self.sorted_views = {
|
||||||
|
'movie': [],
|
||||||
|
'show': [],
|
||||||
|
'artist': []
|
||||||
|
}
|
||||||
|
|
||||||
for view in sections:
|
for view in sections:
|
||||||
itemType = view.attrib['type']
|
itemType = view.attrib['type']
|
||||||
|
|
|
@ -1,36 +1,24 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
#################################################################################################
|
###############################################################################
|
||||||
|
|
||||||
import shutil
|
import shutil
|
||||||
import xml.etree.ElementTree as etree
|
import xml.etree.ElementTree as etree
|
||||||
|
|
||||||
import xbmc
|
import xbmc
|
||||||
import xbmcaddon
|
|
||||||
import xbmcvfs
|
import xbmcvfs
|
||||||
|
|
||||||
import clientinfo
|
|
||||||
import utils
|
import utils
|
||||||
|
|
||||||
#################################################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
|
||||||
|
@utils.logging
|
||||||
class VideoNodes(object):
|
class VideoNodes(object):
|
||||||
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
||||||
clientInfo = clientinfo.ClientInfo()
|
|
||||||
self.addonName = clientInfo.getAddonName()
|
|
||||||
|
|
||||||
self.kodiversion = int(xbmc.getInfoLabel('System.BuildVersion')[:2])
|
self.kodiversion = int(xbmc.getInfoLabel('System.BuildVersion')[:2])
|
||||||
|
|
||||||
def logMsg(self, msg, lvl=1):
|
|
||||||
|
|
||||||
className = self.__class__.__name__
|
|
||||||
utils.logMsg("%s %s" % (self.addonName, className), msg, lvl)
|
|
||||||
|
|
||||||
|
|
||||||
def commonRoot(self, order, label, tagname, roottype=1):
|
def commonRoot(self, order, label, tagname, roottype=1):
|
||||||
|
|
||||||
if roottype == 0:
|
if roottype == 0:
|
||||||
|
@ -48,7 +36,7 @@ class VideoNodes(object):
|
||||||
root = etree.Element('node', attrib={'order': "%s" % order, 'type': "folder"})
|
root = etree.Element('node', attrib={'order': "%s" % order, 'type': "folder"})
|
||||||
|
|
||||||
etree.SubElement(root, 'label').text = label
|
etree.SubElement(root, 'label').text = label
|
||||||
etree.SubElement(root, 'icon').text = "special://home/addons/plugin.video.emby/icon.png"
|
etree.SubElement(root, 'icon').text = "special://home/addons/plugin.video.plexkodiconnect/icon.png"
|
||||||
|
|
||||||
return root
|
return root
|
||||||
|
|
||||||
|
@ -58,13 +46,13 @@ class VideoNodes(object):
|
||||||
kodiversion = self.kodiversion
|
kodiversion = self.kodiversion
|
||||||
|
|
||||||
if viewtype == "mixed":
|
if viewtype == "mixed":
|
||||||
dirname = "%s - %s" % (viewid, mediatype)
|
dirname = "%s-%s" % (viewid, mediatype)
|
||||||
else:
|
else:
|
||||||
dirname = viewid
|
dirname = viewid
|
||||||
|
|
||||||
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/Plex-%s/" % dirname).decode('utf-8')
|
||||||
|
|
||||||
# Verify the video directory
|
# Verify the video directory
|
||||||
if not xbmcvfs.exists(path):
|
if not xbmcvfs.exists(path):
|
||||||
|
@ -74,7 +62,7 @@ class VideoNodes(object):
|
||||||
xbmcvfs.exists(path)
|
xbmcvfs.exists(path)
|
||||||
|
|
||||||
# Create the node directory
|
# Create the node directory
|
||||||
if not xbmcvfs.exists(nodepath) and not mediatype == "photos":
|
if not xbmcvfs.exists(nodepath) and not mediatype == "photo":
|
||||||
# We need to copy over the default items
|
# We need to copy over the default items
|
||||||
xbmcvfs.mkdirs(nodepath)
|
xbmcvfs.mkdirs(nodepath)
|
||||||
else:
|
else:
|
||||||
|
@ -89,21 +77,21 @@ 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/Plex-%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:
|
||||||
return
|
return
|
||||||
|
|
||||||
if mediatype == "photos":
|
if mediatype == "photo":
|
||||||
path = "plugin://plugin.video.emby/?id=%s&mode=getsubfolders" % indexnumber
|
path = "plugin://plugin.video.plexkodiconnect/?id=%s&mode=getsubfolders" % indexnumber
|
||||||
|
|
||||||
window('Emby.nodes.%s.index' % indexnumber, value=path)
|
window('Emby.nodes.%s.index' % indexnumber, value=path)
|
||||||
|
|
||||||
# Root
|
# Root
|
||||||
if not mediatype == "photos":
|
if not mediatype == "photo":
|
||||||
if viewtype == "mixed":
|
if viewtype == "mixed":
|
||||||
specialtag = "%s - %s" % (tagname, mediatype)
|
specialtag = "%s-%s" % (tagname, mediatype)
|
||||||
root = self.commonRoot(order=0, label=specialtag, tagname=tagname, roottype=0)
|
root = self.commonRoot(order=0, label=specialtag, tagname=tagname, roottype=0)
|
||||||
else:
|
else:
|
||||||
root = self.commonRoot(order=0, label=tagname, tagname=tagname, roottype=0)
|
root = self.commonRoot(order=0, label=tagname, tagname=tagname, roottype=0)
|
||||||
|
@ -128,7 +116,7 @@ class VideoNodes(object):
|
||||||
}
|
}
|
||||||
mediatypes = {
|
mediatypes = {
|
||||||
# label according to nodetype per mediatype
|
# label according to nodetype per mediatype
|
||||||
'movies':
|
'movie':
|
||||||
{
|
{
|
||||||
'1': tagname,
|
'1': tagname,
|
||||||
'2': 30174,
|
'2': 30174,
|
||||||
|
@ -140,7 +128,7 @@ class VideoNodes(object):
|
||||||
'11': 30230
|
'11': 30230
|
||||||
},
|
},
|
||||||
|
|
||||||
'tvshows':
|
'show':
|
||||||
{
|
{
|
||||||
'1': tagname,
|
'1': tagname,
|
||||||
'2': 30170,
|
'2': 30170,
|
||||||
|
@ -160,7 +148,7 @@ class VideoNodes(object):
|
||||||
'11': 30253
|
'11': 30253
|
||||||
},
|
},
|
||||||
|
|
||||||
'photos':
|
'photo':
|
||||||
{
|
{
|
||||||
'1': tagname,
|
'1': tagname,
|
||||||
'2': 30252,
|
'2': 30252,
|
||||||
|
@ -192,27 +180,27 @@ class VideoNodes(object):
|
||||||
label = stringid
|
label = stringid
|
||||||
|
|
||||||
# Set window properties
|
# Set window properties
|
||||||
if (mediatype == "homevideos" or mediatype == "photos") and nodetype == "all":
|
if (mediatype == "homevideos" or mediatype == "photo") and nodetype == "all":
|
||||||
# Custom query
|
# Custom query
|
||||||
path = ("plugin://plugin.video.emby/?id=%s&mode=browsecontent&type=%s"
|
path = ("plugin://plugin.video.plexkodiconnect/?id=%s&mode=browsecontent&type=%s"
|
||||||
% (tagname, mediatype))
|
% (tagname, mediatype))
|
||||||
elif (mediatype == "homevideos" or mediatype == "photos"):
|
elif (mediatype == "homevideos" or mediatype == "photo"):
|
||||||
# Custom query
|
# Custom query
|
||||||
path = ("plugin://plugin.video.emby/?id=%s&mode=browsecontent&type=%s&folderid=%s"
|
path = ("plugin://plugin.video.plexkodiconnect/?id=%s&mode=browsecontent&type=%s&folderid=%s"
|
||||||
% (tagname, mediatype, nodetype))
|
% (tagname, mediatype, nodetype))
|
||||||
elif nodetype == "nextepisodes":
|
elif nodetype == "nextepisodes":
|
||||||
# Custom query
|
# Custom query
|
||||||
path = "plugin://plugin.video.emby/?id=%s&mode=nextup&limit=25" % tagname
|
path = "plugin://plugin.video.plexkodiconnect/?id=%s&mode=nextup&limit=50" % tagname
|
||||||
elif kodiversion == 14 and nodetype == "recentepisodes":
|
elif kodiversion == 14 and nodetype == "recentepisodes":
|
||||||
# Custom query
|
# Custom query
|
||||||
path = "plugin://plugin.video.emby/?id=%s&mode=recentepisodes&limit=25" % tagname
|
path = "plugin://plugin.video.plexkodiconnect/?id=%s&mode=recentepisodes&limit=50" % tagname
|
||||||
elif kodiversion == 14 and nodetype == "inprogressepisodes":
|
elif kodiversion == 14 and nodetype == "inprogressepisodes":
|
||||||
# Custom query
|
# Custom query
|
||||||
path = "plugin://plugin.video.emby/?id=%s&mode=inprogressepisodes&limit=25"% tagname
|
path = "plugin://plugin.video.plexkodiconnect/?id=%s&mode=inprogressepisodes&limit=50"% tagname
|
||||||
else:
|
else:
|
||||||
path = "library://video/Emby - %s/%s_%s.xml" % (dirname, viewid, nodetype)
|
path = "library://video/Plex-%s/%s_%s.xml" % (dirname, viewid, nodetype)
|
||||||
|
|
||||||
if mediatype == "photos":
|
if mediatype == "photo":
|
||||||
windowpath = "ActivateWindow(Pictures,%s,return)" % path
|
windowpath = "ActivateWindow(Pictures,%s,return)" % path
|
||||||
else:
|
else:
|
||||||
windowpath = "ActivateWindow(Video,%s,return)" % path
|
windowpath = "ActivateWindow(Video,%s,return)" % path
|
||||||
|
@ -220,7 +208,7 @@ class VideoNodes(object):
|
||||||
if nodetype == "all":
|
if nodetype == "all":
|
||||||
|
|
||||||
if viewtype == "mixed":
|
if viewtype == "mixed":
|
||||||
templabel = "%s - %s" % (tagname, mediatype)
|
templabel = "%s-%s" % (tagname, mediatype)
|
||||||
else:
|
else:
|
||||||
templabel = label
|
templabel = label
|
||||||
|
|
||||||
|
@ -235,7 +223,7 @@ class VideoNodes(object):
|
||||||
window('%s.path' % embynode, value=windowpath)
|
window('%s.path' % embynode, value=windowpath)
|
||||||
window('%s.content' % embynode, value=path)
|
window('%s.content' % embynode, value=path)
|
||||||
|
|
||||||
if mediatype == "photos":
|
if mediatype == "photo":
|
||||||
# For photos, we do not create a node in videos but we do want the window props
|
# For photos, we do not create a node in videos but we do want the window props
|
||||||
# to be created.
|
# to be created.
|
||||||
# To do: add our photos nodes to kodi picture sources somehow
|
# To do: add our photos nodes to kodi picture sources somehow
|
||||||
|
@ -259,7 +247,7 @@ class VideoNodes(object):
|
||||||
else:
|
else:
|
||||||
etree.SubElement(root, 'content').text = mediatype
|
etree.SubElement(root, 'content').text = mediatype
|
||||||
|
|
||||||
limit = "25"
|
limit = "50"
|
||||||
# Elements per nodetype
|
# Elements per nodetype
|
||||||
if nodetype == "all":
|
if nodetype == "all":
|
||||||
etree.SubElement(root, 'order', {'direction': "ascending"}).text = "sorttitle"
|
etree.SubElement(root, 'order', {'direction': "ascending"}).text = "sorttitle"
|
||||||
|
@ -309,7 +297,7 @@ class VideoNodes(object):
|
||||||
|
|
||||||
elif nodetype == "inprogressepisodes":
|
elif nodetype == "inprogressepisodes":
|
||||||
# Kodi Isengard, Jarvis
|
# Kodi Isengard, Jarvis
|
||||||
etree.SubElement(root, 'limit').text = "25"
|
etree.SubElement(root, 'limit').text = "50"
|
||||||
rule = etree.SubElement(root, 'rule',
|
rule = etree.SubElement(root, 'rule',
|
||||||
attrib={'field': "inprogress", 'operator':"true"})
|
attrib={'field': "inprogress", 'operator':"true"})
|
||||||
|
|
||||||
|
@ -325,8 +313,8 @@ class VideoNodes(object):
|
||||||
tagname = tagname.encode('utf-8')
|
tagname = tagname.encode('utf-8')
|
||||||
cleantagname = utils.normalize_nodes(tagname)
|
cleantagname = utils.normalize_nodes(tagname)
|
||||||
nodepath = xbmc.translatePath("special://profile/library/video/").decode('utf-8')
|
nodepath = xbmc.translatePath("special://profile/library/video/").decode('utf-8')
|
||||||
nodeXML = "%semby_%s.xml" % (nodepath, cleantagname)
|
nodeXML = "%splex_%s.xml" % (nodepath, cleantagname)
|
||||||
path = "library://video/emby_%s.xml" % cleantagname
|
path = "library://video/plex_%s.xml" % cleantagname
|
||||||
windowpath = "ActivateWindow(Video,%s,return)" % path
|
windowpath = "ActivateWindow(Video,%s,return)" % path
|
||||||
|
|
||||||
# Create the video node directory
|
# Create the video node directory
|
||||||
|
@ -356,7 +344,7 @@ class VideoNodes(object):
|
||||||
|
|
||||||
if itemtype == "channels":
|
if itemtype == "channels":
|
||||||
root = self.commonRoot(order=1, label=label, tagname=tagname, roottype=2)
|
root = self.commonRoot(order=1, label=label, tagname=tagname, roottype=2)
|
||||||
etree.SubElement(root, 'path').text = "plugin://plugin.video.emby/?id=0&mode=channels"
|
etree.SubElement(root, 'path').text = "plugin://plugin.video.plexkodiconnect/?id=0&mode=channels"
|
||||||
else:
|
else:
|
||||||
root = self.commonRoot(order=1, label=label, tagname=tagname)
|
root = self.commonRoot(order=1, label=label, tagname=tagname)
|
||||||
etree.SubElement(root, 'order', {'direction': "ascending"}).text = "sorttitle"
|
etree.SubElement(root, 'order', {'direction': "ascending"}).text = "sorttitle"
|
||||||
|
|
Loading…
Reference in a new issue