def CATEGORIES(): CheckChannels() addDir('[COLOR red].Full Match Replays HD[/COLOR]','url',3,'','','','') link = server() link = link.split('window.channels =')[1] match = re.findall('"title": "(.+?)".+?"file": "(.+?)",',link,re.M|re.DOTALL) for _name,url in match: iconimage=image+_name.replace(' ','').replace('-Free','').replace('HD','').replace('i/H','i-H').replace('-[US]','').replace('-[EU]','').replace('[COLOR yellow]','').replace('[/COLOR]','').replace(' (G)','').lower()+'.png' if ADDON.getSetting('tvguide')=='true': try: name=_name+'[COLOR yellow]%s[/COLOR]'% tvguide.tvguide(_name) except: name=_name else: if tvguide.return_url(_name): name=_name+'[COLOR yellow] (G)[/COLOR]' else: name=_name if ADDON.getSetting('hd')=='true': if 'HD' in name: addDir(name,url,2,iconimage,'False','',_name) else: addDir(name,url,2,iconimage,'False','',_name) xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_VIDEO_TITLE)
def schedule(name,url,iconimage): if 'color' in name: For_Name=name.split('[color')[0] else: For_Name=name if 'jsc' in For_Name: url = 'http://www.en.aljazeerasport.tv/fragment/aljazeera/fragments/components/ajax/channelList/channel/plus%s/maxRecords/0'%(For_Name.split(' ')[1]) link = OPEN_URL(url).replace('\n','').replace(' ','') link = link.split('<h')[1] _date = re.compile('>(.+?) (.+?) (.+?)<span class="arrow">',re.DOTALL).findall(link) day = _date[0][0] _month = month(_date[0][1]) year = _date[0][2] if '+' in forOffset: Z= forOffset.split('+')[1] elif '-' in forOffset: Z= forOffset.split('-')[1] else : Z= '0' print Z pattern='<td class="eventsCell hardAlign">(.+?)</td.+?<td class="category">(.+?)</td>.+?<td class="startTime">(.+?):(.+?)</td>' match = re.compile(pattern,re.DOTALL).findall(link) for game,league,hour,minute in match: if '+' in forOffset: t = datetime.datetime(int(year), int(_month) , int(day), int(hour), int(minute), 00) t += datetime.timedelta(hours = int(Z)) if '-' in forOffset: t = datetime.datetime(int(year), int(_month) , int(day), int(hour), int(minute), 00) t -= datetime.timedelta(hours = int(Z)) else: t = datetime.datetime(int(year), int(_month) , int(day), int(hour), int(minute), 00) game_league=game+' ('+league+')' _name_='[COLOR white][%s]-[/COLOR][COLOR yellow][B]%s[/B][/COLOR]'%(t.strftime('%H:%M'),game_league) addDir(_name_,'url',2,iconimage.replace(' ','+'),'True','','JSC +'+For_Name.split(' ')[1]) else: try: url=tvguide.return_url(name.title()) link=OPEN_URL(url) _date = re.compile('<!-- produced for the bleb.org TV system at .+? (.+?) (.+?) .+? (.+?) -->', re.M|re.DOTALL).findall(link) day = _date[0][1] _month = month(_date[0][0]) year = _date[0][2] match=re.findall('<title>(.+?)</title>.+?<start>(.+?)</start>',link,re.M|re.DOTALL) for _name,start in match: hour=start[0:2] minute=start[2:4] if '+' in forOffset_gmt: Z = forOffset_gmt.split('+')[1] t = datetime.datetime(int(year), int(_month) , int(day), int(hour), int(minute), 00)+ datetime.timedelta(hours = int(Z)) time = t.strftime('%H:%M') elif '-' in forOffset_gmt: Z= forOffset_gmt.split('-')[1] t = datetime.datetime(int(year), int(_month) , int(day), int(hour), int(minute), 00)- datetime.timedelta(hours = int(Z)) time = t.strftime('%H:%M') else: time = '%s:%s'%(hour,minute) name_='[COLOR white][%s][/COLOR]-[COLOR yellow][B]%s[/B][/COLOR]'%(time,_name) addDir(name_,url,2,iconimage,'True','',For_Name.title()) except: dialog = xbmcgui.Dialog() dialog.ok("StreamTVBox", '',"Sorry No Schedule Found", "") xbmc.executebuiltin('XBMC.Container.Update(%s?mode=None&url=None,replace)'%sys.argv[0])