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/
|
||||
url = "{server}/mediabrowser/Users/{UserId}/Items/%s?format=json&ImageTypeLimit=1" % id
|
||||
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")
|
||||
else:
|
||||
item = PlaybackUtils().PLAY(result, setup="default")
|
||||
|
||||
|
||||
elif mode == "reset":
|
||||
utils.reset()
|
||||
|
@ -53,7 +50,6 @@ elif mode == "resetauth":
|
|||
xbmc.executebuiltin('Addon.OpenSettings(plugin.video.emby)')
|
||||
|
||||
|
||||
|
||||
if mode == "channels" or mode == "channelsfolder":
|
||||
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)
|
||||
|
||||
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)
|
||||
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.endOfDirectory(handle=int(sys.argv[1]))
|
||||
|
@ -232,6 +229,7 @@ elif mode == "nextup":
|
|||
plot = item['plot']
|
||||
liz = xbmcgui.ListItem(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={ "Episode": item['episode'] })
|
||||
liz.setInfo( type="Video", infoLabels={ "Season": item['season'] })
|
||||
|
@ -258,7 +256,7 @@ elif mode == "nextup":
|
|||
for key, value in item['streamdetails'].iteritems():
|
||||
for stream in value:
|
||||
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)
|
||||
count +=1
|
||||
if count == limit:
|
||||
|
@ -314,5 +312,9 @@ elif "extrafanart" in sys.argv[0]:
|
|||
xbmcplugin.endOfDirectory(int(sys.argv[1]))
|
||||
|
||||
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)')
|
||||
except: pass
|
||||
|
||||
|
|
|
@ -163,6 +163,8 @@ class PlayUtils():
|
|||
return '2147483' # max bit rate supported by server (max signed 32bit integer)
|
||||
|
||||
def fileExists(self, result):
|
||||
if not result.has_key("Path"):
|
||||
return False
|
||||
path=result.get("Path").encode('utf-8')
|
||||
if os.path.exists(path) == True:
|
||||
return True
|
||||
|
|
|
@ -1041,7 +1041,18 @@ class WriteKodiDB():
|
|||
import shutil
|
||||
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":
|
||||
type = "movies"
|
||||
|
@ -1171,6 +1182,7 @@ class WriteKodiDB():
|
|||
except:
|
||||
ET.ElementTree(root).write(nodefile)
|
||||
|
||||
|
||||
def updateBoxsetToKodiLibrary(self, boxsetmovie, boxset, connection, cursor):
|
||||
strSet = boxset["Name"]
|
||||
cursor.execute("SELECT kodi_id FROM emby WHERE emby_id = ?",(boxsetmovie["Id"],))
|
||||
|
|
Loading…
Reference in a new issue