mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 18:26:15 +00:00
fixes issue with user profile switches in kodi
This commit is contained in:
parent
11e4b3edf9
commit
4d0d863a42
2 changed files with 125 additions and 120 deletions
|
@ -10,10 +10,7 @@ import xbmcvfs
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
from xml.etree.ElementTree import Element, SubElement, Comment, tostring
|
import xml.etree.ElementTree as etree
|
||||||
from xml.etree import ElementTree
|
|
||||||
from xml.dom import minidom
|
|
||||||
import xml.etree.cElementTree as ET
|
|
||||||
|
|
||||||
import Utils as utils
|
import Utils as utils
|
||||||
|
|
||||||
|
@ -35,184 +32,181 @@ class VideoNodes():
|
||||||
#create tag node - index
|
#create tag node - index
|
||||||
xbmcvfs.mkdir(libraryPath)
|
xbmcvfs.mkdir(libraryPath)
|
||||||
nodefile = os.path.join(libraryPath, "index.xml")
|
nodefile = os.path.join(libraryPath, "index.xml")
|
||||||
root = Element("node", {"order":"0"})
|
root = etree.Element("node", {"order":"0"})
|
||||||
SubElement(root, "label").text = "Emby - " + tagname
|
etree.SubElement(root, "label").text = "Emby - " + tagname
|
||||||
SubElement(root, "icon").text = "special://home/addons/plugin.video.emby/icon.png"
|
etree.SubElement(root, "icon").text = "special://home/addons/plugin.video.emby/icon.png"
|
||||||
path = "library://video/Emby - %s/"%tagname
|
path = "library://video/Emby - %s/"%tagname
|
||||||
WINDOW.setProperty("Emby.nodes.%s.index" %str(windowPropId),path)
|
WINDOW.setProperty("Emby.nodes.%s.index" %str(windowPropId),path)
|
||||||
try:
|
etree.ElementTree(root).write(nodefile)
|
||||||
ET.ElementTree(root).write(nodefile, xml_declaration=True)
|
|
||||||
except:
|
|
||||||
ET.ElementTree(root).write(nodefile)
|
|
||||||
|
|
||||||
#create tag node - all items
|
#create tag node - all items
|
||||||
nodefile = os.path.join(libraryPath, tagname + "_all.xml")
|
nodefile = os.path.join(libraryPath, tagname + "_all.xml")
|
||||||
root = Element("node", {"order":"1", "type":"filter"})
|
root = etree.Element("node", {"order":"1", "type":"filter"})
|
||||||
SubElement(root, "label").text = tagname
|
etree.SubElement(root, "label").text = tagname
|
||||||
SubElement(root, "match").text = "all"
|
etree.SubElement(root, "match").text = "all"
|
||||||
SubElement(root, "content").text = type
|
etree.SubElement(root, "content").text = type
|
||||||
SubElement(root, "icon").text = "special://home/addons/plugin.video.emby/icon.png"
|
etree.SubElement(root, "icon").text = "special://home/addons/plugin.video.emby/icon.png"
|
||||||
SubElement(root, "order", {"direction":"ascending"}).text = "sorttitle"
|
etree.SubElement(root, "order", {"direction":"ascending"}).text = "sorttitle"
|
||||||
Rule = SubElement(root, "rule", {"field":"tag","operator":"is"})
|
Rule = etree.SubElement(root, "rule", {"field":"tag","operator":"is"})
|
||||||
WINDOW.setProperty("Emby.nodes.%s.title" %str(windowPropId),tagname)
|
WINDOW.setProperty("Emby.nodes.%s.title" %str(windowPropId),tagname)
|
||||||
path = "library://video/Emby - %s/%s_all.xml"%(tagname,tagname)
|
path = "library://video/Emby - %s/%s_all.xml"%(tagname,tagname)
|
||||||
WINDOW.setProperty("Emby.nodes.%s.path" %str(windowPropId),"ActivateWindow(Video,%s,return)"%path)
|
WINDOW.setProperty("Emby.nodes.%s.path" %str(windowPropId),"ActivateWindow(Video,%s,return)"%path)
|
||||||
WINDOW.setProperty("Emby.nodes.%s.content" %str(windowPropId),path)
|
WINDOW.setProperty("Emby.nodes.%s.content" %str(windowPropId),path)
|
||||||
WINDOW.setProperty("Emby.nodes.%s.type" %str(windowPropId),type)
|
WINDOW.setProperty("Emby.nodes.%s.type" %str(windowPropId),type)
|
||||||
SubElement(Rule, "value").text = tagname
|
etree.SubElement(Rule, "value").text = tagname
|
||||||
try:
|
try:
|
||||||
ET.ElementTree(root).write(nodefile, xml_declaration=True)
|
etree.ElementTree(root).write(nodefile, xml_declaration=True)
|
||||||
except:
|
except:
|
||||||
ET.ElementTree(root).write(nodefile)
|
etree.ElementTree(root).write(nodefile)
|
||||||
|
|
||||||
#create tag node - recent items
|
#create tag node - recent items
|
||||||
nodefile = os.path.join(libraryPath, tagname + "_recent.xml")
|
nodefile = os.path.join(libraryPath, tagname + "_recent.xml")
|
||||||
root = Element("node", {"order":"2", "type":"filter"})
|
root = etree.Element("node", {"order":"2", "type":"filter"})
|
||||||
if type == "tvshows":
|
if type == "tvshows":
|
||||||
label = tagname + " - " + language(30170)
|
label = tagname + " - " + language(30170)
|
||||||
else:
|
else:
|
||||||
label = tagname + " - " + language(30174)
|
label = tagname + " - " + language(30174)
|
||||||
SubElement(root, "label").text = label
|
etree.SubElement(root, "label").text = label
|
||||||
SubElement(root, "match").text = "all"
|
etree.SubElement(root, "match").text = "all"
|
||||||
SubElement(root, "content").text = type
|
etree.SubElement(root, "content").text = type
|
||||||
SubElement(root, "icon").text = "special://home/addons/plugin.video.emby/icon.png"
|
etree.SubElement(root, "icon").text = "special://home/addons/plugin.video.emby/icon.png"
|
||||||
Rule = SubElement(root, "rule", {"field":"tag","operator":"is"})
|
Rule = etree.SubElement(root, "rule", {"field":"tag","operator":"is"})
|
||||||
SubElement(Rule, "value").text = tagname
|
etree.SubElement(Rule, "value").text = tagname
|
||||||
SubElement(root, "order", {"direction":"descending"}).text = "dateadded"
|
etree.SubElement(root, "order", {"direction":"descending"}).text = "dateadded"
|
||||||
#set limit to 25 --> currently hardcoded --> TODO: add a setting for this ?
|
#set limit to 25 --> currently hardcoded --> TODO: add a setting for this ?
|
||||||
SubElement(root, "limit").text = "25"
|
etree.SubElement(root, "limit").text = "25"
|
||||||
#exclude watched items --> currently hardcoded --> TODO: add a setting for this ?
|
#exclude watched items --> currently hardcoded --> TODO: add a setting for this ?
|
||||||
Rule2 = SubElement(root, "rule", {"field":"playcount","operator":"is"})
|
Rule2 = etree.SubElement(root, "rule", {"field":"playcount","operator":"is"})
|
||||||
SubElement(Rule2, "value").text = "0"
|
etree.SubElement(Rule2, "value").text = "0"
|
||||||
WINDOW.setProperty("Emby.nodes.%s.recent.title" %str(windowPropId),label)
|
WINDOW.setProperty("Emby.nodes.%s.recent.title" %str(windowPropId),label)
|
||||||
path = "library://video/Emby - %s/%s_recent.xml"%(tagname,tagname)
|
path = "library://video/Emby - %s/%s_recent.xml"%(tagname,tagname)
|
||||||
WINDOW.setProperty("Emby.nodes.%s.recent.path" %str(windowPropId),"ActivateWindow(Video,%s,return)"%path)
|
WINDOW.setProperty("Emby.nodes.%s.recent.path" %str(windowPropId),"ActivateWindow(Video,%s,return)"%path)
|
||||||
WINDOW.setProperty("Emby.nodes.%s.recent.content" %str(windowPropId),path)
|
WINDOW.setProperty("Emby.nodes.%s.recent.content" %str(windowPropId),path)
|
||||||
try:
|
try:
|
||||||
ET.ElementTree(root).write(nodefile, xml_declaration=True)
|
etree.ElementTree(root).write(nodefile, xml_declaration=True)
|
||||||
except:
|
except:
|
||||||
ET.ElementTree(root).write(nodefile)
|
etree.ElementTree(root).write(nodefile)
|
||||||
|
|
||||||
#create tag node - inprogress items
|
#create tag node - inprogress items
|
||||||
nodefile = os.path.join(libraryPath, tagname + "_progress.xml")
|
nodefile = os.path.join(libraryPath, tagname + "_progress.xml")
|
||||||
root = Element("node", {"order":"3", "type":"filter"})
|
root = etree.Element("node", {"order":"3", "type":"filter"})
|
||||||
if type == "tvshows":
|
if type == "tvshows":
|
||||||
label = tagname + " - " + language(30171)
|
label = tagname + " - " + language(30171)
|
||||||
else:
|
else:
|
||||||
label = tagname + " - " + language(30177)
|
label = tagname + " - " + language(30177)
|
||||||
SubElement(root, "label").text = label
|
etree.SubElement(root, "label").text = label
|
||||||
SubElement(root, "match").text = "all"
|
etree.SubElement(root, "match").text = "all"
|
||||||
SubElement(root, "content").text = type
|
etree.SubElement(root, "content").text = type
|
||||||
SubElement(root, "icon").text = "special://home/addons/plugin.video.emby/icon.png"
|
etree.SubElement(root, "icon").text = "special://home/addons/plugin.video.emby/icon.png"
|
||||||
Rule = SubElement(root, "rule", {"field":"tag","operator":"is"})
|
Rule = etree.SubElement(root, "rule", {"field":"tag","operator":"is"})
|
||||||
SubElement(Rule, "value").text = tagname
|
etree.SubElement(Rule, "value").text = tagname
|
||||||
#set limit to 25 --> currently hardcoded --> TODO: add a setting for this ?
|
#set limit to 25 --> currently hardcoded --> TODO: add a setting for this ?
|
||||||
SubElement(root, "limit").text = "25"
|
etree.SubElement(root, "limit").text = "25"
|
||||||
Rule2 = SubElement(root, "rule", {"field":"inprogress","operator":"true"})
|
Rule2 = etree.SubElement(root, "rule", {"field":"inprogress","operator":"true"})
|
||||||
WINDOW.setProperty("Emby.nodes.%s.inprogress.title" %str(windowPropId),label)
|
WINDOW.setProperty("Emby.nodes.%s.inprogress.title" %str(windowPropId),label)
|
||||||
path = "library://video/Emby - %s/%s_progress.xml"%(tagname,tagname)
|
path = "library://video/Emby - %s/%s_progress.xml"%(tagname,tagname)
|
||||||
WINDOW.setProperty("Emby.nodes.%s.inprogress.path" %str(windowPropId),"ActivateWindow(Video,%s,return)"%path)
|
WINDOW.setProperty("Emby.nodes.%s.inprogress.path" %str(windowPropId),"ActivateWindow(Video,%s,return)"%path)
|
||||||
WINDOW.setProperty("Emby.nodes.%s.inprogress.content" %str(windowPropId),path)
|
WINDOW.setProperty("Emby.nodes.%s.inprogress.content" %str(windowPropId),path)
|
||||||
try:
|
try:
|
||||||
ET.ElementTree(root).write(nodefile, xml_declaration=True)
|
etree.ElementTree(root).write(nodefile, xml_declaration=True)
|
||||||
except:
|
except:
|
||||||
ET.ElementTree(root).write(nodefile)
|
etree.ElementTree(root).write(nodefile)
|
||||||
|
|
||||||
#create tag node - add unwatched movies node for movies
|
#create tag node - add unwatched movies node for movies
|
||||||
if type == "movies":
|
if type == "movies":
|
||||||
nodefile = os.path.join(libraryPath, tagname + "_unwatched.xml")
|
nodefile = os.path.join(libraryPath, tagname + "_unwatched.xml")
|
||||||
root = Element("node", {"order":"4", "type":"filter"})
|
root = etree.Element("node", {"order":"4", "type":"filter"})
|
||||||
label = tagname + " - " + language(30189)
|
label = tagname + " - " + language(30189)
|
||||||
SubElement(root, "label").text = label
|
etree.SubElement(root, "label").text = label
|
||||||
SubElement(root, "match").text = "all"
|
etree.SubElement(root, "match").text = "all"
|
||||||
SubElement(root, "content").text = "movies"
|
etree.SubElement(root, "content").text = "movies"
|
||||||
SubElement(root, "icon").text = "special://home/addons/plugin.video.emby/icon.png"
|
etree.SubElement(root, "icon").text = "special://home/addons/plugin.video.emby/icon.png"
|
||||||
Rule = SubElement(root, "rule", {"field":"tag","operator":"is"})
|
Rule = etree.SubElement(root, "rule", {"field":"tag","operator":"is"})
|
||||||
SubElement(Rule, "value").text = tagname
|
etree.SubElement(Rule, "value").text = tagname
|
||||||
Rule = SubElement(root, "rule", {"field":"playcount","operator":"is"})
|
Rule = etree.SubElement(root, "rule", {"field":"playcount","operator":"is"})
|
||||||
SubElement(Rule, "value").text = "0"
|
etree.SubElement(Rule, "value").text = "0"
|
||||||
SubElement(root, "order", {"direction":"ascending"}).text = "sorttitle"
|
etree.SubElement(root, "order", {"direction":"ascending"}).text = "sorttitle"
|
||||||
#set limit to 25 --> currently hardcoded --> TODO: add a setting for this ?
|
#set limit to 25 --> currently hardcoded --> TODO: add a setting for this ?
|
||||||
SubElement(root, "limit").text = "25"
|
etree.SubElement(root, "limit").text = "25"
|
||||||
#exclude watched items --> currently hardcoded --> TODO: add a setting for this ?
|
#exclude watched items --> currently hardcoded --> TODO: add a setting for this ?
|
||||||
Rule2 = SubElement(root, "rule", {"field":"playcount","operator":"is"})
|
Rule2 = etree.SubElement(root, "rule", {"field":"playcount","operator":"is"})
|
||||||
SubElement(Rule2, "value").text = "0"
|
etree.SubElement(Rule2, "value").text = "0"
|
||||||
WINDOW.setProperty("Emby.nodes.%s.unwatched.title" %str(windowPropId),label)
|
WINDOW.setProperty("Emby.nodes.%s.unwatched.title" %str(windowPropId),label)
|
||||||
path = "library://video/Emby - %s/%s_unwatched.xml"%(tagname,tagname)
|
path = "library://video/Emby - %s/%s_unwatched.xml"%(tagname,tagname)
|
||||||
WINDOW.setProperty("Emby.nodes.%s.unwatched.path" %str(windowPropId),"ActivateWindow(Video,%s,return)"%path)
|
WINDOW.setProperty("Emby.nodes.%s.unwatched.path" %str(windowPropId),"ActivateWindow(Video,%s,return)"%path)
|
||||||
WINDOW.setProperty("Emby.nodes.%s.unwatched.content" %str(windowPropId),path)
|
WINDOW.setProperty("Emby.nodes.%s.unwatched.content" %str(windowPropId),path)
|
||||||
try:
|
try:
|
||||||
ET.ElementTree(root).write(nodefile, xml_declaration=True)
|
etree.ElementTree(root).write(nodefile, xml_declaration=True)
|
||||||
except:
|
except:
|
||||||
ET.ElementTree(root).write(nodefile)
|
etree.ElementTree(root).write(nodefile)
|
||||||
|
|
||||||
|
|
||||||
#add some additional nodes for episodes
|
#add some additional nodes for episodes
|
||||||
if type == "tvshows":
|
if type == "tvshows":
|
||||||
#create tag node - recent episodes
|
#create tag node - recent episodes
|
||||||
nodefile = os.path.join(libraryPath, tagname + "_recent_episodes.xml")
|
nodefile = os.path.join(libraryPath, tagname + "_recent_episodes.xml")
|
||||||
root = Element("node", {"order":"3", "type":"filter"})
|
root = etree.Element("node", {"order":"3", "type":"filter"})
|
||||||
label = tagname + " - " + language(30175)
|
label = tagname + " - " + language(30175)
|
||||||
SubElement(root, "label").text = label
|
etree.SubElement(root, "label").text = label
|
||||||
SubElement(root, "match").text = "all"
|
etree.SubElement(root, "match").text = "all"
|
||||||
SubElement(root, "content").text = "episodes"
|
etree.SubElement(root, "content").text = "episodes"
|
||||||
SubElement(root, "icon").text = "special://home/addons/plugin.video.emby/icon.png"
|
etree.SubElement(root, "icon").text = "special://home/addons/plugin.video.emby/icon.png"
|
||||||
Rule = SubElement(root, "rule", {"field":"tag","operator":"is"})
|
Rule = etree.SubElement(root, "rule", {"field":"tag","operator":"is"})
|
||||||
SubElement(Rule, "value").text = tagname
|
etree.SubElement(Rule, "value").text = tagname
|
||||||
SubElement(root, "order", {"direction":"descending"}).text = "dateadded"
|
etree.SubElement(root, "order", {"direction":"descending"}).text = "dateadded"
|
||||||
#set limit to 25 --> currently hardcoded --> TODO: add a setting for this ?
|
#set limit to 25 --> currently hardcoded --> TODO: add a setting for this ?
|
||||||
SubElement(root, "limit").text = "25"
|
etree.SubElement(root, "limit").text = "25"
|
||||||
#exclude watched items --> currently hardcoded --> TODO: add a setting for this ?
|
#exclude watched items --> currently hardcoded --> TODO: add a setting for this ?
|
||||||
Rule2 = SubElement(root, "rule", {"field":"playcount","operator":"is"})
|
Rule2 = etree.SubElement(root, "rule", {"field":"playcount","operator":"is"})
|
||||||
SubElement(Rule2, "value").text = "0"
|
etree.SubElement(Rule2, "value").text = "0"
|
||||||
WINDOW.setProperty("Emby.nodes.%s.recentepisodes.title" %str(windowPropId),label)
|
WINDOW.setProperty("Emby.nodes.%s.recentepisodes.title" %str(windowPropId),label)
|
||||||
path = "library://video/Emby - %s/%s_recent_episodes.xml"%(tagname,tagname)
|
path = "library://video/Emby - %s/%s_recent_episodes.xml"%(tagname,tagname)
|
||||||
WINDOW.setProperty("Emby.nodes.%s.recentepisodes.path" %str(windowPropId),"ActivateWindow(Video,%s,return)"%path)
|
WINDOW.setProperty("Emby.nodes.%s.recentepisodes.path" %str(windowPropId),"ActivateWindow(Video,%s,return)"%path)
|
||||||
WINDOW.setProperty("Emby.nodes.%s.recentepisodes.content" %str(windowPropId),path)
|
WINDOW.setProperty("Emby.nodes.%s.recentepisodes.content" %str(windowPropId),path)
|
||||||
try:
|
try:
|
||||||
ET.ElementTree(root).write(nodefile, xml_declaration=True)
|
etree.ElementTree(root).write(nodefile, xml_declaration=True)
|
||||||
except:
|
except:
|
||||||
ET.ElementTree(root).write(nodefile)
|
etree.ElementTree(root).write(nodefile)
|
||||||
|
|
||||||
#create tag node - inprogress items
|
#create tag node - inprogress items
|
||||||
nodefile = os.path.join(libraryPath, tagname + "_progress_episodes.xml")
|
nodefile = os.path.join(libraryPath, tagname + "_progress_episodes.xml")
|
||||||
root = Element("node", {"order":"4", "type":"filter"})
|
root = etree.Element("node", {"order":"4", "type":"filter"})
|
||||||
label = tagname + " - " + language(30178)
|
label = tagname + " - " + language(30178)
|
||||||
SubElement(root, "label").text = label
|
etree.SubElement(root, "label").text = label
|
||||||
SubElement(root, "match").text = "all"
|
etree.SubElement(root, "match").text = "all"
|
||||||
SubElement(root, "content").text = "episodes"
|
etree.SubElement(root, "content").text = "episodes"
|
||||||
SubElement(root, "icon").text = "special://home/addons/plugin.video.emby/icon.png"
|
etree.SubElement(root, "icon").text = "special://home/addons/plugin.video.emby/icon.png"
|
||||||
Rule = SubElement(root, "rule", {"field":"tag","operator":"is"})
|
Rule = etree.SubElement(root, "rule", {"field":"tag","operator":"is"})
|
||||||
SubElement(Rule, "value").text = tagname
|
etree.SubElement(Rule, "value").text = tagname
|
||||||
#set limit to 25 --> currently hardcoded --> TODO: add a setting for this ?
|
#set limit to 25 --> currently hardcoded --> TODO: add a setting for this ?
|
||||||
SubElement(root, "limit").text = "25"
|
etree.SubElement(root, "limit").text = "25"
|
||||||
Rule2 = SubElement(root, "rule", {"field":"inprogress","operator":"true"})
|
Rule2 = etree.SubElement(root, "rule", {"field":"inprogress","operator":"true"})
|
||||||
WINDOW.setProperty("Emby.nodes.%s.inprogressepisodes.title" %str(windowPropId),label)
|
WINDOW.setProperty("Emby.nodes.%s.inprogressepisodes.title" %str(windowPropId),label)
|
||||||
path = "library://video/Emby - %s/%s_progress_episodes.xml"%(tagname,tagname)
|
path = "library://video/Emby - %s/%s_progress_episodes.xml"%(tagname,tagname)
|
||||||
WINDOW.setProperty("Emby.nodes.%s.inprogressepisodes.path" %str(windowPropId),"ActivateWindow(Video,%s,return)"%path)
|
WINDOW.setProperty("Emby.nodes.%s.inprogressepisodes.path" %str(windowPropId),"ActivateWindow(Video,%s,return)"%path)
|
||||||
WINDOW.setProperty("Emby.nodes.%s.inprogressepisodes.content" %str(windowPropId),path)
|
WINDOW.setProperty("Emby.nodes.%s.inprogressepisodes.content" %str(windowPropId),path)
|
||||||
try:
|
try:
|
||||||
ET.ElementTree(root).write(nodefile, xml_declaration=True)
|
etree.ElementTree(root).write(nodefile, xml_declaration=True)
|
||||||
except:
|
except:
|
||||||
ET.ElementTree(root).write(nodefile)
|
etree.ElementTree(root).write(nodefile)
|
||||||
|
|
||||||
#create tag node - nextup items
|
#create tag node - nextup items
|
||||||
nodefile = os.path.join(libraryPath, tagname + "_nextup_episodes.xml")
|
nodefile = os.path.join(libraryPath, tagname + "_nextup_episodes.xml")
|
||||||
root = Element("node", {"order":"4", "type":"folder"})
|
root = etree.Element("node", {"order":"4", "type":"folder"})
|
||||||
label = tagname + " - " + language(30179)
|
label = tagname + " - " + language(30179)
|
||||||
SubElement(root, "label").text = label
|
etree.SubElement(root, "label").text = label
|
||||||
SubElement(root, "content").text = "episodes"
|
etree.SubElement(root, "content").text = "episodes"
|
||||||
path = "plugin://plugin.video.emby/?id=%s&mode=nextup&limit=25" %tagname
|
path = "plugin://plugin.video.emby/?id=%s&mode=nextup&limit=25" %tagname
|
||||||
SubElement(root, "path").text = path
|
etree.SubElement(root, "path").text = path
|
||||||
SubElement(root, "icon").text = "special://home/addons/plugin.video.emby/icon.png"
|
etree.SubElement(root, "icon").text = "special://home/addons/plugin.video.emby/icon.png"
|
||||||
WINDOW.setProperty("Emby.nodes.%s.nextepisodes.title" %str(windowPropId),label)
|
WINDOW.setProperty("Emby.nodes.%s.nextepisodes.title" %str(windowPropId),label)
|
||||||
path = "library://video/Emby - %s/%s_nextup_episodes.xml"%(tagname,tagname)
|
path = "library://video/Emby - %s/%s_nextup_episodes.xml"%(tagname,tagname)
|
||||||
WINDOW.setProperty("Emby.nodes.%s.nextepisodes.path" %str(windowPropId),"ActivateWindow(Video,%s,return)"%path)
|
WINDOW.setProperty("Emby.nodes.%s.nextepisodes.path" %str(windowPropId),"ActivateWindow(Video,%s,return)"%path)
|
||||||
WINDOW.setProperty("Emby.nodes.%s.nextepisodes.content" %str(windowPropId),path)
|
WINDOW.setProperty("Emby.nodes.%s.nextepisodes.content" %str(windowPropId),path)
|
||||||
try:
|
try:
|
||||||
ET.ElementTree(root).write(nodefile, xml_declaration=True)
|
etree.ElementTree(root).write(nodefile, xml_declaration=True)
|
||||||
except:
|
except:
|
||||||
ET.ElementTree(root).write(nodefile)
|
etree.ElementTree(root).write(nodefile)
|
||||||
|
|
||||||
def buildVideoNodesListing(self):
|
def buildVideoNodesListing(self):
|
||||||
|
|
||||||
|
@ -256,12 +250,12 @@ class VideoNodes():
|
||||||
|
|
||||||
#create tag node for emby channels
|
#create tag node for emby channels
|
||||||
nodefile = os.path.join(xbmc.translatePath("special://profile/library/video"), "emby_channels.xml")
|
nodefile = os.path.join(xbmc.translatePath("special://profile/library/video"), "emby_channels.xml")
|
||||||
root = Element("node", {"order":"1", "type":"folder"})
|
root = etree.Element("node", {"order":"1", "type":"folder"})
|
||||||
label = "Emby - " + language(30173)
|
label = "Emby - " + language(30173)
|
||||||
SubElement(root, "label").text = label
|
etree.SubElement(root, "label").text = label
|
||||||
SubElement(root, "content").text = "movies"
|
etree.SubElement(root, "content").text = "movies"
|
||||||
SubElement(root, "path").text = "plugin://plugin.video.emby/?id=0&mode=channels"
|
etree.SubElement(root, "path").text = "plugin://plugin.video.emby/?id=0&mode=channels"
|
||||||
SubElement(root, "icon").text = "special://home/addons/plugin.video.emby/icon.png"
|
etree.SubElement(root, "icon").text = "special://home/addons/plugin.video.emby/icon.png"
|
||||||
WINDOW.setProperty("Emby.nodes.%s.title" %str(totalNodesCount),label)
|
WINDOW.setProperty("Emby.nodes.%s.title" %str(totalNodesCount),label)
|
||||||
WINDOW.setProperty("Emby.nodes.%s.type" %str(totalNodesCount),"channels")
|
WINDOW.setProperty("Emby.nodes.%s.type" %str(totalNodesCount),"channels")
|
||||||
path = "library://video/emby_channels.xml"
|
path = "library://video/emby_channels.xml"
|
||||||
|
@ -269,21 +263,21 @@ class VideoNodes():
|
||||||
WINDOW.setProperty("Emby.nodes.%s.content" %str(totalNodesCount),path)
|
WINDOW.setProperty("Emby.nodes.%s.content" %str(totalNodesCount),path)
|
||||||
totalNodesCount +=1
|
totalNodesCount +=1
|
||||||
try:
|
try:
|
||||||
ET.ElementTree(root).write(nodefile, xml_declaration=True)
|
etree.ElementTree(root).write(nodefile, xml_declaration=True)
|
||||||
except:
|
except:
|
||||||
ET.ElementTree(root).write(nodefile)
|
etree.ElementTree(root).write(nodefile)
|
||||||
|
|
||||||
#create tag node - favorite shows
|
#create tag node - favorite shows
|
||||||
nodefile = os.path.join(xbmc.translatePath("special://profile/library/video"),"emby_favorite_shows.xml")
|
nodefile = os.path.join(xbmc.translatePath("special://profile/library/video"),"emby_favorite_shows.xml")
|
||||||
root = Element("node", {"order":"1", "type":"filter"})
|
root = etree.Element("node", {"order":"1", "type":"filter"})
|
||||||
label = "Emby - " + language(30181)
|
label = "Emby - " + language(30181)
|
||||||
SubElement(root, "label").text = label
|
etree.SubElement(root, "label").text = label
|
||||||
SubElement(root, "match").text = "all"
|
etree.SubElement(root, "match").text = "all"
|
||||||
SubElement(root, "content").text = "tvshows"
|
etree.SubElement(root, "content").text = "tvshows"
|
||||||
SubElement(root, "icon").text = "special://home/addons/plugin.video.emby/icon.png"
|
etree.SubElement(root, "icon").text = "special://home/addons/plugin.video.emby/icon.png"
|
||||||
SubElement(root, "order", {"direction":"ascending"}).text = "sorttitle"
|
etree.SubElement(root, "order", {"direction":"ascending"}).text = "sorttitle"
|
||||||
Rule = SubElement(root, "rule", {"field":"tag","operator":"is"})
|
Rule = etree.SubElement(root, "rule", {"field":"tag","operator":"is"})
|
||||||
SubElement(Rule, "value").text = "Favorite tvshows" #do not localize the tagname itself
|
etree.SubElement(Rule, "value").text = "Favorite tvshows" #do not localize the tagname itself
|
||||||
WINDOW.setProperty("Emby.nodes.%s.title" %str(totalNodesCount),label)
|
WINDOW.setProperty("Emby.nodes.%s.title" %str(totalNodesCount),label)
|
||||||
WINDOW.setProperty("Emby.nodes.%s.type" %str(totalNodesCount),"favourites")
|
WINDOW.setProperty("Emby.nodes.%s.type" %str(totalNodesCount),"favourites")
|
||||||
path = "library://video/emby_favorite_shows.xml"
|
path = "library://video/emby_favorite_shows.xml"
|
||||||
|
@ -291,21 +285,21 @@ class VideoNodes():
|
||||||
WINDOW.setProperty("Emby.nodes.%s.content" %str(totalNodesCount),path)
|
WINDOW.setProperty("Emby.nodes.%s.content" %str(totalNodesCount),path)
|
||||||
totalNodesCount +=1
|
totalNodesCount +=1
|
||||||
try:
|
try:
|
||||||
ET.ElementTree(root).write(nodefile, xml_declaration=True)
|
etree.ElementTree(root).write(nodefile, xml_declaration=True)
|
||||||
except:
|
except:
|
||||||
ET.ElementTree(root).write(nodefile)
|
etree.ElementTree(root).write(nodefile)
|
||||||
|
|
||||||
#create tag node - favorite movies
|
#create tag node - favorite movies
|
||||||
nodefile = os.path.join(xbmc.translatePath("special://profile/library/video"),"emby_favorite_movies.xml")
|
nodefile = os.path.join(xbmc.translatePath("special://profile/library/video"),"emby_favorite_movies.xml")
|
||||||
root = Element("node", {"order":"1", "type":"filter"})
|
root = etree.Element("node", {"order":"1", "type":"filter"})
|
||||||
label = "Emby - " + language(30180)
|
label = "Emby - " + language(30180)
|
||||||
SubElement(root, "label").text = label
|
etree.SubElement(root, "label").text = label
|
||||||
SubElement(root, "match").text = "all"
|
etree.SubElement(root, "match").text = "all"
|
||||||
SubElement(root, "content").text = "movies"
|
etree.SubElement(root, "content").text = "movies"
|
||||||
SubElement(root, "icon").text = "special://home/addons/plugin.video.emby/icon.png"
|
etree.SubElement(root, "icon").text = "special://home/addons/plugin.video.emby/icon.png"
|
||||||
SubElement(root, "order", {"direction":"ascending"}).text = "sorttitle"
|
etree.SubElement(root, "order", {"direction":"ascending"}).text = "sorttitle"
|
||||||
Rule = SubElement(root, "rule", {"field":"tag","operator":"is"})
|
Rule = etree.SubElement(root, "rule", {"field":"tag","operator":"is"})
|
||||||
SubElement(Rule, "value").text = "Favorite movies" #do not localize the tagname itself
|
etree.SubElement(Rule, "value").text = "Favorite movies" #do not localize the tagname itself
|
||||||
WINDOW.setProperty("Emby.nodes.%s.title" %str(totalNodesCount),label)
|
WINDOW.setProperty("Emby.nodes.%s.title" %str(totalNodesCount),label)
|
||||||
WINDOW.setProperty("Emby.nodes.%s.type" %str(totalNodesCount),"favourites")
|
WINDOW.setProperty("Emby.nodes.%s.type" %str(totalNodesCount),"favourites")
|
||||||
path = "library://video/emby_favorite_movies.xml"
|
path = "library://video/emby_favorite_movies.xml"
|
||||||
|
@ -313,13 +307,13 @@ class VideoNodes():
|
||||||
WINDOW.setProperty("Emby.nodes.%s.content" %str(totalNodesCount),path)
|
WINDOW.setProperty("Emby.nodes.%s.content" %str(totalNodesCount),path)
|
||||||
totalNodesCount +=1
|
totalNodesCount +=1
|
||||||
try:
|
try:
|
||||||
ET.ElementTree(root).write(nodefile, xml_declaration=True)
|
etree.ElementTree(root).write(nodefile, xml_declaration=True)
|
||||||
except:
|
except:
|
||||||
ET.ElementTree(root).write(nodefile)
|
etree.ElementTree(root).write(nodefile)
|
||||||
|
|
||||||
WINDOW.setProperty("Emby.nodes.total", str(totalNodesCount))
|
WINDOW.setProperty("Emby.nodes.total", str(totalNodesCount))
|
||||||
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
utils.logMsg("Emby addon","Error while creating videonodes listings, restart required ?")
|
utils.logMsg("Emby addon","Error while creating videonodes listings, restart required ?")
|
||||||
print e
|
print e
|
||||||
|
|
11
service.py
11
service.py
|
@ -46,6 +46,17 @@ class Service():
|
||||||
self.logMsg("%s Version: %s" % (addonName, self.clientInfo.getVersion()), 0)
|
self.logMsg("%s Version: %s" % (addonName, self.clientInfo.getVersion()), 0)
|
||||||
self.logMsg("Platform: %s" % (self.clientInfo.getPlatform()), 0)
|
self.logMsg("Platform: %s" % (self.clientInfo.getPlatform()), 0)
|
||||||
|
|
||||||
|
#reset all window props on startup for user profile switches
|
||||||
|
self.WINDOW.clearProperty("startup")
|
||||||
|
embyProperty = self.WINDOW.getProperty("Emby.nodes.total")
|
||||||
|
propNames = ["index","path","title","content","inprogress.content","inprogress.title","inprogress.content","inprogress.path","nextepisodes.title","nextepisodes.content","nextepisodes.path","unwatched.title","unwatched.content","unwatched.path","recent.title","recent.content","recent.path","recentepisodes.title","recentepisodes.content","recentepisodes.path","inprogressepisodes.title","inprogressepisodes.content","inprogressepisodes.path"]
|
||||||
|
if embyProperty:
|
||||||
|
totalNodes = int(embyProperty)
|
||||||
|
for i in range(totalNodes):
|
||||||
|
for prop in propNames:
|
||||||
|
self.WINDOW.clearProperty("Emby.nodes.%s.%s" %(str(i),prop))
|
||||||
|
|
||||||
|
|
||||||
def logMsg(self, msg, lvl=1):
|
def logMsg(self, msg, lvl=1):
|
||||||
|
|
||||||
className = self.__class__.__name__
|
className = self.__class__.__name__
|
||||||
|
|
Loading…
Reference in a new issue