mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-24 01:36:11 +00:00
Merge branch 'master' of https://github.com/MediaBrowser/plugin.video.emby
This commit is contained in:
commit
81aa96d540
3 changed files with 41 additions and 18 deletions
12
default.py
12
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,8 +65,15 @@ class Main:
|
|||
'deviceid': entrypoint.resetDeviceId
|
||||
}
|
||||
|
||||
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
|
||||
|
|
|
@ -951,28 +951,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.emby" 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.emby" 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
|
||||
|
@ -1016,7 +1033,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]))
|
|
@ -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....
|
||||
|
|
Loading…
Reference in a new issue