Fix plugin paths & Attempt to fix photos

Emby removed photos library. Now it's homevideo and photos. Had to tweak
a few things.
Update plugin patha to properly encode naming.
This commit is contained in:
angelblue05 2017-11-08 22:42:48 -06:00
parent 81e8da575a
commit c0012582c8
4 changed files with 58 additions and 23 deletions

View File

@ -30,7 +30,7 @@ import playbackutils as pbutils
import playutils import playutils
import api import api
from views import Playlist, VideoNodes from views import Playlist, VideoNodes
from utils import window, settings, dialog, language as lang from utils import window, settings, dialog, language as lang, plugin_path
################################################################################################# #################################################################################################
@ -85,7 +85,7 @@ def doMainListing():
''' '''
if path: if path:
if xbmc.getCondVisibility("Window.IsActive(Pictures)") and node == "photos": if xbmc.getCondVisibility("Window.IsActive(Pictures)") and node in ("photos", "homevideos"):
addDirectoryItem(label, path) addDirectoryItem(label, path)
elif xbmc.getCondVisibility("Window.IsActive(Videos)") and node != "photos": elif xbmc.getCondVisibility("Window.IsActive(Videos)") and node != "photos":
addDirectoryItem(label, path) addDirectoryItem(label, path)
@ -620,11 +620,8 @@ def BrowseContent(viewname, browse_type="", folderid=""):
#only proceed if we have a folderid #only proceed if we have a folderid
if folderid: if folderid:
if browse_type.lower() == "homevideos": if browse_type.lower() == "homevideos":
xbmcplugin.setContent(int(sys.argv[1]), 'episodes')
itemtype = "Video,Folder,PhotoAlbum"
elif browse_type.lower() == "photos":
xbmcplugin.setContent(int(sys.argv[1]), 'files') xbmcplugin.setContent(int(sys.argv[1]), 'files')
itemtype = "Photo,PhotoAlbum,Folder" itemtype = "Video,Folder,PhotoAlbum,Photo"
else: else:
itemtype = "" itemtype = ""
@ -653,7 +650,14 @@ def BrowseContent(viewname, browse_type="", folderid=""):
li = createListItemFromEmbyItem(item,art,doUtils) li = createListItemFromEmbyItem(item,art,doUtils)
if item.get("IsFolder") == True: if item.get("IsFolder") == True:
#for folders we add an additional browse request, passing the folderId #for folders we add an additional browse request, passing the folderId
path = "%s?id=%s&mode=browsecontent&type=%s&folderid=%s" % (sys.argv[0].decode('utf-8'), viewname.decode('utf-8'), browse_type.decode('utf-8'), item.get("Id").decode('utf-8')) params = {
'id': viewname.encode('utf-8'),
'mode': "browsecontent",
'type': browse_type,
'folderid': item['Id']
}
path = plugin_path("plugin://plugin.video.emby/", params)
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=path, listitem=li, isFolder=True) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=path, listitem=li, isFolder=True)
else: else:
#playable item, set plugin path and mediastreams #playable item, set plugin path and mediastreams

View File

@ -3,14 +3,13 @@
################################################################################################## ##################################################################################################
import logging import logging
import urllib
from ntpath import dirname from ntpath import dirname
import api import api
import embydb_functions as embydb import embydb_functions as embydb
import _kodi_tvshows import _kodi_tvshows
from _common import Items, catch_except from _common import Items, catch_except
from utils import window, settings, language as lang from utils import window, settings, language as lang, plugin_path
################################################################################################## ##################################################################################################
@ -630,7 +629,7 @@ class TVShows(Items):
'dbid': episodeid, 'dbid': episodeid,
'mode': "play" 'mode': "play"
} }
filename = "%s?%s" % (path, urllib.urlencode(params)) filename = plugin_path(path, params)
##### UPDATE THE EPISODE ##### ##### UPDATE THE EPISODE #####
if update_item: if update_item:

View File

@ -10,6 +10,7 @@ import StringIO
import os import os
import sys import sys
import time import time
import urllib
import unicodedata import unicodedata
import xml.etree.ElementTree as etree import xml.etree.ElementTree as etree
from datetime import datetime from datetime import datetime
@ -77,6 +78,9 @@ def dialog(type_, *args, **kwargs):
} }
return types[type_](*args, **kwargs) return types[type_](*args, **kwargs)
def plugin_path(plugin, params):
return "%s?%s" % (plugin, urllib.urlencode(params))
class JSONRPC(object): class JSONRPC(object):

View File

@ -14,7 +14,7 @@ import xbmcvfs
import read_embyserver as embyserver import read_embyserver as embyserver
import embydb_functions as embydb import embydb_functions as embydb
from utils import window, language as lang, indent as xml_indent from utils import window, language as lang, indent as xml_indent, plugin_path
################################################################################################# #################################################################################################
@ -635,22 +635,50 @@ class VideoNodes(object):
# Set window properties # Set window properties
if (mediatype == "homevideos" or mediatype == "photos") and nodetype == "all": if (mediatype == "homevideos" or mediatype == "photos") and nodetype == "all":
# Custom query params = {
path = ("plugin://plugin.video.emby/?id=%s&mode=browsecontent&type=%s"
% (tagname, mediatype)) 'id': tagname.encode('utf-8'),
'mode': "browsecontent",
'type': mediatype
}
path = plugin_path("plugin://plugin.video.emby/", params)
elif (mediatype == "homevideos" or mediatype == "photos"): elif (mediatype == "homevideos" or mediatype == "photos"):
# Custom query params = {
path = ("plugin://plugin.video.emby/?id=%s&mode=browsecontent&type=%s&folderid=%s"
% (tagname, mediatype, nodetype)) 'id': tagname.encode('utf-8'),
'mode': "browsecontent",
'type': mediatype,
'folderid': nodetype
}
path = plugin_path("plugin://plugin.video.emby/", params)
elif nodetype == "nextepisodes": elif nodetype == "nextepisodes":
# Custom query params = {
path = "plugin://plugin.video.emby/?id=%s&mode=nextup&limit=25" % tagname
'id': tagname.encode('utf-8'),
'mode': "nextup",
'limit': 25
}
path = plugin_path("plugin://plugin.video.emby/", params)
elif KODI == 14 and nodetype == "recentepisodes": elif KODI == 14 and nodetype == "recentepisodes":
# Custom query params = {
path = "plugin://plugin.video.emby/?id=%s&mode=recentepisodes&limit=25" % tagname
'id': tagname.encode('utf-8'),
'mode': "recentepisodes",
'limit': 25
}
path = plugin_path("plugin://plugin.video.emby/", params)
elif KODI == 14 and nodetype == "inprogressepisodes": elif KODI == 14 and nodetype == "inprogressepisodes":
# Custom query params = {
path = "plugin://plugin.video.emby/?id=%s&mode=inprogressepisodes&limit=25"% tagname
'id': tagname.encode('utf-8'),
'mode': "inprogressepisodes",
'limit': 25
}
path = plugin_path("plugin://plugin.video.emby/", params)
else: else:
path = "library://video/emby/%s/%s.xml" % (viewid, nodetype) path = "library://video/emby/%s/%s.xml" % (viewid, nodetype)