Skip to content

Commit

Permalink
Remove heartbeat call, fixes #39
Browse files Browse the repository at this point in the history
  • Loading branch information
hubsif committed Jun 12, 2021
1 parent f561b3b commit 927652d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 31 deletions.
7 changes: 6 additions & 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.magentasport" name="Magenta Sport" version="2.0.1~beta" provider-name="hubsif">
<addon id="plugin.video.magentasport" name="Magenta Sport" version="2.0.1~beta2" provider-name="hubsif">
<requires>
<import addon="xbmc.python" version="2.5.0"/>
</requires>
Expand All @@ -18,6 +18,11 @@
<fanart>resources/fanart.jpg</fanart>
</assets>
<news>
v2.0.1-beta2 (2021-06-12)
- Switch to new streamAccess URL
- Remove heartbeat call
v2.0.1-beta1 (2021-05-24)
- get live events from epg
v2.0.0 (2019-01-16)
- update and rename to Magentasport
- use online sports category images
Expand Down
30 changes: 0 additions & 30 deletions default.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
base_image_url = "https://www.magentasport.de"
oauth_url = "https://accounts.login.idm.telekom.com/oauth2/tokens"
jwt_url = "https://www.magentasport.de/service/auth/app/login/jwt"
heartbeat_url = "https://www.magentasport.de/service/heartbeat"
stream_url = "https://www.magentasport.de/service/player/v2/streamAccess"
main_page = "/page/1"

Expand Down Expand Up @@ -78,25 +77,6 @@ def get_jwt(username, password):
if 'status' in jsonResult and jsonResult['status'] == "success" and 'data' in jsonResult and 'token' in jsonResult['data']:
return jsonResult['data']['token']

def auth_media(jwt, videoid):
try:
response = urllib2.urlopen(urllib2.Request(heartbeat_url + '/initialize', json.dumps({"media": videoid}), {'xauthorization': jwt, 'Content-Type': 'application/json'})).read()
except urllib2.HTTPError, error:
response = error.read()

try:
urllib2.urlopen(urllib2.Request(heartbeat_url + '/destroy', "", {'xauthorization': jwt, 'Content-Type': 'application/json'})).read()
except urllib2.HTTPError, e:
pass

jsonResult = json.loads(response)
if 'status' in jsonResult and jsonResult['status'] == "success":
return "success"
elif 'status' in jsonResult and jsonResult['status'] == "error":
if 'message' in jsonResult:
return jsonResult['message']
return __language__(30006)

# plugin call modes

def getMain():
Expand Down Expand Up @@ -264,16 +244,6 @@ def getvideo():
xbmcgui.Dialog().ok(_addon_name, msg)
xbmcplugin.setResolvedUrl(_addon_handler, False, xbmcgui.ListItem())
return
if jwt:
auth_response = auth_media(jwt, videoid)
if auth_response != "success":
xbmcgui.Dialog().ok(_addon_name, auth_response)
xbmcplugin.setResolvedUrl(_addon_handler, False, xbmcgui.ListItem())
return
else:
xbmcgui.Dialog().ok(_addon_name, __language__(30005))
xbmcplugin.setResolvedUrl(_addon_handler, False, xbmcgui.ListItem())
return

jwt = jwt or 'empty'

Expand Down

0 comments on commit 927652d

Please sign in to comment.