mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
added support for channels
This commit is contained in:
parent
57156cfb1c
commit
c374b166bb
3 changed files with 29 additions and 13 deletions
18
default.py
18
default.py
|
@ -34,11 +34,8 @@ if mode == "play" or mode == "playfromaddon":
|
||||||
# Play items via plugin://plugin.video.emby/
|
# Play items via plugin://plugin.video.emby/
|
||||||
url = "{server}/mediabrowser/Users/{UserId}/Items/%s?format=json&ImageTypeLimit=1" % id
|
url = "{server}/mediabrowser/Users/{UserId}/Items/%s?format=json&ImageTypeLimit=1" % id
|
||||||
result = DownloadUtils().downloadUrl(url)
|
result = DownloadUtils().downloadUrl(url)
|
||||||
#from from addon needed if the palyback is launched from the addon itself
|
|
||||||
if mode == "playfromaddon":
|
|
||||||
item = PlaybackUtils().PLAY(result, setup="service")
|
item = PlaybackUtils().PLAY(result, setup="service")
|
||||||
else:
|
|
||||||
item = PlaybackUtils().PLAY(result, setup="default")
|
|
||||||
|
|
||||||
elif mode == "reset":
|
elif mode == "reset":
|
||||||
utils.reset()
|
utils.reset()
|
||||||
|
@ -53,7 +50,6 @@ elif mode == "resetauth":
|
||||||
xbmc.executebuiltin('Addon.OpenSettings(plugin.video.emby)')
|
xbmc.executebuiltin('Addon.OpenSettings(plugin.video.emby)')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if mode == "channels" or mode == "channelsfolder":
|
if mode == "channels" or mode == "channelsfolder":
|
||||||
id = params['id']
|
id = params['id']
|
||||||
|
|
||||||
|
@ -195,10 +191,11 @@ if mode == "channels" or mode == "channelsfolder":
|
||||||
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=file, listitem=liz, isFolder=True)
|
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=file, listitem=liz, isFolder=True)
|
||||||
|
|
||||||
elif isFolder == True:
|
elif isFolder == True:
|
||||||
file = _addon_url + "?id=%s&mode=channels&folderid=%s" %(channelId, id)
|
file = _addon_url + "?id=%s&mode=channelsfolder&folderid=%s" %(channelId, id)
|
||||||
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=file, listitem=liz, isFolder=True)
|
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=file, listitem=liz, isFolder=True)
|
||||||
else:
|
else:
|
||||||
file = _addon_url + "?id=%s&mode=playfromaddon"%id
|
file = _addon_url + "?id=%s&mode=play"%id
|
||||||
|
liz.setProperty('IsPlayable', 'true')
|
||||||
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=file, listitem=liz)
|
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=file, listitem=liz)
|
||||||
|
|
||||||
xbmcplugin.endOfDirectory(handle=int(sys.argv[1]))
|
xbmcplugin.endOfDirectory(handle=int(sys.argv[1]))
|
||||||
|
@ -232,6 +229,7 @@ elif mode == "nextup":
|
||||||
plot = item['plot']
|
plot = item['plot']
|
||||||
liz = xbmcgui.ListItem(item['title'])
|
liz = xbmcgui.ListItem(item['title'])
|
||||||
liz.setInfo( type="Video", infoLabels={ "Title": item['title'] })
|
liz.setInfo( type="Video", infoLabels={ "Title": item['title'] })
|
||||||
|
liz.setProperty('IsPlayable', 'true')
|
||||||
liz.setInfo( type="Video", infoLabels={ "duration": str(item['runtime']/60) })
|
liz.setInfo( type="Video", infoLabels={ "duration": str(item['runtime']/60) })
|
||||||
liz.setInfo( type="Video", infoLabels={ "Episode": item['episode'] })
|
liz.setInfo( type="Video", infoLabels={ "Episode": item['episode'] })
|
||||||
liz.setInfo( type="Video", infoLabels={ "Season": item['season'] })
|
liz.setInfo( type="Video", infoLabels={ "Season": item['season'] })
|
||||||
|
@ -258,7 +256,7 @@ elif mode == "nextup":
|
||||||
for key, value in item['streamdetails'].iteritems():
|
for key, value in item['streamdetails'].iteritems():
|
||||||
for stream in value:
|
for stream in value:
|
||||||
liz.addStreamInfo( key, stream )
|
liz.addStreamInfo( key, stream )
|
||||||
file = item['file'].replace("mode=play","mode=playfromaddon")
|
#file = item['file'].replace("mode=play","mode=playfromaddon")
|
||||||
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=file, listitem=liz)
|
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=file, listitem=liz)
|
||||||
count +=1
|
count +=1
|
||||||
if count == limit:
|
if count == limit:
|
||||||
|
@ -314,5 +312,9 @@ elif "extrafanart" in sys.argv[0]:
|
||||||
xbmcplugin.endOfDirectory(int(sys.argv[1]))
|
xbmcplugin.endOfDirectory(int(sys.argv[1]))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
#open the addon settings if the addon is called directly from video addons
|
||||||
|
try:
|
||||||
|
if "content_type" in sys.argv[2]:
|
||||||
xbmc.executebuiltin('Addon.OpenSettings(plugin.video.emby)')
|
xbmc.executebuiltin('Addon.OpenSettings(plugin.video.emby)')
|
||||||
|
except: pass
|
||||||
|
|
||||||
|
|
|
@ -163,6 +163,8 @@ class PlayUtils():
|
||||||
return '2147483' # max bit rate supported by server (max signed 32bit integer)
|
return '2147483' # max bit rate supported by server (max signed 32bit integer)
|
||||||
|
|
||||||
def fileExists(self, result):
|
def fileExists(self, result):
|
||||||
|
if not result.has_key("Path"):
|
||||||
|
return False
|
||||||
path=result.get("Path").encode('utf-8')
|
path=result.get("Path").encode('utf-8')
|
||||||
if os.path.exists(path) == True:
|
if os.path.exists(path) == True:
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -1041,7 +1041,18 @@ class WriteKodiDB():
|
||||||
import shutil
|
import shutil
|
||||||
shutil.copytree(xbmc.translatePath("special://xbmc/system/library/video"), xbmc.translatePath("special://userdata/library/video"))
|
shutil.copytree(xbmc.translatePath("special://xbmc/system/library/video"), xbmc.translatePath("special://userdata/library/video"))
|
||||||
|
|
||||||
libraryPath = xbmc.translatePath("special://userdata/library/video/emby/")
|
#create tag node for emby channels
|
||||||
|
nodefile = os.path.join(xbmc.translatePath("special://userdata/library/video"), "emby_channels.xml")
|
||||||
|
if not xbmcvfs.exists(nodefile):
|
||||||
|
root = Element("node", {"order":"20", "type":"folder"})
|
||||||
|
SubElement(root, "label").text = "Emby - Channels"
|
||||||
|
SubElement(root, "path").text = "plugin://plugin.video.emby/?id=0&mode=channels"
|
||||||
|
SubElement(root, "icon").text = "DefaultMovies.png"
|
||||||
|
try:
|
||||||
|
ET.ElementTree(root).write(nodefile, xml_declaration=True)
|
||||||
|
except:
|
||||||
|
ET.ElementTree(root).write(nodefile)
|
||||||
|
|
||||||
|
|
||||||
if type == "movie":
|
if type == "movie":
|
||||||
type = "movies"
|
type = "movies"
|
||||||
|
@ -1171,6 +1182,7 @@ class WriteKodiDB():
|
||||||
except:
|
except:
|
||||||
ET.ElementTree(root).write(nodefile)
|
ET.ElementTree(root).write(nodefile)
|
||||||
|
|
||||||
|
|
||||||
def updateBoxsetToKodiLibrary(self, boxsetmovie, boxset, connection, cursor):
|
def updateBoxsetToKodiLibrary(self, boxsetmovie, boxset, connection, cursor):
|
||||||
strSet = boxset["Name"]
|
strSet = boxset["Name"]
|
||||||
cursor.execute("SELECT kodi_id FROM emby WHERE emby_id = ?",(boxsetmovie["Id"],))
|
cursor.execute("SELECT kodi_id FROM emby WHERE emby_id = ?",(boxsetmovie["Id"],))
|
||||||
|
|
Loading…
Reference in a new issue