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

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

View file

@ -126,7 +126,7 @@ def BrowseChannels(id, folderid=None):
_addon_id = int(sys.argv[1]) _addon_id = int(sys.argv[1])
_addon_url = sys.argv[0] _addon_url = sys.argv[0]
xbmcplugin.setContent(int(sys.argv[1]), 'files')
if folderid: if folderid:
url = "{server}/mediabrowser/Channels/" + id + "/Items?userid={UserId}&folderid=" + folderid + "&format=json" url = "{server}/mediabrowser/Channels/" + id + "/Items?userid={UserId}&folderid=" + folderid + "&format=json"
else: else:
@ -375,3 +375,34 @@ def getExtraFanArt():
#always do endofdirectory to prevent errors in the logs #always do endofdirectory to prevent errors in the logs
xbmcplugin.endOfDirectory(int(sys.argv[1])) 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: else:
# If there are changes to the item, perform a full sync of the item # If there are changes to the item, perform a full sync of the item
if kodiEpisode[2] != API().getChecksum(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) WriteKodiDB().addOrUpdateEpisodeToKodiLibrary(item["Id"], kodiShowId, connection, cursor)
#### EPISODES: PROCESS DELETES ##### #### EPISODES: PROCESS DELETES #####

View file

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

View file

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

View file

@ -38,6 +38,8 @@ class VideoNodes():
root = Element("node", {"order":"0"}) root = Element("node", {"order":"0"})
SubElement(root, "label").text = "Emby - " + tagname SubElement(root, "label").text = "Emby - " + tagname
SubElement(root, "icon").text = "special://home/addons/plugin.video.emby/icon.png" 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: try:
ET.ElementTree(root).write(nodefile, xml_declaration=True) ET.ElementTree(root).write(nodefile, xml_declaration=True)
except: except: