fix subnodes for homevideos and photos

This commit is contained in:
marcelveldt 2016-01-22 11:10:42 +01:00
parent 3caa2ae3a7
commit 333d6b2831
3 changed files with 32 additions and 13 deletions

View file

@ -58,6 +58,7 @@ class Main:
'channels': entrypoint.BrowseChannels, 'channels': entrypoint.BrowseChannels,
'channelsfolder': entrypoint.BrowseChannels, 'channelsfolder': entrypoint.BrowseChannels,
'browsecontent': entrypoint.BrowseContent, 'browsecontent': entrypoint.BrowseContent,
'getsubfolders': entrypoint.GetSubFolders,
'nextup': entrypoint.getNextUpEpisodes, 'nextup': entrypoint.getNextUpEpisodes,
'inprogressepisodes': entrypoint.getInProgressEpisodes, 'inprogressepisodes': entrypoint.getInProgressEpisodes,
'recentepisodes': entrypoint.getRecentEpisodes, 'recentepisodes': entrypoint.getRecentEpisodes,
@ -77,11 +78,11 @@ class Main:
limit = int(params['limit'][0]) limit = int(params['limit'][0])
modes[mode](itemid, limit) modes[mode](itemid, limit)
elif mode == "channels": elif mode in ["channels","getsubfolders"]:
modes[mode](itemid) modes[mode](itemid)
elif mode == "browsecontent": elif mode == "browsecontent":
modes[mode]( itemid, params.get('type',[""])[0], params.get('folderid',[""])[0], params.get('filter',[""])[0] ) modes[mode]( itemid, params.get('type',[""])[0], params.get('folderid',[""])[0] )
elif mode == "channelsfolder": elif mode == "channelsfolder":
folderid = params['folderid'][0] folderid = params['folderid'][0]

View file

