Revert videonodes.py to Emby version
This commit is contained in:
parent
e10bc84bf3
commit
91c5cb4608
1 changed files with 29 additions and 15 deletions
|
@ -6,19 +6,31 @@ 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:
|
||||||
|
@ -36,7 +48,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.plexkodiconnect/icon.png"
|
etree.SubElement(root, 'icon').text = "special://home/addons/plugin.video.emby/icon.png"
|
||||||
|
|
||||||
return root
|
return root
|
||||||
|
|
||||||
|
@ -52,7 +64,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/plex%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):
|
||||||
|
@ -77,7 +89,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/plex%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:
|
||||||
|
@ -116,7 +128,7 @@ class VideoNodes(object):
|
||||||
}
|
}
|
||||||
mediatypes = {
|
mediatypes = {
|
||||||
# label according to nodetype per mediatype
|
# label according to nodetype per mediatype
|
||||||
'movie':
|
'movies':
|
||||||
{
|
{
|
||||||
'1': tagname,
|
'1': tagname,
|
||||||
'2': 30174,
|
'2': 30174,
|
||||||
|
@ -128,7 +140,7 @@ class VideoNodes(object):
|
||||||
'11': 30230
|
'11': 30230
|
||||||
},
|
},
|
||||||
|
|
||||||
'show':
|
'tvshows':
|
||||||
{
|
{
|
||||||
'1': tagname,
|
'1': tagname,
|
||||||
'2': 30170,
|
'2': 30170,
|
||||||
|
@ -182,21 +194,23 @@ class VideoNodes(object):
|
||||||
# Set window properties
|
# Set window properties
|
||||||
if (mediatype == "homevideos" or mediatype == "photos") and nodetype == "all":
|
if (mediatype == "homevideos" or mediatype == "photos") and nodetype == "all":
|
||||||
# Custom query
|
# Custom query
|
||||||
path = "plugin://plugin.video.plexkodiconnect/?id=%s&mode=browsecontent&type=%s" %(tagname,mediatype)
|
path = ("plugin://plugin.video.emby/?id=%s&mode=browsecontent&type=%s"
|
||||||
|
% (tagname, mediatype))
|
||||||
elif (mediatype == "homevideos" or mediatype == "photos"):
|
elif (mediatype == "homevideos" or mediatype == "photos"):
|
||||||
# Custom query
|
# Custom query
|
||||||
path = "plugin://plugin.video.plexkodiconnect/?id=%s&mode=browsecontent&type=%s&folderid=%s" %(tagname,mediatype,nodetype)
|
path = ("plugin://plugin.video.emby/?id=%s&mode=browsecontent&type=%s&folderid=%s"
|
||||||
|
% (tagname, mediatype, nodetype))
|
||||||
elif nodetype == "nextepisodes":
|
elif nodetype == "nextepisodes":
|
||||||
# Custom query
|
# Custom query
|
||||||
path = "plugin://plugin.video.plexkodiconnect/?id=%s&mode=nextup&limit=25" % tagname
|
path = "plugin://plugin.video.emby/?id=%s&mode=nextup&limit=25" % tagname
|
||||||
elif kodiversion == 14 and nodetype == "recentepisodes":
|
elif kodiversion == 14 and nodetype == "recentepisodes":
|
||||||
# Custom query
|
# Custom query
|
||||||
path = "plugin://plugin.video.plexkodiconnect/?id=%s&mode=recentepisodes&limit=25" % tagname
|
path = "plugin://plugin.video.emby/?id=%s&mode=recentepisodes&limit=25" % tagname
|
||||||
elif kodiversion == 14 and nodetype == "inprogressepisodes":
|
elif kodiversion == 14 and nodetype == "inprogressepisodes":
|
||||||
# Custom query
|
# Custom query
|
||||||
path = "plugin://plugin.video.plexkodiconnect/?id=%s&mode=inprogressepisodes&limit=25"% tagname
|
path = "plugin://plugin.video.emby/?id=%s&mode=inprogressepisodes&limit=25"% tagname
|
||||||
else:
|
else:
|
||||||
path = "library://video/plex%s/%s_%s.xml" % (dirname, viewid, nodetype)
|
path = "library://video/Emby - %s/%s_%s.xml" % (dirname, viewid, nodetype)
|
||||||
|
|
||||||
if mediatype == "photos":
|
if mediatype == "photos":
|
||||||
windowpath = "ActivateWindow(Pictures,%s,return)" % path
|
windowpath = "ActivateWindow(Pictures,%s,return)" % path
|
||||||
|
@ -311,8 +325,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 = "%splex_%s.xml" % (nodepath, cleantagname)
|
nodeXML = "%semby_%s.xml" % (nodepath, cleantagname)
|
||||||
path = "library://video/plex%s.xml" % (cleantagname)
|
path = "library://video/emby_%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
|
||||||
|
@ -342,7 +356,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.plexkodiconnect/?id=0&mode=channels"
|
etree.SubElement(root, 'path').text = "plugin://plugin.video.emby/?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