finished video nodes change and main entrypoint listings

removed some redundant logging
This commit is contained in:
Marcel van der Veldt 2015-05-07 00:05:27 +02:00
parent d4e44122ba
commit 4ceb66762a
6 changed files with 41 additions and 11 deletions

View file

@ -39,7 +39,11 @@ elif mode == "resetauth":
elif mode == "adduser":
entrypoint.addUser()
elif mode == "settings":
xbmc.executebuiltin('Addon.OpenSettings(plugin.video.emby)')
##### BROWSE EMBY CHANNELS ROOT #####
elif mode == "channels":
entrypoint.BrowseChannels(id)
@ -60,11 +64,8 @@ elif "extrafanart" in sys.argv[0]:
entrypoint.getExtraFanArt()
##### SHOW ADDON SETTINGS #####
##### SHOW ADDON NODES LISTING #####
else:
#open the addon settings if the addon is called directly from video addons
try:
if "content_type" in sys.argv[2]:
xbmc.executebuiltin('Addon.OpenSettings(plugin.video.emby)')
except: pass
entrypoint.doMainListing()

View file

@ -126,7 +126,7 @@ def BrowseChannels(id, folderid=None):
_addon_id = int(sys.argv[1])
_addon_url = sys.argv[0]
xbmcplugin.setContent(int(sys.argv[1]), 'files')
if folderid:
url = "{server}/mediabrowser/Channels/" + id + "/Items?userid={UserId}&folderid=" + folderid + "&format=json"
else:
@ -375,3 +375,34 @@ def getExtraFanArt():
#always do endofdirectory to prevent errors in the logs
xbmcplugin.endOfDirectory(int(sys.argv[1]))
def addDirectoryItem(label, path, folder=True):
li = xbmcgui.ListItem(label, path=path)
li.setThumbnailImage("special://home/addons/plugin.video.emby/icon.png")
li.setArt({"fanart":"special://home/addons/plugin.video.emby/fanart.jpg"})
li.setArt({"landscape":"special://home/addons/plugin.video.emby/fanart.jpg"})
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=path, listitem=li, isFolder=folder)
# if the addon is called without parameters we show the listing...
def doMainListing():
xbmcplugin.setContent(int(sys.argv[1]), 'files')
#get emby nodes from the window props
embyProperty = WINDOW.getProperty("Emby.nodes.total")
if embyProperty:
totalNodes = int(embyProperty)
for i in range(totalNodes):
path = WINDOW.getProperty("Emby.nodes.%s.index" %str(i))
if not path:
path = WINDOW.getProperty("Emby.nodes.%s.content" %str(i))
label = WINDOW.getProperty("Emby.nodes.%s.title" %str(i))
if path:
addDirectoryItem(label, path)
# some extra entries for settinsg and stuff. TODO --> localize the labels
addDirectoryItem("Settings", "plugin://plugin.video.emby/?mode=settings")
addDirectoryItem("Add user to session", "plugin://plugin.video.emby/?mode=adduser")
addDirectoryItem("Perform full resync", "plugin://plugin.video.emby/?mode=reset")
xbmcplugin.endOfDirectory(int(sys.argv[1]))

View file

@ -327,8 +327,6 @@ class LibrarySync():
else:
# If there are changes to the item, perform a full sync of the item
if kodiEpisode[2] != API().getChecksum(item):
print "previous checksum--> " + kodiEpisode[2]
print "new checksum--> " + API().getChecksum(item)
WriteKodiDB().addOrUpdateEpisodeToKodiLibrary(item["Id"], kodiShowId, connection, cursor)
#### EPISODES: PROCESS DELETES #####

View file

@ -241,7 +241,6 @@ class ReadEmbyDB():
if (result == ""):
return []
newViews = newViews[u'Items']
print str(newViews)
for newView in newViews:
# There are multiple nodes in here like 'Latest', 'NextUp' - below we grab the full node.
if newView[u'CollectionType'] != None:

View file

@ -189,7 +189,6 @@ def reset():
rows = cursor.fetchall()
for row in rows:
tableName = row[0]
print tableName
if(tableName != "version"):
cursor.execute("DELETE FROM " + tableName)
connection.commit()

View file

@ -38,6 +38,8 @@ class VideoNodes():
root = Element("node", {"order":"0"})
SubElement(root, "label").text = "Emby - " + tagname
SubElement(root, "icon").text = "special://home/addons/plugin.video.emby/icon.png"
path = "library://video/Emby - %s/"%tagname
WINDOW.setProperty("Emby.nodes.%s.index" %str(windowPropId),path)
try:
ET.ElementTree(root).write(nodefile, xml_declaration=True)
except: