def router(paramstring): params = dict(parse_qsl(sys.argv[2][1:])) params.pop('sport') if params: title = params.get('title') link = params.get('link') endpoint = params.get('endpoint') page = params.get('page') age = params.get('age') searchfor = params.get('searchfor') season = params.get('season') week = params.get('week') teams = params.get('teams') #Plays selected highlight clip if endpoint: if endpoint == 'replays': if searchfor is not None: replays.find_quarters(age, title, searchfor, season, week, teams) elif page is None: from .. import checks okayd = checks.checkPin() if okayd is False: ok = xbmcgui.Dialog().ok( 'Sports Guru', 'You need a valid pin in order to use this section of the add-on.' ) quit() replays.get_games(age) else: replays.get_games(age, page) else: raise ValueError( 'Invalid paramstring: {0}!'.format(paramstring)) else: raise ValueError('Invalid paramstring: {0}!'.format(paramstring)) else: list_item = xbmcgui.ListItem(label='Most Recent Full-Game Replays') list_item.setArt({'fanart': fanart, 'thumb': icon, 'poster': icon}) list_item.setInfo('video', { 'plot': '', 'title': 'Most Recent Full-Game Replays' }) url = get_url(sport='lfl', endpoint='replays', age='mostrecent') xbmcplugin.addDirectoryItem(_handle, url, list_item, isFolder=True) list_item = xbmcgui.ListItem( label='Older/Past Seasons Full-Game Replays') list_item.setArt({'fanart': fanart, 'thumb': icon, 'poster': icon}) list_item.setInfo('video', { 'plot': '', 'title': 'Most Recent Full-Game Replays' }) url = get_url(sport='lfl', endpoint='replays', age='older') xbmcplugin.addDirectoryItem(_handle, url, list_item, isFolder=True) xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_NONE) xbmcplugin.endOfDirectory(_handle)
def router(paramstring): params = dict(parse_qsl(sys.argv[2][1:])) params.pop('sport') if params: title = params.get('title') link = params.get('link') endpoint = params.get('endpoint') wpPage = params.get('wpPage') directPage = params.get('directPage') bloggerToken = params.get('bloggerToken') #Plays selected highlight clip if endpoint: if endpoint == 'replays': if link: replays.resolve(link, title) elif wpPage is None: from .. import checks okayd = checks.checkPin() if okayd is False: ok = xbmcgui.Dialog().ok( 'Sports Guru', 'You need a valid pin in order to use this section of the add-on.' ) quit() replays.get_games() else: replays.get_games(directPage, wpPage, bloggerToken) else: raise ValueError( 'Invalid paramstring: {0}!'.format(paramstring)) else: raise ValueError('Invalid paramstring: {0}!'.format(paramstring)) else: list_item = xbmcgui.ListItem(label='Full-Fight Replays') list_item.setArt({'fanart': fanart, 'thumb': icon, 'poster': icon}) list_item.setInfo( 'video', { 'plot': 'Full-Fight Replays section for all past UFC fights.\n\n[COLOR yellow]Note:[/COLOR] Pin Generation is required to use this section.', 'title': 'Full-Fight Replays' }) url = get_url(sport='ufc', endpoint='replays') xbmcplugin.addDirectoryItem(_handle, url, list_item, isFolder=True) xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_NONE) xbmcplugin.endOfDirectory(_handle)
def router(paramstring): params = dict(parse_qsl(sys.argv[2][1:])) params.pop('sport') if params: title = params.get('title') link = params.get('link') endpoint = params.get('endpoint') page = params.get('page') #Plays selected highlight clip if endpoint: if endpoint == 'replays': if link: replays.show_qualities(link, title) elif page is None: from .. import checks okayd = checks.checkPin() if okayd is False: ok = xbmcgui.Dialog().ok( 'Sports Guru', 'You need a valid pin in order to use this section of the add-on.' ) quit() replays.get_games() else: replays.get_games(page) else: raise ValueError( 'Invalid paramstring: {0}!'.format(paramstring)) else: raise ValueError('Invalid paramstring: {0}!'.format(paramstring)) else: list_item = xbmcgui.ListItem(label='Full-Game Replays') list_item.setArt({'fanart': fanart, 'thumb': icon, 'poster': icon}) list_item.setInfo( 'video', { 'plot': 'Full-Game Replays section for all past games from mostly Super League with some Rugby Union & England Premiership games thrown in.\n\n[COLOR yellow]Note:[/COLOR] Pin Generation is required to use this section.', 'title': 'Full-Game Replays' }) url = get_url(sport='rugby', endpoint='replays') xbmcplugin.addDirectoryItem(_handle, url, list_item, isFolder=True) xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_NONE) xbmcplugin.endOfDirectory(_handle)
def router(paramstring): params = dict(parse_qsl(sys.argv[2][1:])) params.pop('sport') if params: play_me = params.get('play_me') scoreboard_link = params.get('scoreboard') boxscores_link = params.get('boxscores') teamstats_link = params.get('teamstats') highlights_link = params.get('highlights') playbyplay_link = params.get('playbyplay') game_obj = params.get('game_obj') title = params.get('title') link = params.get('link') endpoint = params.get('endpoint') page = params.get('page') #Plays selected highlight clip if play_me: play_item = xbmcgui.ListItem(path=play_me) xbmcplugin.setResolvedUrl(_handle, True, listitem=play_item) elif endpoint: if endpoint == 'replays': if link: replays.show_qualities(link, title) elif page is None: from .. import checks okayd = checks.checkPin() if okayd is False: ok = xbmcgui.Dialog().ok( 'Sports Guru', 'You need a valid pin in order to use this section of the add-on.' ) quit() replays.get_games() else: replays.get_games(page) elif endpoint == 'today': game_list = nba_api.get_games() nba_api.display_games(game_list) elif endpoint == 'details': nba_api.display_gameoptions(game_obj) elif endpoint == 'standings': standings_list = nba_api.get_standings() standings_window = standings.Score() standings_window.setup(standings_list) standings_window.doModal() del standings_window elif teamstats_link: teamstats_data = nba_api.get_teamstats(teamstats_link) if len(teamstats_data) > 0: teamstats_window = teamstats.Stats() teamstats_window.setup(teamstats_data) teamstats_window.doModal() del teamstats_window else: nodata(game_obj) #Highlight Clips #Displays highlight clips of specific game elif highlights_link: h_list = nba_api.get_highlights(highlights_link) if len(h_list) > 0: nba_api.display_highlights(h_list) else: nodata(game_obj) #Play-By-Play Window elif playbyplay_link: #############The following link is for testing only#################### #playbyplay_link = 'http://www.espn.com/nba/playbyplay?gameId=400975653' ################Remove after testing is complete####################### pbp_list = nba_api.get_playbyplay(playbyplay_link) if len(pbp_list) > 0: game = ast.literal_eval(game_obj) playbyplay_window = playbyplay.Plays(game['Title']) playbyplay_window.setup(pbp_list) playbyplay_window.doModal() del playbyplay_window else: nodata(game_obj) #Scoreboard Window #Activates when selecting specific game elif scoreboard_link: #############The following link is for testing only#################### #scoreboard_link = 'http://www.espn.com/nba/boxscore?gameId=400975653' ################Remove after testing is complete####################### score_obj = nba_api.get_scoreboard(scoreboard_link) if len(score_obj) > 0: scoreboard_window = scoreboard.Score() scoreboard_window.setup(score_obj) scoreboard_window.doModal() del scoreboard_window else: nodata(game_obj) elif boxscores_link: #############The following link is for testing only#################### #boxscores_link = 'http://www.espn.com/nba/boxscore?gameId=400975653' ################Remove after testing is complete####################### boxscore_obj = nba_api.get_boxscores(boxscores_link) if len(boxscore_obj) > 0: boxscore_window = boxscore.Score() boxscore_window.setup(boxscore_obj) boxscore_window.doModal() del boxscore_window else: nodata(game_obj) else: raise ValueError('Invalid paramstring: {0}!'.format(paramstring)) else: #game_list = nba_api.get_games() #nba_api.display_games(game_list) nba_api.display_mainmenu()