diff --git a/code_samples/utils.py b/code_samples/utils.py index 1a71503..4232927 100644 --- a/code_samples/utils.py +++ b/code_samples/utils.py @@ -1,7 +1,8 @@ -import jwtoken +import jwtoken as jwt import threading -m3ustr = '#EXTM3U x-tvg-url="http://botallen.live/epg.xml.gz" \n\n' + +m3ustr = '#EXTM3U x-tvg-url="http://botallen.live/epg.xml.gz" \n\n' kodiPropLicenseType = "#KODIPROP:inputstream.adaptive.license_type=com.widevine.alpha" @@ -12,7 +13,7 @@ def processTokenChunks(channelList): print("Channel List is empty ..Exiting") exit(1) for channel in channelList: - ls_session_key = jwtoken.generateJWT(channel['channel_id'], iterative=False) + ls_session_key = jwt.generateJWT(channel['channel_id'], iterative=False) if ls_session_key != "": licenseUrl = channel['channel_license_url'] + "&ls_session=" + ls_session_key kodiPropLicenseUrl = "#KODIPROP:inputstream.adaptive.license_key=" + licenseUrl @@ -20,14 +21,15 @@ def processTokenChunks(channelList): print("Didn't get license for channel: Id: {0} Name:{1}".format(channel['channel_id'], channel['channel_name'])) print('Continuing...Please get license manually for channel :', channel['channel_name']) - m3ustr += "#EXTINF:-1 " + "tvg-id=ts" + channel['channel_id'] + " tvg-logo=" + channel['channel_logo'] + " group-title=" + channel['channel_genre'] + ", " - m3ustr += channel['channel_name'] + "\n" + kodiPropLicenseType + "\n" + kodiPropLicenseUrl + "\n" + channel['channel_url'] + "\n\n" + m3ustr += kodiPropLicenseType + "\n" + kodiPropLicenseUrl + "\n" + "#EXTINF:-1 " + m3ustr += "tvg-id=" + "\"" + "ts" + channel['channel_id'] + "\" " + "group-title=" + "\"" + channel['channel_genre'] + "\" " + "tvg-logo=\"" + channel[ + 'channel_logo'] + "\" ," + channel['channel_name'] + "\n" + channel['channel_url'] + "\n\n" def m3ugen(): ts = [] global m3ustr - channelList = jwtoken.getUserChannelSubscribedList() + channelList = jwt.getUserChannelSubscribedList() for i in range(0, len(channelList), 5): t = threading.Thread(target=processTokenChunks, args=([channelList[i:i + 5]])) ts.append(t) @@ -58,4 +60,4 @@ def getPrintNote(): if __name__ == '__main__': - m3ugen() + m3ugen() \ No newline at end of file