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 03ab729 commit 1f3a6b6
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.1.2~beta" provider-name="hubsif">
<addon id="plugin.video.magentasport" name="Magenta Sport" version="2.1.2~beta2" provider-name="hubsif">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
</requires>
Expand All @@ -18,6 +18,11 @@
<fanart>resources/fanart.jpg</fanart>
</assets>
<news>
v2.1.2-beta2 (2021-06-12)
- Switch to new streamAccess URL
- Remove heartbeat call
v2.1.2-beta1 (2021-05-24)
- get live events from epg
v2.1.1 (2021-04-04)
- fix bug in auth request
v2.1.0 (2021-02-27)
Expand Down
30 changes: 0 additions & 30 deletions default.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,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 @@ -75,25 +74,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 = urllib.request.urlopen(urllib.request.Request(heartbeat_url + '/initialize', json.dumps({"media": videoid}).encode(), {'xauthorization': jwt, 'Content-Type': 'application/json'})).read()
except urllib.error.HTTPError as error:
response = error.read()

try:
urllib.request.urlopen(urllib.request.Request(heartbeat_url + '/destroy', "".encode(), {'xauthorization': jwt, 'Content-Type': 'application/json'})).read()
except urllib.error.HTTPError as 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 @@ -266,16 +246,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 1f3a6b6

Please sign in to comment.