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 __init__(self): self.med = Mediaset() self.med.log = kodiutils.log self.iperpage = kodiutils.getSetting('itemsperpage') self.detect_media_type = kodiutils.getSettingAsBool('detectmediatype') self.lookup_fullplot = kodiutils.getSettingAsBool('lookupfullplot') self.isAnonimous = self.checkCredentials() self.ua = ( 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 ' '(KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36')
def guida_tv_canale_giorno(self, cid, dt): res = self.med.OttieniGuidaTV( cid, dt, dt + 86399999) # 86399999 is one day minus 1 ms kodiutils.setContent('videos') if 'listings' in res: for el in res['listings']: program = el['program'] if 'program' in el else {} if (kodiutils.getSettingAsBool('fullguide') or ('mediasetprogram$hasVod' in program and program['mediasetprogram$hasVod'])): infos = _gather_info(el) arts = _gather_art(el) s_time = staticutils.get_date_from_timestamp( el['startTime']).strftime("%H:%M") e_time = staticutils.get_date_from_timestamp( el['endTime']).strftime("%H:%M") s = "{s}-{e} - {t}".format( s=s_time, e=e_time, t=el['mediasetlisting$epgTitle'].encode('utf8')) kodiutils.addListItem(s, { 'mode': 'video', 'guid': program['guid'] }, videoInfo=infos, arts=arts, properties={ 'ResumeTime': '0.0', 'TotalTime': '0.0', 'StartOffset': '0.0' }, isFolder=False) kodiutils.endScript()
def elenco_video_list(self, subBrandId, start): if (kodiutils.getSettingAsBool('sortmediaset')): sort = 'mediasetprogram$publishInfo_lastPublished|desc' else: sort = 'mediasetprogram$publishInfo_lastPublished' els = self.med.OttieniVideoSezione(subBrandId, sort=sort, erange=self.__imposta_range(start)) self.__analizza_elenco(els, True) if len(els) == self.iperpage: kodiutils.addListItem( kodiutils.LANGUAGE(32130), { 'mode': 'programma', 'sub_brand_id': subBrandId, 'start': start + self.iperpage }) kodiutils.endScript()
def canali_live_root(self): kodiutils.setContent('videos') now = staticutils.get_timestamp() els = self.med.OttieniProgrammiLive() # (sort='title') chans = {} for chan in els: if 'listings' in chan and chan['listings']: for prog in chan['listings']: if prog['startTime'] <= now <= prog['endTime']: guid = chan['guid'] chans[guid] = {'title': '{} - {}'.format(chan['title'], kodiutils.py2_encode( prog["mediasetlisting$epgTitle"])), 'infos': _gather_info(prog), 'arts': _gather_art(prog), 'restartAllowed': prog['mediasetlisting$restartAllowed']} els = self.med.OttieniCanaliLive(sort='ShortTitle') for prog in els: if (prog['callSign'] in chans and 'tuningInstruction' in prog and prog['tuningInstruction'] and not prog['mediasetstation$eventBased']): chn = chans[prog['callSign']] if chn['arts'] == {}: chn['arts'] = _gather_art(prog) if chn['restartAllowed']: if kodiutils.getSettingAsBool('splitlive'): kodiutils.addListItem(chn['title'], {'mode': 'live', 'guid': prog['callSign']}, videoInfo=chn['infos'], arts=chn['arts']) continue vid = self.__ottieni_vid_restart(prog['callSign']) if vid: kodiutils.addListItem(chn['title'], {'mode': 'video', 'pid': vid}, videoInfo=chn['infos'], arts=chn['arts'], isFolder=False) continue data = {'mode': 'live'} vdata = prog['tuningInstruction']['urn:theplatform:tv:location:any'] for v in vdata: if v['format'] == 'application/x-mpegURL': data['id'] = v['releasePids'][0] else: data['mid'] = v['releasePids'][0] kodiutils.addListItem(chn['title'], data, videoInfo=chn['infos'], arts=chn['arts'], isFolder=False) kodiutils.endScript()
def guida_tv_canale_giorno(self, cid, dt): res = self.med.OttieniGuidaTV(cid, dt, dt + 86399999) # 86399999 is one day minus 1 ms if 'listings' in res: for el in res['listings']: if (kodiutils.getSettingAsBool('fullguide') or ('mediasetprogram$hasVod' in el['program'] and el['program']['mediasetprogram$hasVod'])): infos = _gather_info(el) arts = _gather_art(el) s_time = staticutils.get_date_from_timestamp( el['startTime']).strftime("%H:%M") e_time = staticutils.get_date_from_timestamp( el['endTime']).strftime("%H:%M") s = "{s}-{e} - {t}".format(s=s_time, e=e_time, t=el['mediasetlisting$epgTitle']) kodiutils.addListItem(s, {'mode': 'video', 'guid': el['program']['guid']}, videoInfo=infos, arts=arts, isFolder=False) kodiutils.endScript()
def addVideosItems(id='', type=1, page=1): kodiutils.setContent('videos') res = [] loadAll = kodiutils.getSettingAsBool('loadAll') elPerPage = kodiutils.getSetting('elPerPage') if type==1: res = getProgramVideos(id, page, elPerPage, loadAll) elif type==2: res = getDateVideos(id) elif type==3: res = getCategoryVideos(id, elPerPage) elif type==4: res = getPicksVideos(elPerPage) if res: for ep in res: ep['mediatype']='video' kodiutils.addListItem(ep['title'], params={"id": ep['id'], "mode": "video" }, thumb=ep['image'], videoInfo=ep, isFolder=False) if type == 1 and (not loadAll) and len(getProgramVideos(id, int(page)+1, elPerPage))>0: kodiutils.addListItem(kodiutils.LANGUAGE(32011), params={"id": id, "mode": "program", "page": int(page) + 1}) kodiutils.endScript()
def __init__(self): self.__UID = '' self.__UIDSignature = '' self.__signatureTimestamp = '' self.apigw = '' self.cts = '' self.__tracecid = '' self.__cwid = '' self.__deviceid = str(uuid.uuid4()) self.expires_at = 0.0 self.uxReferenceMapping = { 'CWDOCUBIOSTORIE': 'documentariBioStoria', 'CWDOCUINCHIESTE': 'documentariInchiesta', 'CWDOCUMOSTRECENT': 'mostRecentDocumentariFep', 'CWDOCUNATURANIMALI': 'documentariNatura', 'CWDOCUSCIENZATECH': 'documentariScienza', 'CWDOCUSPAZIO': 'documentariSpazio', 'CWDOCUTOPVIEWED': 'stagioniDocumentari', 'CWENABLERKIDS': 'stagioniKids', 'CWFICTIONADVENTURE': 'stagioniFictionAvventura', 'CWFICTIONBIOGRAPHICAL': 'stagioniFictionBiografico', 'CWFICTIONCOMEDY': 'stagioniFictionCommedia', 'CWFICTIONDRAMATIC': 'stagioniFictionDrammatico', 'CWFICTIONPOLICE': 'stagioniFictionPoliziesco', 'CWFICTIONSENTIMENTAL': 'stagioniFictionSentimentale', 'CWFICTIONSITCOM': 'stagioniFictionSitCom', 'CWFICTIONSOAP': 'mostRecentSoapOpera', 'CWFILMACTION': 'filmAzioneThrillerAvventura', 'CWFILMCLASSIC': 'filmClassici', 'CWFILMCOMEDY': 'filmCommedia', 'CWFILMDOCU': 'filmDocumentario', 'CWFILMDRAMATIC': 'filmDrammatico', 'CWFILMSENTIMENTAL': 'filmSentimentale', 'CWFILMTOPVIEWED': 'filmPiuVisti24H', 'CWHOMEBRANDS': 'personToContentHomepage', 'CWHOMEFICTIONNOWELITE': 'stagioniFictionSerieTvSezione', 'CWHOMEFICTIONNOWPOP': 'stagioniFictionSerieTvHomepage', 'CWHOMEPROGTVNOW': 'stagioniProgrammiTv', 'CWKIDSBOINGFORYOU': 'kidsBoing', 'CWKIDSCARTOONITO': 'kidsCartoonito', 'CWKIDSMEDIASETBRAND': 'kidsMediaset', 'CWPROGTVDAY': 'stagioniDaytime', 'CWPROGTVMAGAZINE': 'stagioniCucinaLifestyle', 'CWPROGTVPRIME': 'stagioniPrimaSerata', 'CWPROGTVSPORT': 'mostRecentSport', 'CWPROGTVTALENT': 'stagioniReality', 'CWPROGTVTALK': 'stagioniTalk', 'CWPROGTVTG': 'mostRecentTg', 'CWPROGTVTOPVIEWED': 'programmiTvClip24H', 'CWPROGTVVARIETY': 'stagioniVarieta', 'CWSEARCHBRAND': 'searchStagioni', 'CWSEARCHCLIP': 'searchClip', 'CWSEARCHEPISODE': 'searchEpisodi', 'CWSEARCHMOVIE': 'searchMovie', 'CWSIMILARDOCUMENTARI': 'similarDocumentari', 'CWSIMILARFICTION': 'similarSerieTvFiction', 'CWSIMILARFILM': 'similarCinema', 'CWSIMILARINFORMAZIONE': 'similarInformazione', 'CWSIMILARINTRATTENIMENTO': 'similarIntrattenimento', 'CWSIMILARKIDS': 'similarCartoni', 'CWSIMILARSERIETV': 'similarSerieTvFiction', 'CWSIMILARSPORT': 'similarSport', 'CWSIMILARTG': 'similarTg', 'CWTOPSEARCHBRAND': 'defaultSearchStagioni', 'CWTOPSEARCHCLIP': 'defaultSearchVideo', 'CWTOPVIEWEDDAY': 'piuVisti24H', 'documentariBioStoria': 'documentariBioStoria', 'documentariInchiesta': 'documentariInchiesta', 'documentariNatura': 'documentariNatura', 'documentariScienza': 'documentariScienza', 'documentariSpazio': 'documentariSpazio', 'filmAzioneThrillerAvventura': 'filmAzioneThrillerAvventura', 'filmClassici': 'filmClassici', 'filmCommedia': 'filmCommedia', 'filmDocumentario': 'filmDocumentario', 'filmDrammatico': 'filmDrammatico', 'filmPiuVisti24H': 'filmPiuVisti24H', 'filmSentimentale': 'filmSentimentale', 'kidsBoing': 'kidsBoing', 'kidsCartoonito': 'kidsCartoonito', 'kidsMediaset': 'kidsMediaset', 'mostRecentDocumentariFep': 'mostRecentDocumentariFep', 'mostRecentSoapOpera': 'mostRecentSoapOpera', 'mostRecentSport': 'mostRecentSport', 'mostRecentTg': 'mostRecentTg', 'personToContentFilm': 'personToContentFilm', 'personToContentHomepage': 'personToContentHomepage', 'piuVisti24H': 'piuVisti24H', 'programmiTvClip24H': 'programmiTvClip24H', 'similarCartoni': 'similarCartoni', 'similarCinema': 'similarCinema', 'similarDocumentari': 'similarDocumentari', 'similarInformazione': 'similarInformazione', 'similarIntrattenimento': 'similarIntrattenimento', 'similarSerieTvFiction': 'similarSerieTvFiction', 'similarSport': 'similarSport', 'similarTg': 'similarTg', 'stagioniCucinaLifestyle': 'stagioniCucinaLifestyle', 'stagioniDaytime': 'stagioniDaytime', 'stagioniDocumentari': 'stagioniDocumentari', 'stagioniFictionAvventura': 'stagioniFictionAvventura', 'stagioniFictionBiografico': 'stagioniFictionBiografico', 'stagioniFictionCommedia': 'stagioniFictionCommedia', 'stagioniFictionDrammatico': 'stagioniFictionDrammatico', 'stagioniFictionPoliziesco': 'stagioniFictionPoliziesco', 'stagioniFictionSentimentale': 'stagioniFictionSentimentale', 'stagioniFictionSerieTvHomepage': 'stagioniFictionSerieTvHomepage', 'stagioniFictionSerieTvSezione': 'stagioniFictionSerieTvSezione', 'stagioniFictionSitCom': 'stagioniFictionSitCom', 'stagioniKids': 'stagioniKids', 'stagioniPrimaSerata': 'stagioniPrimaSerata', 'stagioniProgrammiTv': 'stagioniProgrammiTv', 'stagioniReality': 'stagioniReality', 'stagioniTalk': 'stagioniTalk', 'stagioniVarieta': 'stagioniVarieta' } rutils.RUtils.__init__( self, enable_cache=kodiutils.getSettingAsBool('cache'), enable_mem_cache=kodiutils.getSettingAsBool('cachememory')) self.anonymousLogin()