def INDEX_PROG_CH(): cookiepath = weblogin.doLogin(username, password) source = weblogin.openUrl(programme_url, cookiepath) match = Compile( '<a href=programme\?cid=(.+?)#..class=tab >(.+?)<\/a>').findall(source) for cid, name in match: addDir(name, cid, 41, prog_icon)
def LIST_CHANNELS(): account_active = check_validity() source = weblogin.openUrl(BASE, account_active[1]) if account_active[0]: match_pattern = '<a href="watch\?cid=(.+?)".*.\n.*.\n.*.<img src="(.+?)".*.\n.*.\n.*.\n.*.\n.*.\n.*.\n*\n.*.\n.*.\n.*.\n.*.<div class="thumb-text">(.+?)<\/div>' else: xbmcgui.Dialog().notification( '[ You don\'t have a valide subscription ]', 'Only free TVs are available', xbmcgui.NOTIFICATION_WARNING, 10000, sound=True) xbmc.log( "You don't have a valid account, so you are going to watch the free TVs only." ) match_pattern = '<a href="watch\?cid=(.+?)".*.\n.*.\n.*.<img src="(.+?)".*.\n.*.\n.*.\n.*.\n.*.\n.*.\n.*.<div class="thumb-text">(.+?)<\/div>' match = Compile(match_pattern).findall(source) for cid, ch_image, ch_current in match: ''' Here I hide babytv ''' if cid == '47' and hide_babytv == 'true': continue ''' ''' ch_image = (BASE + ch_image) addDir(ch_current, cid, 21, ch_image)
def LIST_VID(): channel_source = weblogin.doLogin('', username, password, url_login) channel_source = weblogin.openUrl(url_videos) match = re.compile( '<li>\s*.*<a href="(.+?)"\s*class="side-nav__item.*"\s.*.\s*>(.+?)<\/a>' ).findall(channel_source) for url_chann, name in match: addDir(name, url_chann, 2, '')
def LIST_REC(): cookiepath = weblogin.doLogin(username, password) source = weblogin.openUrl(recording_url, cookiepath) match = Compile('<a href=recording(.+?)#..class=tab.>(.+?)<\/a>').findall( source) for cid, name in match: rec_url = (recording_url + cid) addDir(name, rec_url, 31, vid_icon)
def INDEX_CHANNELS(cid): url = (BASE + "teko/getchaclap_mbr.php?cid=" + cid) cookiepath = weblogin.doLogin(username, password) source = weblogin.openUrl(url, cookiepath) src_list = list(source.split(",")) if quality == 'moderate': for i in range(len(src_list)): play_list = correct_stream_url(src_list[i]) addLink('PLAY: ' + play_list[0], play_list[1], vid_icon) else: ''' Presuming that the first stream has the lowest quality and the last - the highest 0 : getting the first stream link -1 : getting the last stream link ''' if quality == 'low' or len(src_list) == 1: element = 0 if quality == 'high' and len(src_list) > 1: element = -1 xbmc.log('2-quality: ' + quality + ' and nuber of streams: ' + str(len(src_list))) play_list = correct_stream_url(src_list[element]) #xbmc.log(play_list) ''' loading json clap conf ''' source_clap = weblogin.openUrl(BASE + 'teko/onairclap.php', cookiepath) clap_json_config = json.loads(source_clap) for i in range(len(clap_json_config)): if clap_json_config[i]['cid'] == cid: text1 = clap_json_config[i]['chName'] text2 = clap_json_config[i]['name'] icon = clap_json_config[i]['logo'] ''' playing the stream ''' liz = xbmcgui.ListItem(play_list[0]) liz.setInfo(type="Video", infoLabels={"Title": play_list[0]}) liz.setProperty('IsPlayable', 'true') xbmc.Player().play(item=play_list[1], listitem=liz, windowed=False, startpos=-1) xbmcgui.Dialog().notification(text1, text2, icon, 10000, sound=False) return xbmcplugin.endOfDirectory(int(sys.argv[1]), succeeded=False)
def INDEX_VID_CAT(name, url): channel_source = weblogin.openUrl(url) match = re.compile( '<a href="(.+?)"\n.*\n.*\n.*<span class="playlist-item__title">(.+?)<\/span>' ).findall(channel_source) for url, name in match: if (videoquality == "true"): url = url + "?quality=25&type=html" addDir(name, url, 4, '')
def LIST_CHANNELS(): channel_source = weblogin.doLogin('', username, password, url_login) channel_source = weblogin.openUrl(url_live) match = re.compile( '<a href="(.+?)".*\n.*\n.*\n.*>(.+?)<\/span>.*\n.*<img src="(.+?)"' ).findall(channel_source) for url_chann, name, thumbnail in match: if (videoquality == "true"): url_chann = url_chann + "?quality=25&type=html" addDir(name, url_chann, 1, thumbnail)
def INDEX_VID(name, url): channel_source = weblogin.doLogin('', username, password, url_login) channel_source = weblogin.openUrl(url) match = re.compile(',{"id":(.+?),"tag":"(.+?)","name":"(.+?)"').findall( channel_source) for id, url, name in match: url = url_videos + "/" + url try: name = name.decode('unicode-escape').encode('utf-8') except: pass addDir(name, url, 3, '')
def LIST_REC_CHAN(url): cookiepath = weblogin.doLogin(username, password) source = weblogin.openUrl(url, cookiepath) match = Compile( '(<div class="day">(.+?)<\/div>)*(<a href=(.+?)><li><span class="time">(.+?)<\/span><span class="title">(.+?)<\/span>)' ).findall(source) for temp1, day, temp2, rec_url, time, name in match: del temp1, temp2 if day is not '': addLink('=[' + day + ']=', '', '') time_convd = time_convert(time) desc_txt = ('[' + time_convd + '] ' + name) addDir(desc_txt, rec_url.strip('"'), 32, vid_icon)
def LIST_PROG_CH(cid): url = programme_url + '?cid=' + cid cookiepath = weblogin.doLogin(username, password) source = weblogin.openUrl(url, cookiepath) match = Compile( '(<div class="day">(.+?)<\/div>)*(<li style="list-style: none;"><span class="time">(.+?)<\/span><span class="title">(.+?)<\/span>)' ).findall(source) for temp1, day, temp2, time, name in match: del temp1, temp2 if day is not '': addDir('=[' + day + ']=', cid, 42, prog_icon) time_convd = time_convert(time) desc_txt = ('[' + time_convd + '] ' + name) addDir(desc_txt, cid, 42, prog_icon)
def PLAY_REC_CHAN(cid, name): url = (BASE + cid) account_active = check_validity() if not account_active[0]: xbmcgui.Dialog().notification('[ You don\'t have valid subscription ]', 'Not Available without subscription!', xbmcgui.NOTIFICATION_WARNING, 10000, sound=True) raise SystemExit source_rec = weblogin.openUrl(url, account_active[1]) match_rec = Compile('source:."(.+?)"').findall(source_rec) for rec_url in match_rec: addLink('PLAY: ' + name, rec_url, vid_icon)
def check_validity(account_active=False): cookiepath = weblogin.doLogin(username, password) subscribe_source = weblogin.openUrl(subscribe_url, cookiepath) match = Compile('<p><span.*>(.+?)<\/span><\/p>').findall(subscribe_source) for subs_text in match: account_active = True dates_match = Compile('.* (.+?)-(.+?)-(.+?)\.').findall(subs_text) for s_day, s_month, s_year in dates_match: date_expire = datetime.datetime(int(s_year), int(s_month), int(s_day)) date_today = datetime.datetime.now() days_delta = date_expire - date_today xbmc.log("Account is active! You have " + str(days_delta.days) + " days until it expires") if days_delta.days <= 5: xbmcgui.Dialog().notification( '[ Your subscribtion will expire soon ]', 'Only ' + str(days_delta.days) + ' days left!', xbmcgui.NOTIFICATION_INFO, 10000, sound=False) return (account_active, cookiepath)
def INDEX_CHANNELS(name, url): channel_source = weblogin.doLogin('', username, password, url_login) channel_source = weblogin.openUrl(url) match = re.compile('"link":"(.+?)"').findall(channel_source) stream = match[0].replace("\/", "/") addLink('PLAY: ' + name, stream, '')
def INDEX_VID_STREAM(name, url): channel_source = weblogin.openUrl(url) match = re.compile('"link":"(.+?)"').findall(channel_source) stream = match[0].replace("\/", "/") addLink('PLAY: ' + name, stream, '')