diff --git a/default.py b/default.py index 54074ad8..ee1e4c67 100644 --- a/default.py +++ b/default.py @@ -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() + diff --git a/resources/lib/Entrypoint.py b/resources/lib/Entrypoint.py index 64bcac16..4e80a950 100644 --- a/resources/lib/Entrypoint.py +++ b/resources/lib/Entrypoint.py @@ -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])) + \ No newline at end of file diff --git a/resources/lib/LibrarySync.py b/resources/lib/LibrarySync.py index b42524a0..4e99dce3 100644 --- a/resources/lib/LibrarySync.py +++ b/resources/lib/LibrarySync.py @@ -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 ##### diff --git a/resources/lib/ReadEmbyDB.py b/resources/lib/ReadEmbyDB.py index 20577e20..3d4e7680 100644 --- a/resources/lib/ReadEmbyDB.py +++ b/resources/lib/ReadEmbyDB.py @@ -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: diff --git a/resources/lib/Utils.py b/resources/lib/Utils.py index 9357dc87..86587874 100644 --- a/resources/lib/Utils.py +++ b/resources/lib/Utils.py @@ -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() diff --git a/resources/lib/VideoNodes.py b/resources/lib/VideoNodes.py index 35f26e0d..d9ffd1f0 100644 --- a/resources/lib/VideoNodes.py +++ b/resources/lib/VideoNodes.py @@ -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: