sport api and bugfixes
@ -127,23 +127,6 @@ def updateCrypto():
|
|||||||
try:
|
try:
|
||||||
|
|
||||||
|
|
||||||
url = 'https://bm7p954xoh.execute-api.us-east-2.amazonaws.com/default/ScriptsAPI/crypto?symbols=ETH-BTC'
|
|
||||||
|
|
||||||
|
|
||||||
response = requests.get(url)
|
|
||||||
data = response.json()
|
|
||||||
print(data)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
stock_info = {}
|
|
||||||
|
|
||||||
for stock in data:
|
|
||||||
stock_info[stock['symbol']] = {'current': stock['price'], 'opening': float(stock['price']) - float(stock['change_since'])}
|
|
||||||
|
|
||||||
|
|
||||||
coingecko_client = CoinGeckoAPI()
|
|
||||||
|
|
||||||
f = open('csv/crypto_settings.json', 'r')
|
f = open('csv/crypto_settings.json', 'r')
|
||||||
all_crypto_settings = json.load(f)
|
all_crypto_settings = json.load(f)
|
||||||
f.close()
|
f.close()
|
||||||
@ -154,43 +137,28 @@ def updateCrypto():
|
|||||||
symbols = [sb.split(',')[0] for sb in symbol_base]
|
symbols = [sb.split(',')[0] for sb in symbol_base]
|
||||||
bases = [sb.split(',')[1] for sb in symbol_base]
|
bases = [sb.split(',')[1] for sb in symbol_base]
|
||||||
unique_bases = list(set(bases))
|
unique_bases = list(set(bases))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
coins = []
|
url = 'https://bm7p954xoh.execute-api.us-east-2.amazonaws.com/default/ScriptsAPI/crypto?symbols='
|
||||||
|
|
||||||
# coingecko rate limited me from calling this too often
|
for i,s in enumerate(symbols):
|
||||||
#coin_list = coingecko_client.get_coins_list()
|
url += bases[i] + '-' + s + ','
|
||||||
#json.dump(coin_list, open('csv/coin_list.json', 'w+'))
|
url = url[:-1] #remove last comma
|
||||||
|
print(url)
|
||||||
f = open('coin_list.json', 'r')
|
response = requests.get(url)
|
||||||
coin_list = json.load(f)
|
data = response.json()
|
||||||
f.close()
|
print(data)
|
||||||
|
|
||||||
# this might be super slow as coin_list is large
|
|
||||||
for s in symbols:
|
|
||||||
for c in coin_list:
|
|
||||||
if c['symbol'].upper() == s and c['id'] != 'binance-peg-cardano': # hackaround for two coins with symbol ada:
|
|
||||||
coins.append(c['id'])
|
|
||||||
|
|
||||||
crypto_info = {}
|
|
||||||
print(coins)
|
|
||||||
response = coingecko_client.get_price(ids=','.join(coins), vs_currencies = unique_bases, include_24hr_change=True)
|
|
||||||
|
|
||||||
#print(response)
|
|
||||||
|
|
||||||
|
|
||||||
for i,sb in enumerate(symbol_base):
|
for i,d in enumerate(data): #TODO get base from the server
|
||||||
#coin_info[name] = [symbol, base]
|
coin_info[symbol_base[i]] = {'current': d['price'], '24hr_change': d['percent_over_24hr']}
|
||||||
#info = coin_info[coin]
|
|
||||||
#CSV.write(info[0] + ',' + coin + ',' + info[1] + ',' +str(response[coin][info[1]]) + ',' + str(response[coin]['usd_24h_change']) + '\n')
|
all_crypto_settings['symbols'] = coin_info
|
||||||
crypto_info[sb] = {'current':response[coins[i]][bases[i].lower()], '24hr_change':response[coins[i]]['usd_24h_change']}
|
|
||||||
|
|
||||||
all_crypto_settings['symbols'] = crypto_info
|
|
||||||
|
|
||||||
json.dump(all_crypto_settings, open('csv/crypto_settings.json', 'w+'))
|
json.dump(all_crypto_settings, open('csv/crypto_settings.json', 'w+'))
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
raise e
|
||||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||||
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
||||||
logf.write(str(e))
|
logf.write(str(e))
|
||||||
@ -218,24 +186,24 @@ def updateForex():
|
|||||||
|
|
||||||
targets = ','.join(symbols)
|
targets = ','.join(symbols)
|
||||||
|
|
||||||
data = []
|
url = 'https://bm7p954xoh.execute-api.us-east-2.amazonaws.com/default/ScriptsAPI/forex?symbols='
|
||||||
for base in unique_bases:
|
|
||||||
url = 'https://bm7p954xoh.execute-api.us-east-2.amazonaws.com/default/ScriptsAPI/forex?base={}&targets='.format(base)+targets
|
|
||||||
response = requests.get(url)
|
|
||||||
data.extend(response.json())
|
|
||||||
|
|
||||||
|
|
||||||
|
for i,s in enumerate(symbols):
|
||||||
|
url += s + '-' + bases[i] + ','
|
||||||
|
url = url[:-1] #remove last comma
|
||||||
|
|
||||||
|
response = requests.get(url)
|
||||||
|
data = response.json()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
c_dict = {}
|
c_dict = {}
|
||||||
|
|
||||||
for i, sb in enumerate(symbol_base):
|
for d in data:
|
||||||
|
|
||||||
# check symbol base has data and if so add it to c_dict
|
c_dict[d['uid'].replace('/',',')] = {'current': d['rate'], '24hr_change': d['rate_over_24hr']}
|
||||||
for d in data:
|
|
||||||
|
|
||||||
if d['uid'] == bases[i] + '/' + symbols[i]:
|
|
||||||
c_dict[sb] = {'current': d['rate'], '24hr_change': d['rate_over_24hr']}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -243,6 +211,7 @@ def updateForex():
|
|||||||
all_forex_settings['symbols'] = c_dict
|
all_forex_settings['symbols'] = c_dict
|
||||||
json.dump(all_forex_settings, open( "csv/forex_settings.json", 'w+' ))
|
json.dump(all_forex_settings, open( "csv/forex_settings.json", 'w+' ))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
||||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||||
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
||||||
logf.write(str(e))
|
logf.write(str(e))
|
||||||
@ -408,9 +377,9 @@ def updateWeather():
|
|||||||
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
|
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
|
||||||
|
|
||||||
|
|
||||||
def updateLeagueTables(api_key, league_ids):
|
def updateLeagueTables():
|
||||||
|
|
||||||
|
|
||||||
|
url = 'https://bm7p954xoh.execute-api.us-east-2.amazonaws.com/default/ScriptsAPI/sports?stats='
|
||||||
try:
|
try:
|
||||||
f = open('csv/league_tables.json', 'r')
|
f = open('csv/league_tables.json', 'r')
|
||||||
all_settings = json.load(f)
|
all_settings = json.load(f)
|
||||||
@ -418,48 +387,40 @@ def updateLeagueTables(api_key, league_ids):
|
|||||||
|
|
||||||
leagues = all_settings['leagues'].keys()
|
leagues = all_settings['leagues'].keys()
|
||||||
leagues_info = {}
|
leagues_info = {}
|
||||||
|
|
||||||
for league in leagues:
|
for league in leagues:
|
||||||
league_id = league_ids[league]
|
url += league + ','
|
||||||
url = 'https://www.thesportsdb.com/api/v1/json/{}/lookuptable.php?l={}&s=2020-2021'.format(api_key, league_id)
|
url = url[:-1] # remove last comma
|
||||||
|
r = requests.get(url)
|
||||||
|
|
||||||
|
all_data = r.json()
|
||||||
|
|
||||||
|
|
||||||
|
for league in all_data[0].keys():
|
||||||
|
|
||||||
r = requests.get(url)
|
|
||||||
try:
|
|
||||||
all_data = r.json()
|
|
||||||
except Exception as e: # there is no data available
|
|
||||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
|
||||||
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
|
||||||
logf.write(str(e))
|
|
||||||
logf.write('. file: ' + fname)
|
|
||||||
logf.write('. line: ' + str(exc_tb.tb_lineno))
|
|
||||||
logf.write('. type: ' + str(exc_type))
|
|
||||||
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
|
|
||||||
logf.write(url)
|
|
||||||
continue
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
teams = []
|
teams = []
|
||||||
|
|
||||||
|
|
||||||
for i in range(len(all_data['table'])):
|
for d in all_data[0][league]:
|
||||||
team = {}
|
team = {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
team['name'] = all_data['table'][i]['strTeam']
|
team['name'] = d['strTeam']
|
||||||
team['wins'] = all_data['table'][i]['intWin']
|
team['wins'] = d['intWin']
|
||||||
team['loss'] = all_data['table'][i]['intLoss']
|
team['loss'] = d['intLoss']
|
||||||
team['draw'] = all_data['table'][i]['intDraw']
|
team['draw'] = d['intDraw']
|
||||||
team['played'] = all_data['table'][i]['intPlayed']
|
#team['played'] = d['intPlayed']
|
||||||
team['standing'] = all_data['table'][i]['intRank']
|
team['standing'] = d['intRank']
|
||||||
team['points'] = all_data['table'][i]['intPoints']
|
#team['points'] = d['intPoints']
|
||||||
|
|
||||||
teams.append(team)
|
teams.append(team)
|
||||||
leagues_info[league] = teams
|
leagues_info[league.upper()] = teams
|
||||||
all_settings['leagues'] = leagues_info
|
all_settings['leagues'] = leagues_info
|
||||||
json.dump(all_settings, open( "csv/league_tables.json".format(league), 'w+' ))
|
json.dump(all_settings, open( "csv/league_tables.json".format(league), 'w+' ))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
raise e
|
||||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||||
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
||||||
logf.write(str(e))
|
logf.write(str(e))
|
||||||
@ -469,17 +430,19 @@ def updateLeagueTables(api_key, league_ids):
|
|||||||
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
|
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
|
||||||
|
|
||||||
|
|
||||||
def updateLeagueEvents(api_key, league_ids, time):
|
def updateLeagueEvents(time):
|
||||||
|
|
||||||
|
url = 'https://bm7p954xoh.execute-api.us-east-2.amazonaws.com/default/ScriptsAPI/sports?{}='.format(time)
|
||||||
|
|
||||||
if time == 'past':
|
if time == 'past':
|
||||||
url ='https://www.thesportsdb.com/api/v1/json/{}/eventspastleague.php?id={}' #last 15 events on the league (premium only)
|
|
||||||
f = open('csv/past_games.json')
|
f = open('csv/past_games.json')
|
||||||
elif time == 'upcoming':
|
elif time == 'upcoming':
|
||||||
url ='https://www.thesportsdb.com/api/v1/json/{}/eventsnextleague.php?id={}' #next 15 events on the league (premium only)
|
|
||||||
f = open('csv/upcoming_games.json')
|
f = open('csv/upcoming_games.json')
|
||||||
elif time == 'live':
|
elif time == 'livescore':
|
||||||
f = open('csv/live_games.json')
|
f = open('csv/live_games.json')
|
||||||
url = 'https://thesportsdb.com/api/v2/json/{}/livescore.php?l={}'
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -488,52 +451,47 @@ def updateLeagueEvents(api_key, league_ids, time):
|
|||||||
f.close()
|
f.close()
|
||||||
leagues = all_settings['leagues'].keys()
|
leagues = all_settings['leagues'].keys()
|
||||||
leagues_info = {}
|
leagues_info = {}
|
||||||
|
|
||||||
for league in leagues:
|
for league in leagues:
|
||||||
league_id = league_ids[league]
|
url += league + ','
|
||||||
url = url.format(api_key, league_id)
|
url = url[:-1] # remove last comma
|
||||||
|
|
||||||
r = requests.get(url)
|
r = requests.get(url)
|
||||||
try:
|
|
||||||
all_data = r.json()
|
all_data = r.json()
|
||||||
except Exception as e: # there is no data available
|
|
||||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
print(all_data['NFL'][0])
|
||||||
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
|
||||||
logf.write(str(e))
|
events = []
|
||||||
logf.write('. file: ' + fname)
|
|
||||||
logf.write('. line: ' + str(exc_tb.tb_lineno))
|
for league in all_data.keys():
|
||||||
logf.write('. type: ' + str(exc_type))
|
for d in all_data[league]:
|
||||||
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
|
event = {}
|
||||||
logf.write(url)
|
event['date'] = d['dateEvent']
|
||||||
continue
|
|
||||||
|
|
||||||
|
if time == 'live':
|
||||||
|
|
||||||
events = []
|
event['progess'] = d['strProgress']
|
||||||
|
event['status'] = d['strStatus']
|
||||||
if not all_data['events'] is None:
|
else:
|
||||||
|
|
||||||
|
event['round'] = d['intRound']
|
||||||
|
event['time'] = d['strTime']
|
||||||
|
event['home_team'] = d['strHomeTeam']
|
||||||
|
|
||||||
for i in range(len(all_data['events'])):
|
event['away_team'] = d['strAwayTeam']
|
||||||
event = {}
|
|
||||||
event['date'] = all_data['events'][i]['dateEvent']
|
if time != 'upcoming':
|
||||||
|
event['away_score'] = d['intAwayScore']
|
||||||
if time == 'live':
|
event['home_score'] = d['intHomeScore']
|
||||||
event['time'] = all_data['events'][i]['strEventTime']
|
|
||||||
event['progess'] = all_data['events'][i]['strProgress']
|
events.append(event)
|
||||||
event['status'] = all_data['events'][i]['strStatus']
|
|
||||||
else:
|
|
||||||
event['time'] = all_data['events'][i]['strTime']
|
|
||||||
event['round'] = all_data['events'][i]['intRound']
|
|
||||||
event['home_team'] = all_data['events'][i]['strHomeTeam']
|
|
||||||
event['home_score'] = all_data['events'][i]['intHomeScore']
|
|
||||||
event['away_team'] = all_data['events'][i]['strAwayTeam']
|
|
||||||
event['away_score'] = all_data['events'][i]['intAwayScore']
|
|
||||||
|
|
||||||
events.append(event)
|
|
||||||
leagues_info[league] = events
|
leagues_info[league] = events
|
||||||
all_settings['leagues'] = leagues_info
|
all_settings['leagues'] = leagues_info
|
||||||
|
|
||||||
json.dump(all_settings, open( "csv/{}_games.json".format(time), 'w+' ))
|
json.dump(all_settings, open( "csv/{}_games.json".format(time), 'w+' ))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
||||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||||
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
||||||
logf.write(str(e))
|
logf.write(str(e))
|
||||||
@ -545,24 +503,14 @@ def updateLeagueEvents(api_key, league_ids, time):
|
|||||||
|
|
||||||
def updateSports():
|
def updateSports():
|
||||||
#read user settings to decide which sprots to update
|
#read user settings to decide which sprots to update
|
||||||
api_key = '97436974'
|
|
||||||
|
updateLeagueTables()
|
||||||
|
|
||||||
|
#updateLeagueEvents('livescore')
|
||||||
|
#updateLeagueEvents('past')
|
||||||
league_ids = {'Premier League':'4328', 'NHL':'4380', 'NBA':'4387', 'NFL':'4391'}
|
#updateLeagueEvents('upcoming')
|
||||||
updateLeagueTables(api_key, league_ids)
|
|
||||||
|
|
||||||
updateLeagueEvents(api_key, league_ids, 'live')
|
|
||||||
updateLeagueEvents(api_key, league_ids, 'past')
|
|
||||||
updateLeagueEvents(api_key, league_ids, 'upcoming')
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
'https://www.thesportsdb.com/api/v1/json/{}/eventsnext.php?id=133602'.format(api_key) # next five events by team ID (paid) use this for upcoming team games
|
|
||||||
|
|
||||||
#url = 'https://www.thesportsdb.com/api/v1/json/{}/eventsseason.php?id=4328&s=2020-2021'.format(api_key) # all past events in premier league
|
|
||||||
|
|
||||||
url = 'https://www.thesportsdb.com/api/v2/json/{}/livescore.php?l=4380'.format(api_key) #live scores
|
|
||||||
|
|
||||||
|
|
||||||
def checkStocks(last_update, update_frequency):
|
def checkStocks(last_update, update_frequency):
|
||||||
@ -621,13 +569,6 @@ if __name__ == '__main__':
|
|||||||
t = time.time()
|
t = time.time()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
updateNews()
|
|
||||||
sys.exit()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
newsapi = NewsApiClient(api_key='cf08652bd17647b89aaf469a1a8198a9')
|
newsapi = NewsApiClient(api_key='cf08652bd17647b89aaf469a1a8198a9')
|
||||||
|
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
BIN
logos/startup_logo.gif
Normal file
After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 50 KiB |
@ -1103,6 +1103,7 @@ function getSportsSettings(page) {
|
|||||||
let title = page.querySelectorAll(".title-select")[0].checked;
|
let title = page.querySelectorAll(".title-select")[0].checked;
|
||||||
let leagues_el = page.querySelectorAll(".league-list")[0];
|
let leagues_el = page.querySelectorAll(".league-list")[0];
|
||||||
leagues = getListItems(leagues_el);
|
leagues = getListItems(leagues_el);
|
||||||
|
|
||||||
|
|
||||||
settings = { title: title, leagues: leagues };
|
settings = { title: title, leagues: leagues };
|
||||||
return settings;
|
return settings;
|
||||||
|
@ -1688,6 +1688,7 @@ class StockTicker():
|
|||||||
img = img.crop((0,0,x_offset ,32))
|
img = img.crop((0,0,x_offset ,32))
|
||||||
imgs.append(img)
|
imgs.append(img)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
||||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||||
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
||||||
self.logf.write(str(e))
|
self.logf.write(str(e))
|
||||||
@ -1747,10 +1748,12 @@ class StockTicker():
|
|||||||
|
|
||||||
|
|
||||||
logo = Image.open('logos/sports/{}/{}'.format(league, sports_info[team['name']]['logo']))
|
logo = Image.open('logos/sports/{}/{}'.format(league, sports_info[team['name']]['logo']))
|
||||||
|
|
||||||
|
|
||||||
img.paste(logo, (x_offset, 0))
|
img.paste(logo, (x_offset, 0))
|
||||||
x_offset += logo.size[0] + 2
|
x_offset += logo.size[0] + 2
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
||||||
print('no logo for:', team['name'])
|
print('no logo for:', team['name'])
|
||||||
|
|
||||||
|
|
||||||
@ -1758,7 +1761,7 @@ class StockTicker():
|
|||||||
wins_timage = self.textImage('Wins:' + team['wins'], small_font, r = 0, g = 255, b = 0)
|
wins_timage = self.textImage('Wins:' + team['wins'], small_font, r = 0, g = 255, b = 0)
|
||||||
loss_timage = self.textImage('Losses:' + team['loss'], small_font, r = 255, g = 0, b = 0)
|
loss_timage = self.textImage('Losses:' + team['loss'], small_font, r = 255, g = 0, b = 0)
|
||||||
draw_timage = self.textImage('Draws:' + team['draw'], small_font, r = 0, g = 0, b = 255)
|
draw_timage = self.textImage('Draws:' + team['draw'], small_font, r = 0, g = 0, b = 255)
|
||||||
points_timage = self.textImage('Points:' + team['points'], small_font, r = 255, g = 255, b = 255)
|
#points_timage = self.textImage('Points:' + team['points'], small_font, r = 255, g = 255, b = 255)
|
||||||
standing_timage = self.textImage('Standing:' + team['standing'], small_font, r = 255, g = 255, b = 255)
|
standing_timage = self.textImage('Standing:' + team['standing'], small_font, r = 255, g = 255, b = 255)
|
||||||
|
|
||||||
|
|
||||||
@ -1769,15 +1772,17 @@ class StockTicker():
|
|||||||
img.paste(draw_timage, (x_offset, 26))
|
img.paste(draw_timage, (x_offset, 26))
|
||||||
|
|
||||||
x_offset += max( wins_timage.size[0], loss_timage.size[0], draw_timage.size[0])
|
x_offset += max( wins_timage.size[0], loss_timage.size[0], draw_timage.size[0])
|
||||||
img.paste(points_timage, (x_offset, 14))
|
#img.paste(points_timage, (x_offset, 14))
|
||||||
img.paste(standing_timage, (x_offset, 22))
|
img.paste(standing_timage, (x_offset, 22))
|
||||||
|
|
||||||
x_offset += max(points_timage.size[0], standing_timage.size[0]) + buff_size
|
#x_offset += max(points_timage.size[0], standing_timage.size[0]) + buff_size
|
||||||
|
x_offset += standing_timage.size[0] + buff_size
|
||||||
|
|
||||||
|
|
||||||
img = img.crop((0,0,x_offset ,32))
|
img = img.crop((0,0,x_offset ,32))
|
||||||
imgs.append(img)
|
imgs.append(img)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
raise e
|
||||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||||
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
||||||
self.logf.write(str(e))
|
self.logf.write(str(e))
|
||||||
@ -2715,7 +2720,7 @@ if __name__ == '__main__':
|
|||||||
stock_ticker.logf = log
|
stock_ticker.logf = log
|
||||||
|
|
||||||
start_image = Image.open('./logos/startup_logo.png')
|
start_image = Image.open('./logos/startup_logo.png')
|
||||||
start_GIF = Image.open('./logos/startup_logo_1.gif')
|
start_GIF = Image.open('./logos/startup_logo.gif')
|
||||||
|
|
||||||
msg = getInput()
|
msg = getInput()
|
||||||
if msg =='*':
|
if msg =='*':
|
||||||
@ -2735,7 +2740,7 @@ if __name__ == '__main__':
|
|||||||
#stock_ticker.process_msg('G')
|
#stock_ticker.process_msg('G')
|
||||||
#stock_ticker.process_msg('f')
|
#stock_ticker.process_msg('f')
|
||||||
#stock_ticker.process_msg('W')
|
#stock_ticker.process_msg('W')
|
||||||
#stock_ticker.process_msg('A')
|
stock_ticker.process_msg('A')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -2177,7 +2177,7 @@
|
|||||||
<option>NFL</option>
|
<option>NFL</option>
|
||||||
<option>NBA</option>
|
<option>NBA</option>
|
||||||
<option>NHA</option>
|
<option>NHA</option>
|
||||||
<option>Premier League</option>
|
<option>PL</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-auto">
|
<div class="col-auto">
|
||||||
|