diff --git a/default.py b/default.py index 24e845cc..40c4edf4 100644 --- a/default.py +++ b/default.py @@ -50,7 +50,6 @@ class Main: 'reset': utils.reset, 'resetauth': entrypoint.resetAuth, - 'extrafanart': entrypoint.getExtraFanArt, 'play': entrypoint.doPlayback, 'passwords': utils.passwordsXML, 'adduser': entrypoint.addUser, @@ -66,10 +65,15 @@ class Main: 'deviceid': entrypoint.resetDeviceId } - if "extrafanart" in sys.argv[0]: + if "/extrafanart" in sys.argv[0]: embypath = sys.argv[2][1:] embyid = params.get('id',[""])[0] entrypoint.getExtraFanArt(embyid,embypath) + + if "/Extras" in sys.argv[0] or "/VideoFiles" in sys.argv[0]: + embypath = sys.argv[2][1:] + embyid = params.get('id',[""])[0] + entrypoint.getVideoFiles(embyid,embypath) if modes.get(mode): # Simple functions diff --git a/resources/lib/entrypoint.py b/resources/lib/entrypoint.py index e3307543..8e8e252c 100644 --- a/resources/lib/entrypoint.py +++ b/resources/lib/entrypoint.py @@ -951,6 +951,32 @@ def getRecentEpisodes(tagname, limit): xbmcplugin.endOfDirectory(handle=int(sys.argv[1])) +##### GET VIDEO EXTRAS FOR LISTITEM ##### +def getVideoFiles(embyId,embyPath): + #returns the video files for the item as plugin listing, can be used for browsing the actual files or videoextras etc. + emby = embyserver.Read_EmbyServer() + if not embyId: + if "plugin.video.emby" in embyPath: + embyId = embyPath.split("/")[-2] + if embyId: + item = emby.getItem(embyId) + putils = playutils.PlayUtils(item) + if putils.isDirectPlay(): + #only proceed if we can access the files directly. TODO: copy local on the fly if accessed outside + filelocation = putils.directPlay() + if not filelocation.endswith("/"): + filelocation = filelocation.rpartition("/")[0] + dirs, files = xbmcvfs.listdir(filelocation) + for file in files: + file = filelocation + file + li = xbmcgui.ListItem(file, path=file) + xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=file, listitem=li) + for dir in dirs: + dir = filelocation + dir + li = xbmcgui.ListItem(dir, path=dir) + xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=dir, listitem=li, isFolder=True) + xbmcplugin.endOfDirectory(int(sys.argv[1])) + ##### GET EXTRAFANART FOR LISTITEM ##### def getExtraFanArt(embyId,embyPath):