Merge remote-tracking branch 'MediaBrowser/master' into develop
This commit is contained in:
commit
e0918ba7aa
6 changed files with 59 additions and 31 deletions
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<addon id="plugin.video.plexkodiconnect"
|
<addon id="plugin.video.plexkodiconnect"
|
||||||
name="PlexKodiConnect"
|
name="PlexKodiConnect"
|
||||||
version="2.2.7"
|
version="2.2.8"
|
||||||
provider-name="croneter">
|
provider-name="croneter">
|
||||||
<requires>
|
<requires>
|
||||||
<import addon="xbmc.python" version="2.1.0"/>
|
<import addon="xbmc.python" version="2.1.0"/>
|
||||||
|
|
|
@ -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
|
version 2.2.7
|
||||||
- Prevent Kodi screensaver during the initial sync
|
- Prevent Kodi screensaver during the initial sync
|
||||||
|
|
||||||
|
|
12
default.py
12
default.py
|
@ -51,7 +51,6 @@ class Main:
|
||||||
|
|
||||||
'reset': utils.reset,
|
'reset': utils.reset,
|
||||||
'resetauth': entrypoint.resetAuth,
|
'resetauth': entrypoint.resetAuth,
|
||||||
'extrafanart': entrypoint.getExtraFanArt,
|
|
||||||
'play': entrypoint.doPlayback,
|
'play': entrypoint.doPlayback,
|
||||||
'passwords': utils.passwordsXML,
|
'passwords': utils.passwordsXML,
|
||||||
'adduser': entrypoint.addUser,
|
'adduser': entrypoint.addUser,
|
||||||
|
@ -70,8 +69,15 @@ class Main:
|
||||||
'doPlexTvLogin': entrypoint.doPlexTvLogin
|
'doPlexTvLogin': entrypoint.doPlexTvLogin
|
||||||
}
|
}
|
||||||
|
|
||||||
if "extrafanart" in sys.argv[0]:
|
if "/extrafanart" in sys.argv[0]:
|
||||||
entrypoint.getExtraFanArt()
|
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):
|
if modes.get(mode):
|
||||||
# Simple functions
|
# Simple functions
|
||||||
|
|
|
@ -572,10 +572,10 @@ def BrowseContent(viewname, type="", folderid=""):
|
||||||
if not folderid:
|
if not folderid:
|
||||||
views = emby.getViews(type)
|
views = emby.getViews(type)
|
||||||
for view in views:
|
for view in views:
|
||||||
if view.get("name") == viewname:
|
if view.get("name") == viewname.decode('utf-8'):
|
||||||
folderid = view.get("id")
|
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
|
#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:
|
||||||
|
@ -584,7 +584,7 @@ def BrowseContent(viewname, type="", folderid=""):
|
||||||
itemtype = "Video,Folder,PhotoAlbum"
|
itemtype = "Video,Folder,PhotoAlbum"
|
||||||
elif type.lower() == "photos":
|
elif type.lower() == "photos":
|
||||||
xbmcplugin.setContent(int(sys.argv[1]), 'files')
|
xbmcplugin.setContent(int(sys.argv[1]), 'files')
|
||||||
itemtype = "Photo,PhotoAlbum"
|
itemtype = "Photo,PhotoAlbum,Folder"
|
||||||
else:
|
else:
|
||||||
itemtype = ""
|
itemtype = ""
|
||||||
|
|
||||||
|
@ -610,14 +610,13 @@ def BrowseContent(viewname, 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], 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)
|
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
|
||||||
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]))
|
|
||||||
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:
|
||||||
|
@ -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_RATING)
|
||||||
xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_VIDEO_RUNTIME)
|
xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_VIDEO_RUNTIME)
|
||||||
|
|
||||||
|
xbmcplugin.endOfDirectory(handle=int(sys.argv[1]))
|
||||||
|
|
||||||
##### CREATE LISTITEM FROM EMBY METADATA #####
|
##### CREATE LISTITEM FROM EMBY METADATA #####
|
||||||
def createListItemFromEmbyItem(item,art=artwork.Artwork(),doUtils=downloadutils.DownloadUtils()):
|
def createListItemFromEmbyItem(item,art=artwork.Artwork(),doUtils=downloadutils.DownloadUtils()):
|
||||||
API = api.API(item)
|
API = api.API(item)
|
||||||
|
@ -1066,28 +1067,45 @@ def getRecentEpisodes(tagname, limit):
|
||||||
|
|
||||||
xbmcplugin.endOfDirectory(handle=int(sys.argv[1]))
|
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 #####
|
##### GET EXTRAFANART FOR LISTITEM #####
|
||||||
def getExtraFanArt():
|
def getExtraFanArt(embyId,embyPath):
|
||||||
|
|
||||||
emby = embyserver.Read_EmbyServer()
|
emby = embyserver.Read_EmbyServer()
|
||||||
art = artwork.Artwork()
|
art = artwork.Artwork()
|
||||||
embyId = ""
|
|
||||||
|
|
||||||
# Get extrafanart for listitem
|
# Get extrafanart for listitem
|
||||||
# will be called by skinhelper script to get the extrafanart
|
# will be called by skinhelper script to get the extrafanart
|
||||||
try:
|
try:
|
||||||
# for tvshows we get the embyid just from the path
|
# for tvshows we get the embyid just from the path
|
||||||
if xbmc.getCondVisibility("Container.Content(tvshows) | Container.Content(seasons) | Container.Content(episodes)"):
|
if not embyId:
|
||||||
itemPath = xbmc.getInfoLabel("ListItem.Path").decode('utf-8')
|
if "plugin.video.emby" in embyPath:
|
||||||
if "plugin.video.plexkodiconnect" in itemPath:
|
embyId = embyPath.split("/")[-2]
|
||||||
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 embyId:
|
if embyId:
|
||||||
#only proceed if we actually have a emby id
|
#only proceed if we actually have a emby id
|
||||||
|
@ -1131,7 +1149,7 @@ def getExtraFanArt():
|
||||||
url=fanartFile,
|
url=fanartFile,
|
||||||
listitem=li)
|
listitem=li)
|
||||||
except Exception as e:
|
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
|
# Always do endofdirectory to prevent errors in the logs
|
||||||
xbmcplugin.endOfDirectory(int(sys.argv[1]))
|
xbmcplugin.endOfDirectory(int(sys.argv[1]))
|
||||||
|
|
|
@ -214,7 +214,7 @@ def getSongTags(file):
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
#file in use ?
|
#file in use ?
|
||||||
logMsg("Exception in getSongTags %s" %e,0)
|
utils.logMsg("Exception in getSongTags", str(e),0)
|
||||||
rating = None
|
rating = None
|
||||||
|
|
||||||
#remove tempfile if needed....
|
#remove tempfile if needed....
|
||||||
|
|
|
@ -262,14 +262,14 @@ class Read_EmbyServer():
|
||||||
retry = 0
|
retry = 0
|
||||||
while utils.window('emby_online') != "true":
|
while utils.window('emby_online') != "true":
|
||||||
# Wait server to come back online
|
# Wait server to come back online
|
||||||
if retry == 3:
|
if retry == 5:
|
||||||
log("Unable to reconnect to server. Abort process.", 1)
|
log("Unable to reconnect to server. Abort process.", 1)
|
||||||
return
|
return items
|
||||||
|
|
||||||
retry += 1
|
retry += 1
|
||||||
if xbmc.Monitor().waitForAbort(1):
|
if xbmc.Monitor().waitForAbort(1):
|
||||||
# Abort was requested while waiting.
|
# Abort was requested while waiting.
|
||||||
return
|
return items
|
||||||
else:
|
else:
|
||||||
# Request succeeded
|
# Request succeeded
|
||||||
index += jump
|
index += jump
|
||||||
|
@ -321,18 +321,18 @@ class Read_EmbyServer():
|
||||||
# Filter view types
|
# Filter view types
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# 11/10/2015 Review key, when it's added to server. Currently unavailable.
|
# 3/4/2016 OriginalCollectionType is added
|
||||||
itemtype = item.get('OriginalCollectionType', item.get('CollectionType'))
|
itemtype = item.get('OriginalCollectionType', item.get('CollectionType', "mixed"))
|
||||||
|
|
||||||
# 11/29/2015 Remove this once OriginalCollectionType is added to stable server.
|
# 11/29/2015 Remove this once OriginalCollectionType is added to stable server.
|
||||||
# Assumed missing is mixed then.
|
# Assumed missing is mixed then.
|
||||||
if itemtype is None:
|
'''if itemtype is None:
|
||||||
url = "{server}/emby/Library/MediaFolders?format=json"
|
url = "{server}/emby/Library/MediaFolders?format=json"
|
||||||
result = doUtils(url)
|
result = doUtils(url)
|
||||||
|
|
||||||
for folder in result['Items']:
|
for folder in result['Items']:
|
||||||
if itemId == folder['Id']:
|
if itemId == folder['Id']:
|
||||||
itemtype = folder.get('CollectionType', "mixed")
|
itemtype = folder.get('CollectionType', "mixed")'''
|
||||||
|
|
||||||
if name not in ('Collections', 'Trailers'):
|
if name not in ('Collections', 'Trailers'):
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue