Skip to content
This repository has been archived by the owner on Sep 4, 2019. It is now read-only.

Commit

Permalink
fix login url, closes #8
Browse files Browse the repository at this point in the history
fix display of live games in main menu
  • Loading branch information
hubsif committed Sep 30, 2016
1 parent 6e00249 commit ff3858d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 15 deletions.
2 changes: 1 addition & 1 deletion addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon id="plugin.video.tk_bbl" name="Telekom Basketball" version="1.1.1" provider-name="hubsif">
<addon id="plugin.video.tk_bbl" name="Telekom Basketball" version="1.1.2" provider-name="hubsif">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
</requires>
Expand Down
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
1.1.2 (2016/09/30)
- fix login url
- fix display of live games in main menu

1.1.1 (2015/10/02)
- change addon path translation method

Expand Down
39 changes: 25 additions & 14 deletions default.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@
def build_url(query):
return _addon_url + '?' + urllib.urlencode(query)

def get_current(json):
if 'isCurrent' in json and json['isCurrent'] == 'true':
if json['children']:
for child in json['children']:
result = get_current(child)
if result:
return result
else:
return json['href']


##############
# main routine
Expand Down Expand Up @@ -71,22 +81,23 @@ def bar(*args, **kw):
mode = args.get('mode', None)

if mode is None:
# load live games
response = urllib.urlopen("https://www.telekombasketball.de/feed/getTeaser.php").read()
xmlroot = ET.ElementTree(ET.fromstring(response))

for video in xmlroot.getiterator('VIDEO'):
if video.get('ISLIVESTREAM') == 'true' and video.get('ISLIVE') == 'true':
url = build_url({'mode': '3', 'id': video.get('ID'), 'scheduled_start': video.get('scheduled_start')})
li = xbmcgui.ListItem(video.find('TITLE').text, iconImage=video.find('GAME_IMG').text, thumbnailImage=video.find('GAME_IMG').text)
li.setProperty('fanart_image', video.find('IMAGE_ORIGINAL').text)
li.setProperty('IsPlayable', 'true')
xbmcplugin.addDirectoryItem(handle=_addon_handler, url=url, listitem=li)

# load menu
response = urllib.urlopen("https://www.telekombasketball.de/feed/getFilter.php").read()
jsonResult = json.loads(response)


# load live games
live_target = get_current(jsonResult)
if live_target:
response = urllib.urlopen("https://www.telekombasketball.de/feed/getHomeFeed.php?targetID=8,20&template=2015&" + live_target).read()
xmlroot = ET.ElementTree(ET.fromstring(response))
for video in xmlroot.getiterator('VIDEO'):
if video.get('ISLIVESTREAM') == 'true' and video.get('ISLIVE') == 'true':
url = build_url({'mode': '4', 'id': video.get('ID'), 'scheduled_start': video.get('scheduled_start')})
li = xbmcgui.ListItem(video.find('TITLE').text, iconImage=video.find('GAME_IMG').text, thumbnailImage=video.find('GAME_IMG').text)
li.setProperty('fanart_image', video.find('IMAGE_ORIGINAL').text)
li.setProperty('IsPlayable', 'true')
xbmcplugin.addDirectoryItem(handle=_addon_handler, url=url, listitem=li)

for rounds in jsonResult['children']:
url = build_url({'mode': '1', 'text': rounds['text']})
li = xbmcgui.ListItem(rounds['text'], iconImage='DefaultFolder.png')
Expand Down Expand Up @@ -187,7 +198,7 @@ def bar(*args, **kw):
state = str(time) + str(rand);

browser.open("https://www.telekombasketball.de")
browser.open("https://accounts.login.idm.telekom.com/oauth2/auth?response_type=code&client_id=10LIVESAM30000004901BEKOBBL0000000000000&scope=openid&redirect_uri=http:%2F%2Fwww.telekombasketball.de%2Foauth.php%3Frequest%3Dlogin%26headto%3Dhttp:%2F%2Fwww.telekombasketball.de%2F&state="+state+"&claims=%7B%22id_token%22%3A%7B%22urn%3Atelekom.com%3Aall%22%3Anull%7D%7D")
browser.open("https://www.telekombasketball.de/service/oauth/login.php?headto=https://www.telekombasketball.de")

browser.select_form(name="login")
browser.form['pw_usr'] = _addon.getSetting('username')
Expand Down

0 comments on commit ff3858d

Please sign in to comment.