def Huddle_Sites(url, image, fanart): try: if ( not ("MMA") in url and not ("Soccer") in url and not ("WWE") in url and not ("match") in url and not ("fight") in url and not ("wwe") in url ): murl = url.split("|") home = murl[1].split("vs")[0] away = murl[1].split("vs")[1] url = murl[0] html = client.request(url) block_content = client.parseDOM(html, "a", attrs={"class": "comments may-blank"}, ret="href") orig_title = "[COLOR=FF00FF00][B]" + away + " at " + home + "[/B][/COLOR]" home_f = home.lower().split()[0] away_f = away.lower().split()[0] home_l = home.lower().split()[-1] away_l = away.lower().split()[-1] home_sm = home.lower().split()[-1][:3] away_sm = away.lower().split()[-1][:3] link = None for element in block_content: if ( (home_sm in element and (away_sm in element or away_f in element)) or (home_f in element and (away_l in element or away_f in element)) or (home_l in element and (away_l in element or away_f in element)) or (home_f in element and home_l in element) or (away_f in element and away_l in element) ): link = element break else: continue else: pass if url == "MMA" or url == "Soccer" or url == "WWE": fanart = back[url] low = url.lower() if url == "Soccer": low = "thread" if url == "WWE": low = "thread" link = "https://www.reddit.com/r/" + url + "Streams/" T = 0 try: html = client.request(link) result = client.parseDOM(html, "p", attrs={"class": "title"}) channel = client.parseDOM(result, "a", ret="href") for item in channel: if ( ("match") in item or ("game") in item or ("fight") in item or ("mma") in item or ("event") in item or ("wwe") in item ): url = "https://www.reddit.com/" + item url = url.replace("com//", "com/") try: title = item.split(low)[1].replace("_", " ").upper()[:-1] except: title = item if not ("comment") in title and not ("http") in title: T = T + 1 addDirectoryItem( "[COLOR=FFFF0000]" + title + "[/COLOR]", "Huddle_Sites", image, image, fanart, url ) else: pass except: pass if T == 0: addDirectoryItem( "[COLOR=FFFF0000]No live event right now...Try Later![/COLOR]", "Play_Main", image, image, fanart, "", ) endDirectory() else: pass if ( ("soccer") in url or ("fight") in url or ("wwe") in url or ("match") in url or ("event") in url or ("mma") in url ): link = url if link: T = 0 html = client.request(link) content = client.parseDOM(html, "a", ret="href") cont = client.parseDOM(html, "p") ct = client.parseDOM(html, "code") check = "http://www.rawstreams.com" urls = [] for el in content: if "blabseal.com" in el: url = el if url and url not in urls: addDirectoryItem("Blabseal.com", "HHBlabseal", image, image, fanart, url) urls.append(url) elif "1apps.com" in el: url = el if url and url not in urls: addDirectoryItem("Oneapp", "HHOneapp", image, image, fanart, url) urls.append(url) elif "youtu" in el and "channel" not in el and "list" not in el: url = el if url and url not in urls: addDirectoryItem("Youtube.com", "HHGetYoutube", image, image, fanart, url) urls.append(url) elif "giostreams" in el: url = el if url and url not in urls: addDirectoryItem("Giostreams.eu", "HHGiostreams", image, image, fanart, url) urls.append(url) elif "freecast.in" in el: url = el if url and url not in urls: addDirectoryItem("Freecast.in", "HHFreecastin", image, image, fanart, url) urls.append(url) elif "streamboat.tv" in el: url = el if url and url not in urls: addDirectoryItem("Streamboat.tv", "HHStreambot", image, image, fanart, url) urls.append(url) elif "nbastream.net" in el: url = el if url and url not in urls: addDirectoryItem("Nbastream.net", "HHNbanhlstreams", image, image, fanart, url) urls.append(url) elif "nhlstream.net" in el: url = el if url and url not in urls: addDirectoryItem("Nhlstream.net", "HHNbanhlstreams", image, image, fanart, url) urls.append(url) elif "livenflstream.net" in el: url = el if url and url not in urls: addDirectoryItem("Livenflstream.net", "HHNbanhlstreams", image, image, fanart, url) urls.append(url) elif "streamendous" in el: url = el if url and url not in urls: addDirectoryItem("Streamendous", "HHtester", image, image, fanart, url) urls.append(url) elif "fs.anvato.net" in el: url = el if url and url not in urls: addDirectoryItem("Fox ToGo (US IP Only)", "HHGetanvato", image, image, fanart, url) urls.append(url) elif "streamsarena.eu" in el: url = el if url and url not in urls: addDirectoryItem("Streamsarena.eu", "HHStreamarena", image, image, fanart, url) urls.append(url) elif "streamup.com" in el and "m3u8" not in el: url = el if url and url not in urls: addDirectoryItem("Streamup.com", "HHGetStreamup", image, image, fanart, url) urls.append(url) elif "torula" in el: url = el if url and url not in urls: addDirectoryItem("Torula.us", "HHTorula", image, image, fanart, url) urls.append(url) elif "gstreams.tv" in el: url = el if url and url not in urls: addDirectoryItem("Gstreams.tv", "HHGstreams", image, image, fanart, url) urls.append(url) elif ( "nfl-watch.com/live/watch" in el or "nfl-watch.com/live/-watch" in el or "nfl-watch.com/live/nfl-network" in el ): url = el if url and url not in urls: addDirectoryItem("Nfl-watch.com", "HHNflwatch", image, image, fanart, url) urls.append(url) elif "ducking.xyz" in el: url = el if url and url not in urls: addDirectoryItem("Ducking.xyz", "HHDucking", image, image, fanart, url) urls.append(url) elif "streamandme" in el: url = el if url and url not in urls: addDirectoryItem("Streamandme", "HHStreamandme", image, image, fanart, url) urls.append(url) elif "mursol.moonfruit.com" in el: url = el if url and url not in urls: addDirectoryItem("Moonfruit", "HHMoonfruit", image, image, fanart, url) urls.append(url) elif "m3u8" in el and "room" not in el and "anvato" not in el and "turner.com" not in el: url = el if url and url not in urls: addDirectoryItem("M3U8 stream", "Play_Main", image, image, fanart, url) urls.append(url) for el in ct: if "turner.com" in el and el not in urls: try: timest = el.split("exp=")[-1].split("~acl")[0] time_exp = datetime.fromtimestamp(int(timest)).strftime( control.region("time").replace("%H%H", "%H").replace(":%S", "") ) except: time_exp = "" addDirectLink("Turner HD (external player) link expires " + time_exp, {"Title": orig_title}, el) urls.append(el) else: addDirectoryItem("[COLOR=FFFF0000]Could not find playable link[/COLOR]", "Play_Main", image, image, fanart) endDirectory() except: pass
def Huddle_Main(url, image, fanart): mode = url image = logos[mode] fanart = back[mode] try: murl = "https://www.reddit.com/r/" + mode + "streams" today = datetime.utcnow() - timedelta(hours=8) today_from = str(today.strftime("%Y-%m-%d")) + "T00:00:00.000-05:00" today_to = str(today.strftime("%Y-%m-%d")) + "T23:59:00.000-05:00" result = client.request( "http://www.sbnation.com/sbn_scoreboard/ajax_leagues_and_events?ranges[" + mode + "][from]=" + today_from + "&ranges[" + mode + "][until]=" + today_to ) js = json.loads(result) js = js["leagues"][mode] if js: if mode == "nfl": url = murl + "|" + "redzone" + "vs" + "redzone" addDirectoryItem( "[COLOR=FF00FF00][B]NFL Redzone[/B][/COLOR]", "Huddle_Sites", image, image, fanart, url ) for game in js: home = game["away_team"]["name"] away = game["home_team"]["name"] hs = str(game["score"]["home"][game["score"]["cols"].index("Total")]) if not hs: hs = "0" avs = str(game["score"]["away"][game["score"]["cols"].index("Total")]) if not avs: avs = "0" score = " - " + avs + ":" + hs start_time = game["start_time"] try: plus = False st = start_time.replace("T", " ") if "+" in st: plus = True str_new = st.split("+")[-1] st = st.replace("+" + str_new, "") else: str_new = st.split("-")[-1] st = st.replace("-" + str_new, "") str_new = str_new.split(":")[0] if plus: st_time_utc = datetime(*(time.strptime(st, "%Y-%m-%d %H:%M:%S")[0:6])) - timedelta( hours=int(str_new) ) else: st_time_utc = datetime(*(time.strptime(st, "%Y-%m-%d %H:%M:%S")[0:6])) + timedelta( hours=int(str_new) ) local_game_time = utc_to_local(st_time_utc) local_time_str = " - " + local_game_time.strftime( control.region("dateshort") + " " + control.region("time").replace("%H%H", "%H").replace(":%S", "") ) except: local_time_str = "" status = GameStatus(game["status"]) status = " - " + status title = "[COLOR=FF00FF00][B]" + game["title"].replace(game["title"].split()[-1], "") + "[/B][/COLOR]" if display_start_time == "true": title = title + "[COLOR=FFFFFF00]" + local_time_str + "[/COLOR]" if display_status == "true": title = title + "[COLOR=FFFF0000]" + status + "[/COLOR]" if control.setting("display_score") == "true": title = title + "[COLOR=FF00FFFF]" + score + "[/COLOR]" url = murl + "|" + home + "vs" + away addDirectoryItem(title, "Huddle_Sites", image, image, fanart, url) else: addDirectoryItem( "[COLOR=FFFF0000]No playable links...Try Later![/COLOR]", "Play_Main", image, image, fanart ) pass endDirectory() except: pass
def Huddle_Main(url, image, fanart): mode = url image = logos[mode] fanart = back[mode] try: murl = 'https://www.reddit.com/r/'+mode+'streams' today = datetime.utcnow() - timedelta(hours=8) today_from = str(today.strftime('%Y-%m-%d'))+'T00:00:00.000-05:00' today_to = str(today.strftime('%Y-%m-%d'))+'T23:59:00.000-05:00' result = client.request('http://www.sbnation.com/sbn_scoreboard/ajax_leagues_and_events?ranges['+mode+'][from]='+today_from+'&ranges['+mode+'][until]='+today_to) js = json.loads(result) js = js['leagues'][mode] if js: if mode == 'nfl': url = murl+ '|' + 'redzone' +'vs'+ 'redzone' addDirectoryItem('[COLOR=FF00FF00][B]NFL Redzone[/B][/COLOR]', 'Huddle_Sites', image, image, fanart, url) for game in js: home = game['away_team']['name'] away = game['home_team']['name'] hs = str(game['score']['home'][game['score']['cols'].index('Total')]) if not hs: hs = '0' avs = str(game['score']['away'][game['score']['cols'].index('Total')]) if not avs: avs = '0' score = ' - '+avs+':'+hs start_time = game['start_time'] try: plus = False st = start_time.replace('T', ' ') if '+' in st: plus = True str_new = st.split('+')[-1] st = st.replace('+'+str_new,'') else: str_new = st.split('-')[-1] st = st.replace('-'+str_new,'') str_new = str_new.split(':')[0] if plus: st_time_utc = datetime(*(time.strptime(st, '%Y-%m-%d %H:%M:%S')[0:6]))-timedelta(hours=int(str_new)) else: st_time_utc = datetime(*(time.strptime(st, '%Y-%m-%d %H:%M:%S')[0:6]))+timedelta(hours=int(str_new)) local_game_time = utc_to_local(st_time_utc) local_time_str = ' - '+local_game_time.strftime(control.region('dateshort')+' '+control.region('time').replace('%H%H','%H').replace(':%S','')) except: local_time_str = '' status = GameStatus(game['status']) status = ' - '+status title = '[COLOR=FF00FF00][B]'+game['title'].replace(game['title'].split()[-1],'')+'[/B][/COLOR]' if display_start_time=='true': title = title+'[COLOR=FFFFFF00]'+local_time_str+'[/COLOR]' if display_status=='true': title = title+'[COLOR=FFFF0000]'+status+'[/COLOR]' if control.setting('display_score')=='true': title = title+'[COLOR=FF00FFFF]'+score+'[/COLOR]' url = murl+ '|'+home +'vs'+away addDirectoryItem(title, 'Huddle_Sites', image, image, fanart, url) else: addDirectoryItem("[COLOR=FFFF0000]No playable links...Try Later![/COLOR]", 'Play_Main', image, image, fanart) pass endDirectory() except: pass
def Huddle_Sites(url, image, fanart): try: if url != "MMA": murl = url.split('|') home = murl[1].split('vs')[0] away = murl[1].split('vs')[1] url = murl[0] html = client.request(url) block_content = client.parseDOM(html, "a", attrs={"class": "comments may-blank"}, ret="href") orig_title = '[COLOR=FF00FF00][B]'+away+' at '+home+'[/B][/COLOR]' home_f = home.lower().split()[0] away_f = away.lower().split()[0] home_l = home.lower().split()[-1] away_l = away.lower().split()[-1] link = None for element in block_content: if (home_f in element and (away_l in element or away_f in element)) or (home_l in element and (away_l in element or away_f in element)) or (home_f in element and home_l in element) or (away_f in element and away_l in element): link = element break else: continue if url =="MMA": fanart = back['MMA'] link = 'https://www.reddit.com/r/MMAStreams/' html = client.request(link) result = client.parseDOM(html, 'p', attrs={'class': 'title'}) channel = client.parseDOM(result, 'a', ret='href') for item in channel: if ('fight') in item: link = 'https://www.reddit.com/'+item break else: continue if not ('fight') in link:addDirectoryItem("[COLOR=FFFF0000]No live event right now...Try Later![/COLOR]", 'Play_Main', image, image, fanart) if link: html = client.request(link) content = client.parseDOM(html, "a", ret="href") cont = client.parseDOM(html, "p") ct = client.parseDOM(html, "code") urls = [] for el in content: if 'blabseal.com' in el: url = Blabseal(el) if url and url not in urls: addDirectoryItem('Blabseal.com', 'Play_Main',image, image,fanart, url) urls.append(url) elif '1apps.com' in el: url = Oneapp(el) if url and url not in urls: addDirectoryItem('Oneapp', 'Play_Main',image, image,fanart, url) urls.append(url) elif 'youtu' in el and 'channel' not in el and 'list' not in el: url = GetYoutube(el) if url and url not in urls: addDirectoryItem('Youtube.com', 'Play_Main',image, image,fanart, url) urls.append(url) elif 'freecast.in' in el: url = Freecastin(el) if url and url not in urls: addDirectoryItem('Freecast.in', 'Play_Main',image, image,fanart, url) urls.append(url) elif 'streamboat.tv' in el: url = Streambot(el) if url and url not in urls: addDirectoryItem('Streamboat.tv', 'Play_Main',image, image,fanart, url) urls.append(url) elif 'nbastream.net' in el: url = Nbanhlstreams(el) if url and url not in urls: addDirectoryItem('Nbastream.net', 'Play_Main',image, image,fanart, url) urls.append(url) elif 'nhlstream.net' in el: url = Nbanhlstreams(el) if url and url not in urls: addDirectoryItem('Nhlstream.net', 'Play_Main',image, image,fanart, url) urls.append(url) elif 'livenflstream.net' in el: url = Nbanhlstreams(el) if url and url not in urls: addDirectoryItem('Livenflstream.net', 'Play_Main',image, image,fanart, url) urls.append(url) elif 'fs.anvato.net' in el: url = Getanvato(el) if url and url not in urls: addDirectoryItem('Fox ToGo (US IP Only)', 'Play_Main',image, image,fanart, url) urls.append(url) elif 'streamsarena.eu' in el: url = Streamarena(el) if url and url not in urls: addDirectoryItem('Streamsarena.eu', 'Play_Main',image, image,fanart, url) urls.append(url) elif 'streamup.com' in el and 'm3u8' not in el: url = GetStreamup(el.split('/')[3]) if url and url not in urls: addDirectoryItem('Streamup.com', 'Play_Main',image, image,fanart, url) urls.append(url) elif 'torula' in el: url = Torula(el) if url and url not in urls: addDirectoryItem('Torula.us', 'Play_Main',image, image,fanart, url) urls.append(url) elif 'gstreams.tv' in el: url = Gstreams(el) if url and url not in urls: addDirectoryItem('Gstreams.tv', 'Play_Main',image, image,fanart, url) urls.append(url) elif 'nfl-watch.com/live/watch' in el or 'nfl-watch.com/live/-watch' in el or 'nfl-watch.com/live/nfl-network' in el: url = Nflwatch(el) if url and url not in urls: addDirectoryItem('Nfl-watch.com', 'Play_Main',image, image,fanart, url) urls.append(url) elif 'ducking.xyz' in el: url = Ducking(el) if url and url not in urls: addDirectoryItem('Ducking.xyz', 'Play_Main',image, image,fanart, url) urls.append(url) elif 'streamandme' in el: url = Streamandme(el) if url and url not in urls: addDirectoryItem('Streamandme', 'Play_Main',image, image,fanart, url) urls.append(url) elif 'mursol.moonfruit.com' in el: url = Moonfruit(el) if url and url not in urls: addDirectoryItem('Moonfruit', 'Play_Main',image, image,fanart, url) urls.append(url) elif 'room' in el and 'm3u8' in el: url = Getroom(el) if url and url not in urls: addDirectoryItem('Room HD', 'Play_Main',image, image,fanart, url) urls.append(url) elif 'm3u8' in el and 'room' not in el and 'anvato' not in el and 'turner.com' not in el: url = el if url and url not in urls: addDirectoryItem('M3U8 stream', 'Play_Main',image, image,fanart, url) urls.append(url) for el in cont: if '101livesportsvideos.com' in el and 'SD' not in el and 'ace' not in el: url = Livesports101(el) if url and url not in urls: addDirectoryItem('101livesportsvideos.com', 'Play_Main',image, image,fanart, url) urls.append(url) for el in ct: if 'turner.com' in el and el not in urls: try: timest = el.split("exp=")[-1].split("~acl")[0] time_exp = datetime.fromtimestamp(int(timest)).strftime(control.region('time').replace('%H%H','%H').replace(':%S','')) except: time_exp = '' addDirectLink('Turner HD (external player) link expires '+time_exp, {'Title': orig_title}, el) urls.append(el) else: addDirectoryItem("[COLOR=FFFF0000]Could not find playable link[/COLOR]", 'Play_Main', image, image, fanart) endDirectory() except: pass
def Huddle_Sites(url, image, fanart): try: if not ('MMA') in url and not ('Soccer') in url and not ( 'WWE') in url and not ('match') in url and not ( 'fight') in url and not ('wwe') in url: murl = url.split('|') home = murl[1].split('vs')[0] away = murl[1].split('vs')[1] url = murl[0] html = client.request(url) block_content = client.parseDOM( html, "a", attrs={"class": "comments may-blank"}, ret="href") orig_title = '[COLOR=FF00FF00][B]' + away + ' at ' + home + '[/B][/COLOR]' home_f = home.lower().split()[0] away_f = away.lower().split()[0] home_l = home.lower().split()[-1] away_l = away.lower().split()[-1] home_sm = home.lower().split()[-1][:3] away_sm = away.lower().split()[-1][:3] link = None for element in block_content: if (home_sm in element and (away_sm in element or away_f in element)) or ( home_f in element and (away_l in element or away_f in element)) or ( home_l in element and (away_l in element or away_f in element)) or ( home_f in element and home_l in element) or ( away_f in element and away_l in element): link = element break else: continue else: pass if url == "MMA" or url == "Soccer" or url == "WWE": fanart = back[url] low = url.lower() if url == "Soccer": low = "thread" if url == "WWE": low = "thread" link = 'https://www.reddit.com/r/' + url + 'Streams/' T = 0 try: html = client.request(link) result = client.parseDOM(html, 'p', attrs={'class': 'title'}) channel = client.parseDOM(result, 'a', ret='href') for item in channel: if ('match') in item or ('game') in item or ( 'fight') in item or ('mma') in item or ( 'event') in item or ('wwe') in item: url = 'https://www.reddit.com/' + item url = url.replace('com//', 'com/') try: title = item.split(low)[1].replace( '_', ' ').upper()[:-1] except: title = item if not ('comment') in title and not ('http') in title: T = T + 1 addDirectoryItem( "[COLOR=FFFF0000]" + title + "[/COLOR]", 'Huddle_Sites', image, image, fanart, url) else: pass except: pass if T == 0: addDirectoryItem( "[COLOR=FFFF0000]No live event right now...Try Later![/COLOR]", 'Play_Main', image, image, fanart, '') endDirectory() else: pass if ('soccer') in url or ('fight') in url or ('wwe') in url or ( 'match') in url or ('event') in url or ('mma') in url: link = url if link: T = 0 html = client.request(link) content = client.parseDOM(html, "a", ret="href") cont = client.parseDOM(html, "p") ct = client.parseDOM(html, "code") check = 'http://www.rawstreams.com' urls = [] for el in content: if 'blabseal.com' in el: url = (el) if url and url not in urls: addDirectoryItem('Blabseal.com', 'HHBlabseal', image, image, fanart, url) urls.append(url) elif '1apps.com' in el: url = (el) if url and url not in urls: addDirectoryItem('Oneapp', 'HHOneapp', image, image, fanart, url) urls.append(url) elif 'youtu' in el and 'channel' not in el and 'list' not in el: url = el if url and url not in urls: addDirectoryItem('Youtube.com', 'HHGetYoutube', image, image, fanart, url) urls.append(url) elif 'giostreams' in el: url = (el) if url and url not in urls: addDirectoryItem('Giostreams.eu', 'HHGiostreams', image, image, fanart, url) urls.append(url) elif 'freecast.in' in el: url = (el) if url and url not in urls: addDirectoryItem('Freecast.in', 'HHFreecastin', image, image, fanart, url) urls.append(url) elif 'streamboat.tv' in el: url = (el) if url and url not in urls: addDirectoryItem('Streamboat.tv', 'HHStreambot', image, image, fanart, url) urls.append(url) elif 'nbastream.net' in el: url = (el) if url and url not in urls: addDirectoryItem('Nbastream.net', 'HHNbanhlstreams', image, image, fanart, url) urls.append(url) elif 'nhlstream.net' in el: url = (el) if url and url not in urls: addDirectoryItem('Nhlstream.net', 'HHNbanhlstreams', image, image, fanart, url) urls.append(url) elif 'livenflstream.net' in el: url = (el) if url and url not in urls: addDirectoryItem('Livenflstream.net', 'HHNbanhlstreams', image, image, fanart, url) urls.append(url) elif 'streamendous' in el: url = (el) if url and url not in urls: addDirectoryItem('Streamendous', 'HHtester', image, image, fanart, url) urls.append(url) elif 'fs.anvato.net' in el: url = (el) if url and url not in urls: addDirectoryItem('Fox ToGo (US IP Only)', 'HHGetanvato', image, image, fanart, url) urls.append(url) elif 'streamsarena.eu' in el: url = (el) if url and url not in urls: addDirectoryItem('Streamsarena.eu', 'HHStreamarena', image, image, fanart, url) urls.append(url) elif 'streamup.com' in el and 'm3u8' not in el: url = el if url and url not in urls: addDirectoryItem('Streamup.com', 'HHGetStreamup', image, image, fanart, url) urls.append(url) elif 'torula' in el: url = (el) if url and url not in urls: addDirectoryItem('Torula.us', 'HHTorula', image, image, fanart, url) urls.append(url) elif 'gstreams.tv' in el: url = (el) if url and url not in urls: addDirectoryItem('Gstreams.tv', 'HHGstreams', image, image, fanart, url) urls.append(url) elif 'nfl-watch.com/live/watch' in el or 'nfl-watch.com/live/-watch' in el or 'nfl-watch.com/live/nfl-network' in el: url = (el) if url and url not in urls: addDirectoryItem('Nfl-watch.com', 'HHNflwatch', image, image, fanart, url) urls.append(url) elif 'ducking.xyz' in el: url = (el) if url and url not in urls: addDirectoryItem('Ducking.xyz', 'HHDucking', image, image, fanart, url) urls.append(url) elif 'streamandme' in el: url = (el) if url and url not in urls: addDirectoryItem('Streamandme', 'HHStreamandme', image, image, fanart, url) urls.append(url) elif 'mursol.moonfruit.com' in el: url = (el) if url and url not in urls: addDirectoryItem('Moonfruit', 'HHMoonfruit', image, image, fanart, url) urls.append(url) elif 'm3u8' in el and 'room' not in el and 'anvato' not in el and 'turner.com' not in el: url = el if url and url not in urls: addDirectoryItem('M3U8 stream', 'Play_Main', image, image, fanart, url) urls.append(url) for el in ct: if 'turner.com' in el and el not in urls: try: timest = el.split("exp=")[-1].split("~acl")[0] time_exp = datetime.fromtimestamp( int(timest)).strftime( control.region('time').replace('%H%H', '%H').replace( ':%S', '')) except: time_exp = '' addDirectLink( 'Turner HD (external player) link expires ' + time_exp, {'Title': orig_title}, el) urls.append(el) else: addDirectoryItem( "[COLOR=FFFF0000]Could not find playable link[/COLOR]", 'Play_Main', image, image, fanart) endDirectory() except: pass
def Huddle_Main(url, image, fanart): mode = url image = logos[mode] fanart = back[mode] try: murl = 'https://www.reddit.com/r/' + mode + 'streams' today = datetime.utcnow() - timedelta(hours=8) today_from = str(today.strftime('%Y-%m-%d')) + 'T00:00:00.000-05:00' today_to = str(today.strftime('%Y-%m-%d')) + 'T23:59:00.000-05:00' result = client.request( 'http://www.sbnation.com/sbn_scoreboard/ajax_leagues_and_events?ranges[' + mode + '][from]=' + today_from + '&ranges[' + mode + '][until]=' + today_to) js = json.loads(result) js = js['leagues'][mode] if js: if mode == 'nfl': url = murl + '|' + 'redzone' + 'vs' + 'redzone' addDirectoryItem('[COLOR=FF00FF00][B]NFL Redzone[/B][/COLOR]', 'Huddle_Sites', image, image, fanart, url) for game in js: home = game['away_team']['name'] away = game['home_team']['name'] hs = str(game['score']['home'][game['score']['cols'].index( 'Total')]) if not hs: hs = '0' avs = str(game['score']['away'][game['score']['cols'].index( 'Total')]) if not avs: avs = '0' score = ' - ' + avs + ':' + hs start_time = game['start_time'] try: plus = False st = start_time.replace('T', ' ') if '+' in st: plus = True str_new = st.split('+')[-1] st = st.replace('+' + str_new, '') else: str_new = st.split('-')[-1] st = st.replace('-' + str_new, '') str_new = str_new.split(':')[0] if plus: st_time_utc = datetime( *(time.strptime(st, '%Y-%m-%d %H:%M:%S')[0:6] )) - timedelta(hours=int(str_new)) else: st_time_utc = datetime( *(time.strptime(st, '%Y-%m-%d %H:%M:%S')[0:6] )) + timedelta(hours=int(str_new)) local_game_time = utc_to_local(st_time_utc) local_time_str = ' - ' + local_game_time.strftime( control.region('dateshort') + ' ' + control.region( 'time').replace('%H%H', '%H').replace(':%S', '')) except: local_time_str = '' status = GameStatus(game['status']) status = ' - ' + status title = '[COLOR=FF00FF00][B]' + game['title'].replace( game['title'].split()[-1], '') + '[/B][/COLOR]' if display_start_time == 'true': title = title + '[COLOR=FFFFFF00]' + local_time_str + '[/COLOR]' if display_status == 'true': title = title + '[COLOR=FFFF0000]' + status + '[/COLOR]' if control.setting('display_score') == 'true': title = title + '[COLOR=FF00FFFF]' + score + '[/COLOR]' url = murl + '|' + home + 'vs' + away addDirectoryItem(title, 'Huddle_Sites', image, image, fanart, url) else: addDirectoryItem( "[COLOR=FFFF0000]No playable links...Try Later![/COLOR]", 'Play_Main', image, image, fanart) pass endDirectory() except: pass