@ -69,7 +69,7 @@ def doMainListing():
label = utils.window('Emby.nodes.%s.title' % i) label = utils.window('Emby.nodes.%s.title' % i)
type = utils.window('Emby.nodes.%s.type' % i) type = utils.window('Emby.nodes.%s.type' % i)
#because we do not use seperate entrypoints for each content type, we need to figure out which items to show in each listing. #because we do not use seperate entrypoints for each content type, we need to figure out which items to show in each listing.
#for now we just only show picture nodes in the picture librarym video nodes in the video library and all nodes in any other window #for now we just only show picture nodes in the picture library video nodes in the video library and all nodes in any other window
if path and xbmc.getCondVisibility("Window.IsActive(Pictures)") and type == "photos": if path and xbmc.getCondVisibility("Window.IsActive(Pictures)") and type == "photos":
addDirectoryItem(label, path) addDirectoryItem(label, path)
elif path and xbmc.getCondVisibility("Window.IsActive(VideoLibrary)") and type != "photos": elif path and xbmc.getCondVisibility("Window.IsActive(VideoLibrary)") and type != "photos":
@ -399,13 +399,31 @@ def refreshPlaylist():
time=1000, time=1000,
sound=False) sound=False)
#### SHOW SUBFOLDERS FOR NODE #####
def GetSubFolders(nodeindex):
nodetypes = ["",".recent",".recentepisodes",".inprogress",".inprogressepisodes",".unwatched",".nextepisodes",".sets",".genres",".random",".recommended"]
for node in nodetypes:
title = utils.window('Emby.nodes.%s%s.title' %(nodeindex,node))
if title:
path = utils.window('Emby.nodes.%s%s.content' %(nodeindex,node))
type = utils.window('Emby.nodes.%s%s.type' %(nodeindex,node))
addDirectoryItem(title, path)
xbmcplugin.endOfDirectory(int(sys.argv[1]))
##### BROWSE EMBY NODES DIRECTLY ##### ##### BROWSE EMBY NODES DIRECTLY #####
def BrowseContent(viewname, type="", folderid=None, filter=""): def BrowseContent(viewname, type="", folderid=""):
emby = embyserver.Read_EmbyServer() emby = embyserver.Read_EmbyServer()
art = artwork.Artwork() art = artwork.Artwork()
doUtils = downloadutils.DownloadUtils() doUtils = downloadutils.DownloadUtils()
utils.logMsg("BrowseHomeVideos","viewname: %s - type: %s - folderid: %s - filter: %s" %(viewname, type, folderid, filter))
#folderid used as filter ?
if folderid in ["recent","recentepisodes","inprogress","inprogressepisodes","unwatched","nextepisodes","sets","genres","random","recommended"]:
filter = folderid
folderid = ""
else:
filter = ""
xbmcplugin.setPluginCategory(int(sys.argv[1]), viewname) xbmcplugin.setPluginCategory(int(sys.argv[1]), viewname)
#get views for root level #get views for root level
if not folderid: if not folderid:
@ -414,6 +432,7 @@ def BrowseContent(viewname, type="", folderid=None, filter=""):
if view.get("name") == viewname: if view.get("name") == viewname:
folderid = view.get("id") folderid = view.get("id")
utils.logMsg("BrowseContent","viewname: %s - type: %s - folderid: %s - filter: %s" %(viewname, type, folderid, filter))
#set the correct params for the content type #set the correct params for the content type
#only proceed if we have a folderid #only proceed if we have a folderid
if folderid: if folderid:
@ -432,14 +451,13 @@ def BrowseContent(viewname, type="", folderid=None, filter=""):
elif type == "tvchannels": elif type == "tvchannels":
listing = emby.getTvChannels() listing = emby.getTvChannels()
elif filter == "recent": elif filter == "recent":
#why don't we get a recursive result when the parentid is set ? listing = emby.getFilteredSection(folderid, itemtype=itemtype.split(",")[0], sortby="DateCreated", recursive=True, limit=25, sortorder="Descending")
listing = emby.getFilteredSection(parentid="", itemtype=itemtype.split(",")[0], sortby="DateCreated", recursive=True, limit=25, sortorder="Descending")
elif filter == "random": elif filter == "random":
listing = emby.getFilteredSection(parentid="", itemtype=itemtype.split(",")[0], sortby="Random", recursive=True, limit=150, sortorder="Descending") listing = emby.getFilteredSection(folderid, itemtype=itemtype.split(",")[0], sortby="Random", recursive=True, limit=150, sortorder="Descending")
elif filter == "recommended": elif filter == "recommended":
listing = emby.getFilteredSection(parentid="", itemtype=itemtype.split(",")[0], sortby="SortName", recursive=True, limit=25, sortorder="Ascending", filter="IsFavorite") listing = emby.getFilteredSection(folderid, itemtype=itemtype.split(",")[0], sortby="SortName", recursive=True, limit=25, sortorder="Ascending", filter="IsFavorite")
elif filter == "sets": elif filter == "sets":
listing = emby.getFilteredSection(parentid="", itemtype=itemtype.split(",")[1], sortby="SortName", recursive=True, limit=25, sortorder="Ascending", filter="IsFavorite") listing = emby.getFilteredSection(folderid, itemtype=itemtype.split(",")[1], sortby="SortName", recursive=True, limit=25, sortorder="Ascending", filter="IsFavorite")
else: else:
listing = emby.getFilteredSection(folderid, itemtype=itemtype, recursive=False) listing = emby.getFilteredSection(folderid, itemtype=itemtype, recursive=False)
@ -456,7 +474,7 @@ def BrowseContent(viewname, type="", folderid=None, filter=""):
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=li.getProperty("path"), listitem=li) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=li.getProperty("path"), listitem=li)
xbmcplugin.endOfDirectory(handle=int(sys.argv[1])) xbmcplugin.endOfDirectory(handle=int(sys.argv[1]),succeeded=True,updateListing=False,cacheToDisc=False)
if filter == "recent": if filter == "recent":
xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_DATE) xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_DATE)
else: else:

View file

@ -96,7 +96,7 @@ class VideoNodes(object):
return return
if mediatype=="photos": if mediatype=="photos":
path = "plugin://plugin.video.emby/?id=%s&mode=browsecontent&type=photos&filter=index" % tagname path = "plugin://plugin.video.emby/?id=%s&mode=getsubfolders" % indexnumber
utils.window('Emby.nodes.%s.index' % indexnumber, value=path) utils.window('Emby.nodes.%s.index' % indexnumber, value=path)
@ -192,7 +192,7 @@ class VideoNodes(object):
path = "plugin://plugin.video.emby/?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.emby/?id=%s&mode=browsecontent&type=%s&filter=%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.emby/?id=%s&mode=nextup&limit=25" % tagname path = "plugin://plugin.video.emby/?id=%s&mode=nextup&limit=25" % tagname