def watchVideo(id): links = getVideoLinks(id) neededQ = "" if kodiutils.getSettingAsBool('PreferHD'): neededQ = 'HD' else: neededQ = 'SD' fUrl = '' for url in links: if url['protocol'] == 'HTTP-HLS': fUrl = url['url'] if url['quality'] == neededQ: break if fUrl: auth = getAuthString(fUrl) if auth: subs = [] if kodiutils.getSettingAsBool('parseSubs'): for url in links: if url['protocol'] == 'TTMLUrl': subpath = ttmlToSrt(url['url']) if subpath: subs.append(subpath) kodiutils.setResolvedUrl('{url}?{auth}|User-Agent={ua}'.format(url=fUrl,auth=auth,ua=urllib.quote_plus(useragent)), subs=subs) kodiutils.setResolvedUrl("",solved=False)
def riproduci_guid(self, guid): res = self.med.OttieniInfoDaGuid(guid) if not res or 'media' not in res: kodiutils.showOkDialog(kodiutils.LANGUAGE(32132), kodiutils.LANGUAGE(32136)) kodiutils.setResolvedUrl(solved=False) return self.riproduci_video(res['media'][0]['pid'])
def riproduci_guid(self, guid='', offset=None): kodiutils.log('riproduci_guid: guid={}, offset={}'.format( guid, offset)) res = self.med.OttieniInfoDaGuid(guid) if not res or 'media' not in res: kodiutils.showOkDialog(kodiutils.LANGUAGE(32132), kodiutils.LANGUAGE(32136)) kodiutils.setResolvedUrl(solved=False) return self.riproduci_video(guid=guid, pid=res['media'][0]['pid'], offset=offset)
def playMediaset(streamId): url = mediaset.get_stream(streamId) if (url): # Play the item if ("mp4" in url): kodiutils.setResolvedUrl(url["mp4"]) elif ("f4v" in url): kodiutils.setResolvedUrl(url["f4v"]) elif ("wmv" in url): kodiutils.setResolvedUrl(url["wmv"]) kodiutils.setResolvedUrl(solved=False)
def playMediaset(streamId): url = mediaset.get_stream(streamId) if (url): # Play the item if ("mp4" in url): kodiutils.setResolvedUrl(url["mp4"]) elif ("f4v" in url): kodiutils.setResolvedUrl(url["f4v"]) elif ("wmv" in url): kodiutils.setResolvedUrl(url["wmv"]) kodiutils.setResolvedUrl(solved=False)
def riproduci_video(self, pid, live=False): from inputstreamhelper import Helper # pylint: disable=import-error kodiutils.log("Trying to get the video from pid" + pid) data = self.med.OttieniDatiVideo(pid, live) if data['type'] == 'video/mp4': kodiutils.setResolvedUrl(data['url']) return is_helper = Helper('mpd', 'com.widevine.alpha' if data['security'] else None) if not is_helper.check_inputstream(): kodiutils.showOkDialog(kodiutils.LANGUAGE(32132), kodiutils.LANGUAGE(32133)) kodiutils.setResolvedUrl(solved=False) return headers = '&User-Agent={useragent}'.format(useragent=self.ua) props = {'manifest_type': 'mpd', 'stream_headers': headers} if data['security']: user = kodiutils.getSetting('email') password = kodiutils.getSetting('password') if user == '' or password == '': kodiutils.showOkDialog(kodiutils.LANGUAGE(32132), kodiutils.LANGUAGE(32134)) kodiutils.setResolvedUrl(solved=False) return if not self.med.login(user, password): kodiutils.showOkDialog(kodiutils.LANGUAGE(32132), kodiutils.LANGUAGE(32135)) kodiutils.setResolvedUrl(solved=False) return headers += '&Accept=*/*&Content-Type=' props['license_type'] = 'com.widevine.alpha' props['stream_headers'] = headers url = self.med.OttieniWidevineAuthUrl(data['pid']) props['license_key'] = '{url}|{headers}|R{{SSM}}|'.format( url=url, headers=headers) headers = { 'user-agent': self.ua, 't-apigw': self.med.apigw, 't-cts': self.med.cts } kodiutils.setResolvedUrl(data['url'], headers=headers, ins=is_helper.inputstream_addon, insdata=props)
def playLive(streamUrl): # Play the item kodiutils.setResolvedUrl(streamUrl)
def playLive(streamUrl): # Play the item kodiutils.setResolvedUrl(streamUrl)
def playRaiyoyo(streamUrl): kodiutils.setResolvedUrl(streamUrl)
def riproduci_video(self, guid=None, pid=None, live=False, offset=None): from inputstreamhelper import Helper # pylint: disable=import-error # kodiutils.log("Trying to get the video from pid %s" % pid) kodiutils.log( 'riproduci_video: guid={}, pid={}, live={}, offset={}'.format( guid, pid, live, offset)) data = self.med.OttieniDatiVideo(pid, live) kodiutils.log('riproduci_video: data={}'.format(str(data))) if data['type'] == 'video/mp4': kodiutils.setResolvedUrl(data['url']) return is_helper = Helper('mpd', 'com.widevine.alpha' if data['security'] else None) if not is_helper.check_inputstream(): kodiutils.showOkDialog(kodiutils.LANGUAGE(32132), kodiutils.LANGUAGE(32133)) kodiutils.setResolvedUrl(solved=False) return headers = '&User-Agent={useragent}'.format(useragent=self.ua) props = {'manifest_type': 'mpd', 'stream_headers': headers} properties = {'ResumeTime': '0.0'} isAutenticated = False scrobbling = kodiutils.getSettingAsNum('scrobbling') if scrobbling and not self.isAnonimous: properties['guid'] = guid if scrobbling == self.ADDON_SCROBBLING_CUSTOM: if offset: properties['offset'] = str(offset) else: user = kodiutils.getSetting('email') password = kodiutils.getSetting('password') isAutenticated = self.med.login(user, password) if isAutenticated: offset = self.med.getProgress(guid) if offset: properties['offset'] = str(offset) if data['security']: if not isAutenticated: user = kodiutils.getSetting('email') password = kodiutils.getSetting('password') if user == '' or password == '': kodiutils.showOkDialog(kodiutils.LANGUAGE(32132), kodiutils.LANGUAGE(32134)) kodiutils.setResolvedUrl(solved=False) return if not self.med.login(user, password): kodiutils.showOkDialog(kodiutils.LANGUAGE(32132), kodiutils.LANGUAGE(32135)) kodiutils.setResolvedUrl(solved=False) return headers += '&Accept=*/*&Content-Type=' props['license_type'] = 'com.widevine.alpha' props['stream_headers'] = headers url = self.med.OttieniWidevineAuthUrl(data['pid']) props['license_key'] = '{url}|{headers}|R{{SSM}}|'.format( url=url, headers=headers) headers = { 'user-agent': self.ua, 't-apigw': self.med.apigw, 't-cts': self.med.cts } kodiutils.log("riproduci_video properties: %s" % properties) kodiutils.setResolvedUrl(data['url'], headers=headers, ins=is_helper.inputstream_addon, insdata=props, properties=properties)