Esempio n. 1
0
def dailyMatchupsPresent(date):

    # Obtains all games that are set to occur on specified date
    dailyMatchups = scoreboard.Scoreboard(league_id='00',
                                          game_date=date,
                                          headers=customHeaders,
                                          timeout=120)
    dailyMatchupsDict = dailyMatchups.get_normalized_dict()
    listOfGames = dailyMatchupsDict['GameHeader']

    homeAwayDict = {}

    for game in listOfGames:  # Loops through each game on date

        homeTeamID = game['HOME_TEAM_ID']

        for team, teamID in teams.items(
        ):  # Finds name of the home team that corresponds with teamID
            if teamID == homeTeamID:
                homeTeamName = team

        awayTeamID = game['VISITOR_TEAM_ID']

        for team, teamID in teams.items(
        ):  # Finds name of the away team that corresponds with teamID
            if teamID == awayTeamID:
                awayTeamName = team

        homeAwayDict.update({homeTeamName: awayTeamName})

    return homeAwayDict
Esempio n. 2
0
def aktualne_mecze_dzienne(data):

    # Pobieranie listy meczy dla podanej daty
    mecze_dzienne = scoreboard.Scoreboard(league_id='00',
                                          game_date=data,
                                          headers=headers,
                                          timeout=120)
    mecze_dzienne_slownik = mecze_dzienne.get_normalized_dict()
    mecze_dzienne_lista = mecze_dzienne_slownik['GameHeader']

    mecze_dla_gospodarzy_slownik = {}

    for game in mecze_dzienne_lista:

        id_gospodarza = game['HOME_TEAM_ID']

        for druzyna, id_druzyny in druzyny.items():
            if id_druzyny == id_gospodarza:
                nazwa_gospodarza = druzyna

        id_goscia = game['VISITOR_TEAM_ID']

        for druzyna, id_druzyny in druzyny.items():
            if id_druzyny == id_goscia:
                nazwa_goscia = druzyna

        mecze_dla_gospodarzy_slownik.update({nazwa_gospodarza: nazwa_goscia})
        # mecze_dla_gospodarzy_slownik

    return mecze_dla_gospodarzy_slownik
Esempio n. 3
0
def daily_match_ups_present(date):

    # Obtains all games that are set to occur on specified date
    daily_matchups = scoreboard.Scoreboard(league_id='00',
                                           game_date=date,
                                           headers=customHeaders,
                                           timeout=3000)
    daily_matchups_dict = daily_matchups.get_normalized_dict()
    list_of_games = daily_matchups_dict['GameHeader']

    home_away_dict = {}

    for game in list_of_games:  # Loops through each game on date

        home_team_id = game['HOME_TEAM_ID']

        for team, teamID in teams.items(
        ):  # Finds name of the home team that corresponds with teamID
            if teamID == home_team_id:
                home_team_name = team

        away_team_id = game['VISITOR_TEAM_ID']

        for team, teamID in teams.items(
        ):  # Finds name of the away team that corresponds with teamID
            if teamID == away_team_id:
                away_team_name = team

        # TODO HACE LOS PARES ENTRE EQUIPO LOCAL Y VISITANTE QUE SE VAN A ENFRENTAR EN DICHA FECHA
        home_away_dict.update({home_team_name: away_team_name})

    return home_away_dict
Esempio n. 4
0
def linescores():
	current_date = datetime.today().strftime('%Y-%m-%d')
	game_date = request.args.get('game_date')
	if game_date != 'undefined' and game_date is not None:
		current_date = game_date
	print(current_date)
	board = scoreboard.Scoreboard(game_date=current_date)
	line_score = board.line_score.get_data_frame()
	game_header = board.game_header.get_data_frame()
	#last_meeting = board.last_meeting.get_data_frame()
	current_games = line_score.merge(game_header, on='GAME_ID').set_index('TEAM_ID')#.merge(last_meeting, on='GAME_ID')
	return current_games.to_json(orient='index')
Esempio n. 5
0
 async def scores(self, ctx, *, date=GameDate.default):
     # default date is the current date
     try:
         score = scoreboard.Scoreboard(game_date=date)
         result = await self.get_scores(score)
         if result == '':
             await ctx.send('No games were played that day')
         else:
             embed = discord.Embed(title=f"Scores for {date}",
                                   description=result)
             await ctx.send(embed=embed)
     except:
         await ctx.send(
             'Invalid date format, make sure the format is "YYYY-MM-DD" or "MM-DD-YYYY"'
         )
Esempio n. 6
0
                label_data[quarter].append('' + play[7] + '\nScore: ' +
                                           play[10])

    ax = plt.gca()
    ax.set_title("" + away[5] + " at " + home[5], fontsize=15)
    for i in range(4):
        plt.text(10, 5, 'Quarter ' + str(i + 1), fontsize=18)
        plt.plot(x_data[i], y_data[i], 'ro-')
        plt.xlim(dates.date2num(datetime.strptime('12:00', '%M:%S')),
                 dates.date2num(datetime.strptime('00:00', '%M:%S')))
        plt.gca().xaxis.set_major_formatter(dates.DateFormatter('%M:%S'))
        plt.show()


if date.today() <= datetime.strptime("2019-04-30", "%Y-%m-%d").date():
    date = datetime.now().strftime("%Y-%m-%d")
else:
    date = "2019-04-30"
scores = scoreboard.Scoreboard(day_offset='0', game_date=date,
                               league_id='00').get_dict()['resultSets']
schedule = scores[0]
##TODO:
## Will need to include a calendar option that will == schedule variable
## (with dropdown list of games refreshing on each on click action)
## for sched in schedule:  ## Will need to produce a dropdown list of options of games that had happened within that day
## print(sched)
lineScore = scores[1]['rowSet']
game_id = schedule['rowSet'][0][2]
print("test")
get_game(game_id, lineScore)