Merge remote-tracking branch 'MediaBrowser/master' into develop

This commit is contained in:
tomkat83 2016-03-07 09:54:01 +01:00
commit e0918ba7aa
6 changed files with 59 additions and 31 deletions

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.plexkodiconnect"
name="PlexKodiConnect"
version="2.2.7"
version="2.2.8"
provider-name="croneter">
<requires>
<import addon="xbmc.python" version="2.1.0"/>

View file

@ -1,3 +1,7 @@
version 2.2.8
- Fix to photos not displaying directories without picutres.
- Fix to grouped views causing crash
version 2.2.7
- Prevent Kodi screensaver during the initial sync

View file

@ -51,7 +51,6 @@ class Main:
'reset': utils.reset,
'resetauth': entrypoint.resetAuth,
'extrafanart': entrypoint.getExtraFanArt,
'play': entrypoint.doPlayback,
'passwords': utils.passwordsXML,
'adduser': entrypoint.addUser,
@ -70,8 +69,15 @@ class Main:
'doPlexTvLogin': entrypoint.doPlexTvLogin
}
if "extrafanart" in sys.argv[0]:
entrypoint.getExtraFanArt()
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

View file

@ -572,10 +572,10 @@ def BrowseContent(viewname, type="", folderid=""):
if not folderid:
views = emby.getViews(type)
for view in views:
if view.get("name") == viewname:
if view.get("name") == viewname.decode('utf-8'):
folderid = view.get("id")
utils.logMsg("BrowseContent","viewname: %s - type: %s - folderid: %s - filter: %s" %(viewname, type, folderid, filter))
utils.logMsg("BrowseContent","viewname: %s - type: %s - folderid: %s - filter: %s" %(viewname.decode('utf-8'), type.decode('utf-8'), folderid.decode('utf-8'), filter.decode('utf-8')))
#set the correct params for the content type
#only proceed if we have a folderid
if folderid:
@ -584,7 +584,7 @@ def BrowseContent(viewname, type="", folderid=""):
itemtype = "Video,Folder,PhotoAlbum"
elif type.lower() == "photos":
xbmcplugin.setContent(int(sys.argv[1]), 'files')
itemtype = "Photo,PhotoAlbum"
itemtype = "Photo,PhotoAlbum,Folder"
else:
itemtype = ""
@ -610,14 +610,13 @@ def BrowseContent(viewname, type="", folderid=""):
li = createListItemFromEmbyItem(item,art,doUtils)
if item.get("IsFolder") == True:
#for folders we add an additional browse request, passing the folderId
path = "%s?id=%s&mode=browsecontent&type=%s&folderid=%s" % (sys.argv[0], viewname, type, item.get("Id"))
path = "%s?id=%s&mode=browsecontent&type=%s&folderid=%s" % (sys.argv[0].decode('utf-8'), viewname.decode('utf-8'), type.decode('utf-8'), item.get("Id").decode('utf-8'))
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=path, listitem=li, isFolder=True)
else:
#playable item, set plugin path and mediastreams
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=li.getProperty("path"), listitem=li)
xbmcplugin.endOfDirectory(handle=int(sys.argv[1]))
if filter == "recent":
xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_DATE)
else:
@ -626,6 +625,8 @@ def BrowseContent(viewname, type="", folderid=""):
xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_VIDEO_RATING)
xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_VIDEO_RUNTIME)
xbmcplugin.endOfDirectory(handle=int(sys.argv[1]))
##### CREATE LISTITEM FROM EMBY METADATA #####
def createListItemFromEmbyItem(item,art=artwork.Artwork(),doUtils=downloadutils.DownloadUtils()):
API = api.API(item)
@ -1066,28 +1067,45 @@ 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():
def getExtraFanArt(embyId,embyPath):
emby = embyserver.Read_EmbyServer()
art = artwork.Artwork()
embyId = ""
# Get extrafanart for listitem
# will be called by skinhelper script to get the extrafanart
try:
# for tvshows we get the embyid just from the path
if xbmc.getCondVisibility("Container.Content(tvshows) | Container.Content(seasons) | Container.Content(episodes)"):
itemPath = xbmc.getInfoLabel("ListItem.Path").decode('utf-8')
if "plugin.video.plexkodiconnect" in itemPath:
embyId = itemPath.split("/")[-2]
else:
#for movies we grab the emby id from the params
itemPath = xbmc.getInfoLabel("ListItem.FileNameAndPath").decode('utf-8')
if "plugin.video.plexkodiconnect" in itemPath:
params = urlparse.parse_qs(itemPath)
embyId = params.get('id')
if embyId: embyId = embyId[0]
if not embyId:
if "plugin.video.emby" in embyPath:
embyId = embyPath.split("/")[-2]
if embyId:
#only proceed if we actually have a emby id
@ -1131,7 +1149,7 @@ def getExtraFanArt():
url=fanartFile,
listitem=li)
except Exception as e:
utils.logMsg("EMBY", "Error getting extrafanart: %s" % e, 1)
utils.logMsg("EMBY", "Error getting extrafanart: %s" % e, 0)
# Always do endofdirectory to prevent errors in the logs
xbmcplugin.endOfDirectory(int(sys.argv[1]))

View file

@ -214,7 +214,7 @@ def getSongTags(file):
except Exception as e:
#file in use ?
logMsg("Exception in getSongTags %s" %e,0)
utils.logMsg("Exception in getSongTags", str(e),0)
rating = None
#remove tempfile if needed....

View file

@ -262,14 +262,14 @@ class Read_EmbyServer():
retry = 0
while utils.window('emby_online') != "true":
# Wait server to come back online
if retry == 3:
if retry == 5:
log("Unable to reconnect to server. Abort process.", 1)
return
return items
retry += 1
if xbmc.Monitor().waitForAbort(1):
# Abort was requested while waiting.
return
return items
else:
# Request succeeded
index += jump
@ -321,18 +321,18 @@ class Read_EmbyServer():
# Filter view types
continue
# 11/10/2015 Review key, when it's added to server. Currently unavailable.
itemtype = item.get('OriginalCollectionType', item.get('CollectionType'))
# 3/4/2016 OriginalCollectionType is added
itemtype = item.get('OriginalCollectionType', item.get('CollectionType', "mixed"))
# 11/29/2015 Remove this once OriginalCollectionType is added to stable server.
# Assumed missing is mixed then.
if itemtype is None:
'''if itemtype is None:
url = "{server}/emby/Library/MediaFolders?format=json"
result = doUtils(url)
for folder in result['Items']:
if itemId == folder['Id']:
itemtype = folder.get('CollectionType', "mixed")
itemtype = folder.get('CollectionType', "mixed")'''
if name not in ('Collections', 'Trailers'):