2015-08-09, 17:40
import this
Add To Top
Replace ########## With You Addon Id Example plugin.video.plugin
The Directory Item
Add This Anywere
Add This To The Bottom
PHP Code:
import datatime
Add To Top
Replace ########## With You Addon Id Example plugin.video.plugin
PHP Code:
ADDON = xbmcaddon.Addon(id='###########')
AddonID = '###############'
Addon = xbmcaddon.Addon(AddonID)
addonDir = Addon.getAddonInfo('path').decode("utf-8")
dateshort= datetime.datetime.today().strftime('%d/%m')
The Directory Item
PHP Code:
addDir('Premier League','/channelshow.php',35,'%s/HD1.png'%(addonDir))
Add This Anywere
PHP Code:
def FOOTBALL():
addDir('[B]View Current League Table[/B]','settings',36,'%s/CTH_1.png'%(addonDir))
addDir('[B]See Fixtures Week 1[/B]','1',37,'%s/CTH_1.png'%(addonDir))
addDir('[B]See Fixtures Week 2[/B]','2',37,'%s/CTH_1.png'%(addonDir))
addDir('[B]See Fixtures Week 3[/B]','3',37,'%s/CTH_1.png'%(addonDir))
addDir('[B]See Fixtures Week 4[/B]','4',37,'%s/CTH_1.png'%(addonDir))
addDir('[B]See Fixtures Week 5[/B]','5',37,'%s/CTH_1.png'%(addonDir))
addDir('[B]See Fixtures Week 6[/B]','6',37,'%s/CTH_1.png'%(addonDir))
addDir2('Settings','settings',3,'%s/CTH_2.png'%(addonDir))
addDir2('Settings','settings',3,'%s/CTH_3.png'%(addonDir))
addDir2('Settings','settings',3,'%s/CTH_4.png'%(addonDir))
addDir2('Settings','settings',3,'%s/CTH_5.png'%(addonDir))
def TABLE():
url = 'http://m.premierleague.com/en-gb/league-table.html'
link = OPEN_URL(url)
match=re.compile('/en-gb/clubs/club-profile.html/(.+?)"').findall(link)
for name in match:
addDir('[COLOR white]%s [/COLOR]'%(name),'','','')
def FIXTURES(url):
num = url
url = 'http://m.premierleague.com/pa-services/api/football/mobile/competition/fandr/api/gameweek/%s.json'%(num)
link = OPEN_URL(url)
match=re.compile('"awayTeamScore":(.+?),"homeTeamScore":(.+?),"liveMatch":(.+?),".+?status":"(.+?)".+?"koTime":"(.+?)",".+?displayShortDate":"(.+?)","awayTeamClubURL":"(.+?)","homeTeamClubURL":"(.+?)"').findall(link)
for s1,s2,live,name,l1,l2,l3,l4 in match:
if name == "fulltime":
if s1 > s2:
addDir('[COLOR red]%s [/COLOR][COLOR gold]%s [B]%s[/B][/COLOR][COLOR red] Vs [B]%s[/B] %s %s[/COLOR]'%(name.replace('fulltime','FT: '),l3,s1,s2,l4,live.replace('false',' ')),'%s %s'%(l1,l2),'','')
if s1 < s2:
addDir('[COLOR red]%s %s [B]%s[/B] Vs [B]%s[/B] [/COLOR][COLOR gold]%s[/COLOR] [COLOR red]%s[/COLOR]'%(name.replace('fulltime','FT: '),l3,s1,s2,l4,live.replace('false',' ')),'%s %s'%(l1,l2),'','')
if s1 == s2:
addDir('[COLOR blue]%s %s [B]%s[/B] Vs [B]%s[/B] %s %s[/COLOR]'%(name.replace('fulltime','FT: '),l3,s1,s2,l4,live.replace('false',' ')),'%s %s'%(l1,l2),'','')
else:
if s1 == "null":
addDir('[COLOR red]%s[/COLOR] %s %s %s %s VS %s %s '%(name.replace('FIXTURE',' '),l1,l2,l3,s1.replace('null',' '),s2.replace('null',' '),l4),'%s'%(live),'','')
else:
if l2 == dateshort:
addDir('[COLOR red]%s[/COLOR] %s %s %s %s VS %s %s %s'%(name.replace('FIXTURE',' '),l1,l2.replace('%s'%(dateshort),''),l3,s1,s2,l4,live.replace('false',' ').replace('true','[COLOR green]LIVE![/COLOR]')),'','','')
else:
addDir('[COLOR red]%s[/COLOR] %s %s %s %s VS %s %s %s'%(l2,name.replace('FIXTURE',' '),l1,l3,s1,s2,l4,live.replace('false',' ').replace('true','[COLOR green]LIVE![/COLOR]')),'','','')
def OPEN_URL(url):
req = urllib2.Request(url)
req.add_header('User-Agent' , "Magic Browser")
response = urllib2.urlopen(req)
link=response.read()
response.close()
return link
Add This To The Bottom
PHP Code:
elif mode==35:
FOOTBALL()
elif mode==36:
TABLE()
elif mode==37:
FIXTURES(url)