Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix livestreams on Kodi 19 #354

Merged
merged 1 commit into from
Feb 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 30 additions & 16 deletions resources/lib/vtmgo/vtmgostream.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
class VtmGoStream:
""" VTM GO Stream API """

_API_KEY = 'r9EOnHOp1pPL5L4FuGzBPSIHwrQnPu5TBfW16y75'
_V5_API_KEY = '3vjmWnsxF7SUTeNCBZlnUQ4Z7GQV8f6miQ514l10'
_V6_API_KEY = 'r9EOnHOp1pPL5L4FuGzBPSIHwrQnPu5TBfW16y75'

def __init__(self, tokens=None):
""" Initialise object """
Expand Down Expand Up @@ -159,21 +160,34 @@ def _get_video_info(self, strtype, stream_id, player_token):
"""
url = 'https://videoplayer-service.dpgmedia.net/config/%s/%s' % (strtype, stream_id)
_LOGGER.debug('Getting video info from %s', url)
response = util.http_post(url,
params={
'startPosition': '0.0',
'autoPlay': 'true',
},
data={
'deviceType': 'android-tv',
'zone': 'vtmgo',
},
headers={
'Accept': 'application/json',
'x-api-key': self._API_KEY,
'Popcorn-SDK-Version': '6',
'Authorization': 'Bearer ' + player_token,
})
# Live channels: Fallback to old Popcorn SDK 5 for Kodi 19 and lower, because new livestream format is not supported
if kodiutils.kodi_version_major() <= 19 and strtype == 'channels':
response = util.http_get(url,
params={
'startPosition': '0.0',
'autoPlay': 'true',
},
headers={
'Accept': 'application/json',
'x-api-key': self._V5_API_KEY,
'Popcorn-SDK-Version': '5',
})
else:
response = util.http_post(url,
params={
'startPosition': '0.0',
'autoPlay': 'true',
},
data={
'deviceType': 'android-tv',
'zone': 'vtmgo',
},
headers={
'Accept': 'application/json',
'x-api-key': self._V6_API_KEY,
'Popcorn-SDK-Version': '6',
'Authorization': 'Bearer ' + player_token,
})

info = json.loads(response.text)
return info
Expand Down