2015-11-28, 09:40
Hi,
I have made a addons for kodi. But i want to get the list of the channels from a json(php) on the web.
default.py
Json
Hope someone here can help me.
I have made a addons for kodi. But i want to get the list of the channels from a json(php) on the web.
default.py
PHP Code:
import sys, os, re, xbmc, xbmcgui, xbmcaddon, xbmcplugin, urllib2
import json
addon = xbmcaddon.Addon(id='plugin.video.myplugin')
version = addon.getAddonInfo('version')
pluginpath = addon.getAddonInfo('path')
imagepath = os.path.join(xbmc.translatePath(pluginpath),'resources','images')
def additem(channel_id, title,streamurl):
listitem = xbmcgui.ListItem(title, thumbnailImage = os.path.join(imagepath,channel_id + '.gif'))
xbmcplugin.addDirectoryItem(int(sys.argv[1]), streamurl, listitem, totalItems=2)
additem('1', 'test channel','http://mydomain.com/master.m3u8')
additem('2', 'test channel','http://mydomain.com/master.m3u8')
xbmcplugin.endOfDirectory(int(sys.argv[1]))
Json
PHP Code:
{"1":{"title":"test channel 1","link":"http:\/\/mydomain.com\/master.m3u8","img":"http:\/\/mydomain.com\/img\/logo.png"},"2":{"title":"test channel 2","link":"http:\/\/mydomain.com\/master2.m3u8","img":"http:\/\/mydomain.com\/img\/logo.png"}}
Hope someone here can help me.