commit
fc6b93efbe
@ -5,6 +5,8 @@
|
||||
# This code can not be copied and/or distributed without the express
|
||||
# permission of Fintic
|
||||
|
||||
import random
|
||||
import pickle
|
||||
import finnhub
|
||||
import time
|
||||
import csv
|
||||
@ -85,49 +87,136 @@ def updateUpdate(NY_time):
|
||||
|
||||
|
||||
|
||||
# def updateStocks(api_key, logf):
|
||||
# try:
|
||||
# f = open('csv/stocks_settings.json', 'r')
|
||||
# all_stocks_settings = json.load(f)
|
||||
# f.close()
|
||||
# stock_info = all_stocks_settings['symbols']
|
||||
# symbols = list(stock_info.keys())
|
||||
|
||||
# url = 'https://bm7p954xoh.execute-api.us-east-2.amazonaws.com/default/ScriptsAPI/stocks?symbols='
|
||||
|
||||
# for symbol in symbols:
|
||||
# url += symbol + ','
|
||||
|
||||
# url += '&apiKey=' + api_key
|
||||
# response = requests.get(url)
|
||||
# data = response.json()
|
||||
|
||||
# # stock_info = {}
|
||||
# if len(data) > 0:
|
||||
# for symbol in symbols:
|
||||
# for stock in data:
|
||||
# if stock['symbol'] == symbol:
|
||||
# stock_info[stock['symbol']] = {'current': stock['price'], 'change': stock['change_since'], 'percent_change':stock['percent']}
|
||||
|
||||
# all_stocks_settings['symbols'] = stock_info
|
||||
# f = open('csv/stocks_settings.json', 'w+')
|
||||
# json.dump(all_stocks_settings, f)
|
||||
# f.close()
|
||||
|
||||
# except:
|
||||
# pass
|
||||
#logf = open('log.txt', "a")
|
||||
#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.close()
|
||||
|
||||
|
||||
def getCookiesnCrumb():
|
||||
|
||||
headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36'}
|
||||
cookie_url = 'https://finance.yahoo.com'
|
||||
crumb_url = 'https://query1.finance.yahoo.com/v1/test/getcrumb'
|
||||
|
||||
session = requests.Session()
|
||||
session.get(cookie_url, headers=headers)
|
||||
crumb = session.get(crumb_url, headers=headers).content.decode('utf-8')
|
||||
|
||||
with open('session.txt', 'wb') as f:
|
||||
pickle.dump(session, f)
|
||||
with open('crumb.txt', 'w') as f:
|
||||
f.write(crumb)
|
||||
|
||||
|
||||
def updateStocks(api_key, logf):
|
||||
|
||||
|
||||
try:
|
||||
|
||||
|
||||
max_stocks = 200
|
||||
|
||||
f = open('csv/stocks_settings.json', 'r')
|
||||
all_stocks_settings = json.load(f)
|
||||
f.close()
|
||||
stock_info = all_stocks_settings['symbols']
|
||||
symbols = list(stock_info.keys())
|
||||
|
||||
headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36'}
|
||||
|
||||
url = 'https://bm7p954xoh.execute-api.us-east-2.amazonaws.com/default/ScriptsAPI/stocks?symbols='
|
||||
# url = 'https://bm7p954xoh.execute-api.us-east-2.amazonaws.com/default/ScriptsAPI/stocks?symbols='
|
||||
url1 = 'https://query1.finance.yahoo.com/v7/finance/quote?fields=regularMarketPrice,regularMarketChangePercent,regularMarketChange®ion=US&lang=en-US&symbols='
|
||||
url2 = 'https://cloud.iexapis.com/v1/stock/market/batch?&types=quote&token=pk_aff870df1a984daa9dd43c71801c1936&symbols='
|
||||
url = random.choice([url1, url2])
|
||||
|
||||
for symbol in symbols:
|
||||
url += symbol + ','
|
||||
# url += '&apiKey=' + api_key
|
||||
|
||||
url += '&apiKey=' + api_key
|
||||
response = requests.get(url)
|
||||
if 'cloud.iexapis.com' in url:
|
||||
response = requests.get(url, headers=headers)
|
||||
data = response.json()
|
||||
|
||||
|
||||
# stock_info = {}
|
||||
if len(data) > 0:
|
||||
for symbol in symbols:
|
||||
for stock in data:
|
||||
if stock['symbol'] == symbol:
|
||||
stock_info[stock['symbol']] = {'current': stock['price'], 'change': stock['change_since'], 'percent_change':stock['percent']}
|
||||
|
||||
stock_info[data[symbol]['quote']['symbol']] = {'current': data[symbol]['quote']['latestPrice'], 'change': data[symbol]['quote']['change'], 'percent_change':data[symbol]['quote']['changePercent'] * 100}
|
||||
|
||||
all_stocks_settings['symbols'] = stock_info
|
||||
|
||||
|
||||
f = open('csv/stocks_settings.json', 'w+')
|
||||
json.dump(all_stocks_settings, f)
|
||||
f.close()
|
||||
|
||||
elif 'query1.finance.yahoo.com/v7' in url:
|
||||
response = requests.get(url, headers=headers)
|
||||
data = response.json()
|
||||
if "'error': {'code'" in str(data):
|
||||
while True:
|
||||
try:
|
||||
with open('session.txt', 'rb') as f:
|
||||
session = pickle.load(f)
|
||||
with open('crumb.txt', 'r') as f:
|
||||
crumb = f.read()
|
||||
except:
|
||||
getCookiesnCrumb()
|
||||
with open('session.txt', 'rb') as f:
|
||||
session = pickle.load(f)
|
||||
with open('crumb.txt', 'r') as f:
|
||||
crumb = f.read()
|
||||
params = {'crumb': crumb}
|
||||
|
||||
data = session.get(url, headers=headers, params=params).json()
|
||||
|
||||
if "'error': {'code'" not in str(data):
|
||||
break
|
||||
else:
|
||||
getCookiesnCrumb()
|
||||
time.sleep(5)
|
||||
# stock_info = {}
|
||||
if len(data) > 0:
|
||||
for symbol in symbols:
|
||||
for stock in data['quoteResponse']['result']:
|
||||
if stock['symbol'] == symbol:
|
||||
stock_info[stock['symbol']] = {'current': stock['regularMarketPrice'], 'change': stock['regularMarketChange'], 'percent_change':stock['regularMarketChangePercent']}
|
||||
|
||||
all_stocks_settings['symbols'] = stock_info
|
||||
f = open('csv/stocks_settings.json', 'w+')
|
||||
json.dump(all_stocks_settings, f)
|
||||
f.close()
|
||||
except:
|
||||
pass
|
||||
|
||||
#logf = open('log.txt', "a")
|
||||
#exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
#fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
||||
@ -140,9 +229,7 @@ def updateStocks(api_key, logf):
|
||||
|
||||
|
||||
def updateStocksPrePost(api_key, logf):
|
||||
|
||||
try:
|
||||
|
||||
f = open('csv/stocks_settings.json', 'r')
|
||||
all_stocks_settings = json.load(f)
|
||||
f.close()
|
||||
@ -150,21 +237,40 @@ def updateStocksPrePost(api_key, logf):
|
||||
symbols = list(stock_info.keys())
|
||||
|
||||
#KEEP THIS JUST IN CASE V7 GOES DOWN prepost_url = 'https://query2.finance.yahoo.com/v6/finance/quote?symbols='
|
||||
prepost_url = 'https://query2.finance.yahoo.com/v7/finance/quote?symbols='
|
||||
prepost_url = 'https://query2.finance.yahoo.com/v6/finance/quote?symbols='
|
||||
for symbol in symbols:
|
||||
prepost_url += symbol + ','
|
||||
|
||||
prepost_url += '&fields=regularMarketPreviousClose,regularMarketPrice,preMarketPrice,preMarketChangePercent,regularMarketChangePercent,regularMarketChange,preMarketChange,postMarketPrice,postMarketChange,postMarketChangePercent®ion=US&lang=en-US'
|
||||
|
||||
headers = {
|
||||
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36'
|
||||
}
|
||||
prepost = requests.get(prepost_url, headers=headers)
|
||||
headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36'}
|
||||
|
||||
if 'Unauthorized' in str(prepost.json()):
|
||||
prepost = requests.get(prepost_url.replace('v7','v6'), headers=headers)
|
||||
prepost = requests.get(prepost_url, headers=headers).json()
|
||||
if "'error': {'code'" in str(prepost):
|
||||
while True:
|
||||
try:
|
||||
with open('session.txt', 'rb') as f:
|
||||
session = pickle.load(f)
|
||||
with open('crumb.txt', 'r') as f:
|
||||
crumb = f.read()
|
||||
except:
|
||||
getCookiesnCrumb()
|
||||
with open('session.txt', 'rb') as f:
|
||||
session = pickle.load(f)
|
||||
with open('crumb.txt', 'r') as f:
|
||||
crumb = f.read()
|
||||
params = {'crumb': crumb}
|
||||
|
||||
prepost_data = prepost.json()['quoteResponse']['result']
|
||||
prepost = session.get(prepost_url.replace('v6','v7'), headers=headers, params=params).json()
|
||||
|
||||
if "'error': {'code'" not in str(prepost):
|
||||
break
|
||||
else:
|
||||
getCookiesnCrumb()
|
||||
time.sleep(5)
|
||||
|
||||
prepost_data = prepost['quoteResponse']['result']
|
||||
time_now = datetime.now(pytz.timezone('America/New_York')).strftime("%H:%M EST")
|
||||
|
||||
if len(prepost_data) > 0:
|
||||
@ -198,7 +304,6 @@ def updateStocksPrePost(api_key, logf):
|
||||
|
||||
with open('csv/prepost_settings.json', 'w+') as f:
|
||||
json.dump(all_stocks_settings['symbols'], f)
|
||||
|
||||
except:
|
||||
pass
|
||||
|
||||
@ -661,74 +766,82 @@ def updateNews(api_key, logf):
|
||||
|
||||
def updateWeather(api_key, logf):
|
||||
|
||||
max_cities = 30
|
||||
|
||||
try:
|
||||
gn = geocoders.GeoNames(username='fintic')
|
||||
|
||||
weather_codes = {
|
||||
0: ['Clear', 'Clear sky'],
|
||||
1: ['Clouds', 'few clouds'], 2: ['Clouds', 'scattered clouds'], 3: ['Clouds', 'overcast clouds'],
|
||||
45: ['Fog', 'Fog'], 48: ['Fog', 'depositing rime fog'],
|
||||
51: ['Drizzle', 'Light'], 53: ['Drizzle', 'moderate'], 55: ['Drizzle', 'dense'], 56: ['Drizzle', 'light'], 57: ['Drizzle', 'dense'],
|
||||
61: ['Rain', 'light rain'], 63: ['Rain', 'moderate rain'], 65: ['Rain', 'very heavy rain'],
|
||||
66: ['Rain', 'freezing rain'], 67: ['Rain', 'freezing rain'],
|
||||
71: ['Snow', 'slight'], 73: ['Snow', 'moderate'], 75: ['Snow', 'heavy'], 77: ['Snow', 'Snow grains'], 85: ['Snow', 'slight'], 86: ['Snow', 'heavy'],
|
||||
80: ['Rain', 'light intensity shower rain'], 81: ['Rain', 'shower rain'], 82: ['Rain', 'heavy intensity shower rain'],
|
||||
95: ['Thunderstorm', 'Slight or moderate'], 96: ['Thunderstorm', 'slight hail'], 99: ['Thunderstorm', 'heavy hail']
|
||||
}
|
||||
f = open('csv/daily_weather.json', 'r')
|
||||
all_daily_settings = json.load(f)
|
||||
f.close()
|
||||
|
||||
f = open('csv/current_weather.json', 'r')
|
||||
all_current_settings = json.load(f)
|
||||
f.close()
|
||||
|
||||
current_locations = list(all_current_settings['locations'].keys())
|
||||
daily_locations = list(all_daily_settings['locations'].keys())
|
||||
|
||||
all_locations = list(set(current_locations + daily_locations))
|
||||
|
||||
|
||||
|
||||
|
||||
current_weathers = {}
|
||||
daily_weathers = {}
|
||||
|
||||
|
||||
|
||||
for location in all_locations:
|
||||
loc = gn.geocode(location)
|
||||
current_weather = {}
|
||||
|
||||
lat = loc.latitude
|
||||
lon = loc.longitude
|
||||
url = 'https://api.openweathermap.org/data/2.5/onecall?lat={}&units=metric&lon={}&appid={}'.format(lat, lon, api_key)
|
||||
r = requests.get(url)
|
||||
url = 'https://api.open-meteo.com/v1/forecast?latitude={}&longitude={}&hourly=apparent_temperature,temperature_2m,relativehumidity_2m,precipitation_probability,weathercode,cloudcover,visibility,windspeed_10m,winddirection_10m,uv_index,is_day&daily=weathercode,temperature_2m_max,temperature_2m_min¤t_weather=true&timezone=UTC'.format(lat, lon)
|
||||
r = requests.get(url).json()
|
||||
|
||||
weather = r.json()['current']
|
||||
|
||||
current_weather['main_weather'] = weather['weather'][0]['main']
|
||||
current_weather['description'] = weather['weather'][0]['description']
|
||||
current_weather['temp'] = weather['temp']
|
||||
current_weather['min_temp'] = r.json()['daily'][0]['temp']['min']
|
||||
current_weather['max_temp'] = r.json()['daily'][0]['temp']['max']
|
||||
current_weather['feels_like'] = weather['feels_like']
|
||||
current_weather['humidity'] = weather['humidity']
|
||||
current_weather['clouds'] = weather['clouds']
|
||||
current_weather['wind_speed'] = weather['wind_speed']
|
||||
current_weather['wind_direction'] = weather['wind_deg']
|
||||
current_weather['visibility'] = weather['visibility']
|
||||
current_weather['uv'] = weather['uvi']
|
||||
current_weather['rain_chance'] = r.json()['hourly'][0]['pop']
|
||||
times = r['hourly']['time']
|
||||
hour_now = datetime.now(pytz.utc).strftime('%Y-%m-%dT%H:00')
|
||||
index_pos = times.index(hour_now)
|
||||
|
||||
main_weather_code = r['hourly']['weathercode'][index_pos]
|
||||
current_weather['main_weather'] = weather_codes[main_weather_code][0]
|
||||
current_weather['description'] = weather_codes[main_weather_code][1]
|
||||
current_weather['temp'] = r['hourly']['temperature_2m'][index_pos]
|
||||
current_weather['min_temp'] = r['daily']['temperature_2m_min'][0]
|
||||
current_weather['max_temp'] = r['daily']['temperature_2m_max'][0]
|
||||
current_weather['feels_like'] = r['hourly']['apparent_temperature'][index_pos]
|
||||
current_weather['humidity'] = r['hourly']['relativehumidity_2m'][index_pos]
|
||||
current_weather['clouds'] = r['hourly']['cloudcover'][index_pos]
|
||||
if r['hourly']['visibility'][index_pos] > 10000:
|
||||
current_weather['visibility'] = 10000
|
||||
else:
|
||||
current_weather['visibility'] = r['hourly']['visibility'][index_pos]
|
||||
current_weather['uv'] = r['hourly']['uv_index'][index_pos]
|
||||
current_weather['rain_chance'] = r['hourly']['precipitation_probability'][index_pos]
|
||||
current_weather['wind_speed'] = r['hourly']['windspeed_10m'][index_pos]
|
||||
current_weather['wind_direction'] = r['hourly']['winddirection_10m'][index_pos]
|
||||
current_weather['is_day'] = r['hourly']['is_day'][index_pos]
|
||||
|
||||
if location in current_locations:
|
||||
current_weathers[location] = current_weather
|
||||
|
||||
daily_weather = []
|
||||
daily = r.json()['daily']
|
||||
daily = r['daily']
|
||||
|
||||
for day in daily:
|
||||
for i in range(0,7):
|
||||
dct = {}
|
||||
dct['main_weather'] = day['weather'][0]['main']
|
||||
dct['description'] = day['weather'][0]['description']
|
||||
dct['min_temp'] = day['temp']['min']
|
||||
dct['max_temp'] = day['temp']['max']
|
||||
daily_weather_code = daily['weathercode'][i]
|
||||
dct['main_weather'] = weather_codes[daily_weather_code][0]
|
||||
dct['description'] = weather_codes[daily_weather_code][1]
|
||||
dct['min_temp'] = daily['temperature_2m_min'][i]
|
||||
dct['max_temp'] = daily['temperature_2m_max'][i]
|
||||
daily_weather.append(dct)
|
||||
|
||||
# add relevant urrent information to first day in daily
|
||||
daily_weather[0]['temp'] = weather['temp']
|
||||
daily_weather[0]['temp'] = current_weather['temp']
|
||||
daily_weather[0]['rain_chance'] = current_weather['rain_chance']
|
||||
daily_weather[0]['humidity'] = current_weather['humidity']
|
||||
daily_weather[0]['wind_speed'] = current_weather['wind_speed']
|
||||
@ -741,8 +854,6 @@ def updateWeather(api_key, logf):
|
||||
if location in daily_locations:
|
||||
daily_weathers[location] = daily_weather
|
||||
|
||||
|
||||
|
||||
all_current_settings['locations'] = current_weathers
|
||||
all_daily_settings['locations'] = daily_weathers
|
||||
f = open("csv/current_weather.json", 'w+')
|
||||
@ -791,21 +902,46 @@ def updateLeagueTables(api_key, logf):
|
||||
|
||||
all_data = r.json()
|
||||
|
||||
|
||||
|
||||
for i,l in enumerate(all_data):
|
||||
|
||||
league = list(l.keys())[0]
|
||||
|
||||
|
||||
teams = []
|
||||
|
||||
|
||||
if league == 'pga' or league == 'lpga':
|
||||
logo_files = []
|
||||
for d in all_data[i][league]:
|
||||
del d['_id'], d['updated']
|
||||
teams.append(d)
|
||||
try:
|
||||
if d['country'].split('/')[-1].split('&')[0] not in os.listdir('logos/ufc_countries/'):
|
||||
urllib.request.urlretrieve(d['country'], 'logos/ufc_countries/' + d['country'].split('/')[-1].split('&')[0])
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if league == 'pga':
|
||||
if d['photo'].split('/')[-1].split('&')[0] not in os.listdir('logos/pga_rank/'):
|
||||
urllib.request.urlretrieve(d['photo'],'logos/pga_rank/' + d['photo'].split('/')[-1].split('&')[0])
|
||||
elif league == 'lpga':
|
||||
if d['photo'].split('/')[-1] not in os.listdir('logos/lpga_rank/'):
|
||||
urllib.request.urlretrieve(d['photo'],'logos/lpga_rank/' + d['photo'].split('/')[-1])
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if league == 'pga':
|
||||
logo_files.append(d['photo'].split('/')[-1].split('&')[0])
|
||||
elif league == 'lpga':
|
||||
logo_files.append(d['photo'].split('/')[-1])
|
||||
except:
|
||||
pass
|
||||
if league == 'pga':
|
||||
for file in os.listdir('logos/pga_rank/'):
|
||||
if file not in logo_files:
|
||||
os.remove('logos/pga_rank/'+ file)
|
||||
elif league == 'lpga':
|
||||
for file in os.listdir('logos/lpga_rank/'):
|
||||
if file not in logo_files:
|
||||
os.remove('logos/lpga_rank/'+ file)
|
||||
else:
|
||||
for d in all_data[i][league]:
|
||||
team = {}
|
||||
|
||||
|
||||
|
||||
team['name'] = d['strTeam']
|
||||
team['wins'] = d['intWin']
|
||||
team['loss'] = d['intLoss']
|
||||
@ -813,8 +949,8 @@ def updateLeagueTables(api_key, logf):
|
||||
#team['played'] = d['intPlayed']
|
||||
team['standing'] = d['intRank']
|
||||
#team['points'] = d['intPoints']
|
||||
|
||||
teams.append(team)
|
||||
|
||||
leagues_info[league.upper()] = teams
|
||||
|
||||
all_settings['leagues'] = leagues_info
|
||||
@ -1041,6 +1177,12 @@ def updateLeagueEvents(api_key, time, logf):
|
||||
event['date2'] = d['dateEvent2']
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
event['total_yards'] = d['total_yards']
|
||||
event['shots_par'] = d['shots_par']
|
||||
event['purse'] = d['purse']
|
||||
except:
|
||||
pass
|
||||
event['event'] = d['strEvent'].replace("\u2019","'")
|
||||
event['venue'] = d['strVenue'].replace("\u2019","'")
|
||||
event['city'] = d['strCity'].replace("\u2019","'")
|
||||
@ -1054,94 +1196,103 @@ def updateLeagueEvents(api_key, time, logf):
|
||||
|
||||
if time != 'upcoming':
|
||||
if (league == 'PGA') or (league == 'LPGA') or (league == 'PGA_EU'):
|
||||
event['golf_standings'] = d['strResult']
|
||||
|
||||
rank = ['n1', 'n2', 'n3', 'n4', 'n5', 'n6', 'n7', 'n8', 'n9', 'n10', 'T1', 'T2', 'T3', 'T4', 'T5',
|
||||
'T6', 'T7', 'T8', 'T9', 'T10']
|
||||
|
||||
def convert(string):
|
||||
string = repr(string).replace('/', '')
|
||||
li = list(string.split('\\'))
|
||||
return li
|
||||
|
||||
str3 = convert(event['golf_standings'])
|
||||
|
||||
players = []
|
||||
|
||||
|
||||
for each in str3:
|
||||
each = each.replace('nT', 'T', 1)
|
||||
if each[:2] in rank:
|
||||
# event['golf_standings'] = d['strResult']
|
||||
event['golf_rankings'] = d['player_results']
|
||||
for player in event['golf_rankings']:
|
||||
try:
|
||||
first_space = each.find(' ', 1)
|
||||
second_space = each.find(' ', 4)
|
||||
first_name = each[first_space:second_space].lstrip()
|
||||
initial = first_name[0] + '.'
|
||||
each = each.replace(first_name,initial)
|
||||
if player['country'].split('/')[-1].split('&')[0] not in os.listdir('logos/ufc_countries/'):
|
||||
urllib.request.urlretrieve(player['country'], 'logos/ufc_countries/' + player['country'].split('/')[-1].split('&')[0])
|
||||
except:
|
||||
pass
|
||||
interator = each.find('-')
|
||||
if interator < 0:
|
||||
interator = 0
|
||||
interator2 = each[interator:interator + 3]
|
||||
result = each.split(interator2, 1)[0] + interator2
|
||||
players.append(result.rstrip())
|
||||
# rank = ['n1', 'n2', 'n3', 'n4', 'n5', 'n6', 'n7', 'n8', 'n9', 'n10', 'T1', 'T2', 'T3', 'T4', 'T5',
|
||||
# 'T6', 'T7', 'T8', 'T9', 'T10']
|
||||
# def convert(string):
|
||||
# string = repr(string).replace('/', '')
|
||||
# li = list(string.split('\\'))
|
||||
# return li
|
||||
|
||||
event['golf_standings'] = players
|
||||
# str3 = convert(event['golf_standings'])
|
||||
|
||||
# players = []
|
||||
|
||||
|
||||
# for each in str3:
|
||||
# each = each.replace('nT', 'T', 1)
|
||||
# if each[:2] in rank:
|
||||
# try:
|
||||
# first_space = each.find(' ', 1)
|
||||
# second_space = each.find(' ', 4)
|
||||
# first_name = each[first_space:second_space].lstrip()
|
||||
# initial = first_name[0] + '.'
|
||||
# each = each.replace(first_name,initial)
|
||||
# except:
|
||||
# pass
|
||||
# interator = each.find('-')
|
||||
# if interator < 0:
|
||||
# interator = 0
|
||||
# interator2 = each[interator:interator + 3]
|
||||
# result = each.split(interator2, 1)[0] + interator2
|
||||
# players.append(result.rstrip())
|
||||
|
||||
# event['golf_standings'] = players
|
||||
|
||||
|
||||
elif (league == 'LIV'):
|
||||
event['golf_standings'] = d['strResult']
|
||||
|
||||
rank = ['n1', 'n2', 'n3', 'n4', 'n5', 'n6', 'n7', 'n8', 'n9', 'n10', 'T1', 'T2', 'T3', 'T4', 'T5',
|
||||
'T6', 'T7', 'T8', 'T9', 'T10']
|
||||
|
||||
def convert(string):
|
||||
string = repr(string).replace('/', '')
|
||||
li = list(string.split('\\'))
|
||||
return li
|
||||
|
||||
# event['golf_standings'] = d['strResult']
|
||||
event['golf_rankings'] = d['player_results']
|
||||
for player in event['golf_rankings']:
|
||||
try:
|
||||
str3 = convert(event['golf_standings'].split('--------------------------------------')[0])
|
||||
strTeams = convert(event['golf_standings'].split('--------------------------------------')[1])
|
||||
if player['country'].split('/')[-1].split('&')[0] not in os.listdir('logos/ufc_countries/'):
|
||||
urllib.request.urlretrieve(player['country'], 'logos/ufc_countries/' + player['country'].split('/')[-1].split('&')[0])
|
||||
except:
|
||||
pass
|
||||
# rank = ['n1', 'n2', 'n3', 'n4', 'n5', 'n6', 'n7', 'n8', 'n9', 'n10', 'T1', 'T2', 'T3', 'T4', 'T5',
|
||||
# 'T6', 'T7', 'T8', 'T9', 'T10']
|
||||
# def convert(string):
|
||||
# string = repr(string).replace('/', '')
|
||||
# li = list(string.split('\\'))
|
||||
# return li
|
||||
|
||||
players = []
|
||||
teams = []
|
||||
# try:
|
||||
# str3 = convert(event['golf_standings'].split('--------------------------------------')[0])
|
||||
# strTeams = convert(event['golf_standings'].split('--------------------------------------')[1])
|
||||
# except:
|
||||
# pass
|
||||
|
||||
try:
|
||||
for each in str3:
|
||||
each = each.replace('nT', 'T', 1)
|
||||
if each[:2] in rank:
|
||||
try:
|
||||
first_space = each.find(' ', 1)
|
||||
second_space = each.find(' ', 4)
|
||||
first_name = each[first_space:second_space].lstrip()
|
||||
initial = first_name[0] + '.'
|
||||
each = each.replace(first_name,initial)
|
||||
except:
|
||||
pass
|
||||
interator = each.find('-')
|
||||
if interator < 0:
|
||||
interator = 0
|
||||
interator2 = each[interator:interator + 3]
|
||||
result = each.split(interator2, 1)[0] + interator2
|
||||
players.append(result.rstrip())
|
||||
# players = []
|
||||
# teams = []
|
||||
|
||||
for each in strTeams:
|
||||
each = each.replace('nT', 'T', 1)
|
||||
if each[:2] in rank:
|
||||
each = each.split('GC')
|
||||
score = each[1].rfind(' ')
|
||||
score2 = each[1][score:score+4]
|
||||
each2 = each[0] + score2
|
||||
teams.append(each2)
|
||||
except:
|
||||
pass
|
||||
# try:
|
||||
# for each in str3:
|
||||
# each = each.replace('nT', 'T', 1)
|
||||
# if each[:2] in rank:
|
||||
# try:
|
||||
# first_space = each.find(' ', 1)
|
||||
# second_space = each.find(' ', 4)
|
||||
# first_name = each[first_space:second_space].lstrip()
|
||||
# initial = first_name[0] + '.'
|
||||
# each = each.replace(first_name,initial)
|
||||
# except:
|
||||
# pass
|
||||
# interator = each.find('-')
|
||||
# if interator < 0:
|
||||
# interator = 0
|
||||
# interator2 = each[interator:interator + 3]
|
||||
# result = each.split(interator2, 1)[0] + interator2
|
||||
# players.append(result.rstrip())
|
||||
|
||||
event['golf_standings'] = [players] + [teams]
|
||||
# for each in strTeams:
|
||||
# each = each.replace('nT', 'T', 1)
|
||||
# if each[:2] in rank:
|
||||
# each = each.split('GC')
|
||||
# score = each[1].rfind(' ')
|
||||
# score2 = each[1][score:score+4]
|
||||
# each2 = each[0] + score2
|
||||
# teams.append(each2)
|
||||
# except:
|
||||
# pass
|
||||
|
||||
# event['golf_standings'] = [players] + [teams]
|
||||
else:
|
||||
event['away_score'] = d['intAwayScore']
|
||||
event['home_score'] = d['intHomeScore']
|
||||
|
6
logos/lpga_rank/blank.rtf
Normal file
6
logos/lpga_rank/blank.rtf
Normal file
@ -0,0 +1,6 @@
|
||||
{\rtf1\ansi\ansicpg1252\cocoartf2513
|
||||
\cocoatextscaling0\cocoaplatform0{\fonttbl}
|
||||
{\colortbl;\red255\green255\blue255;}
|
||||
{\*\expandedcolortbl;;}
|
||||
\margl1440\margr1440\vieww10800\viewh8400\viewkind0
|
||||
}
|
6
logos/pga_rank/blank.rtf
Normal file
6
logos/pga_rank/blank.rtf
Normal file
@ -0,0 +1,6 @@
|
||||
{\rtf1\ansi\ansicpg1252\cocoartf2513
|
||||
\cocoatextscaling0\cocoaplatform0{\fonttbl}
|
||||
{\colortbl;\red255\green255\blue255;}
|
||||
{\*\expandedcolortbl;;}
|
||||
\margl1440\margr1440\vieww10800\viewh8400\viewkind0
|
||||
}
|
BIN
logos/sports/league_logos/lpga_1.png
Normal file
BIN
logos/sports/league_logos/lpga_1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
logos/sports/league_logos/pga_1.png
Normal file
BIN
logos/sports/league_logos/pga_1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
66
server.py
66
server.py
@ -146,8 +146,8 @@ def index():
|
||||
not_displaying = [f for f in all_features if f not in currently_displaying[0]]
|
||||
not_displaying2 = [f for f in all_features if f not in currently_displaying[1]]
|
||||
|
||||
with open('api_keys.txt', 'r') as f:
|
||||
api_key2 = f.readlines()
|
||||
# with open('api_keys.txt', 'r') as f:
|
||||
# api_key2 = f.readlines()
|
||||
|
||||
try:
|
||||
with open('movie_api_key.txt', 'r') as f:
|
||||
@ -248,10 +248,10 @@ def index():
|
||||
except:
|
||||
scheduler_settings = {"shutdown": {"hour": "00", "minute": "00", "enabled": False}, "reboot":{"hour": "00", "minute": "00", "enabled": False}, "timezone": "GMT", "brightness1":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "brightness2":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "brightness3":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "brightness4":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}}
|
||||
|
||||
try: # incase this doesnt exist
|
||||
api_keys = api_key2[1]
|
||||
except:
|
||||
api_keys = ''
|
||||
# try: # incase this doesnt exist
|
||||
# api_keys = api_key2[1]
|
||||
# except:
|
||||
# api_keys = ''
|
||||
|
||||
try:
|
||||
movie_api_key = movie_api[0]
|
||||
@ -299,7 +299,6 @@ def index():
|
||||
'message_settings':message_settings,
|
||||
'professional':professional,
|
||||
'general_settings':general_settings,
|
||||
'api_keys':api_keys,
|
||||
'movie_api_key':movie_api_key,
|
||||
'ipo_api_key':ipo_api_key,
|
||||
'wifi_SSID':wifi_SSID,
|
||||
@ -755,25 +754,25 @@ def hostname():
|
||||
return index()
|
||||
|
||||
|
||||
@app.route("/saveWeatherAPIKey", methods = ['PUT', 'POST'])
|
||||
def saveWeatherAPIKey():
|
||||
# @app.route("/saveWeatherAPIKey", methods = ['PUT', 'POST'])
|
||||
# def saveWeatherAPIKey():
|
||||
|
||||
data= request.data.decode('utf-8')
|
||||
settings = json.loads(data)
|
||||
# data= request.data.decode('utf-8')
|
||||
# settings = json.loads(data)
|
||||
|
||||
key = settings['api_key']
|
||||
# key = settings['api_key']
|
||||
|
||||
with open('./api_keys.txt') as f:
|
||||
lines = f.readlines()
|
||||
if len(lines) == 1:
|
||||
lines.append(str(key))
|
||||
elif len(lines) == 2:
|
||||
lines[1] = str(key)
|
||||
# with open('./api_keys.txt') as f:
|
||||
# lines = f.readlines()
|
||||
# if len(lines) == 1:
|
||||
# lines.append(str(key))
|
||||
# elif len(lines) == 2:
|
||||
# lines[1] = str(key)
|
||||
|
||||
with open('./api_keys.txt', 'w') as f:
|
||||
for line in lines:
|
||||
f.write(line)
|
||||
return index()
|
||||
# with open('./api_keys.txt', 'w') as f:
|
||||
# for line in lines:
|
||||
# f.write(line)
|
||||
# return index()
|
||||
|
||||
|
||||
|
||||
@ -1334,6 +1333,29 @@ def saveSchedulerSettings():
|
||||
return index()
|
||||
|
||||
|
||||
@app.route("/setTop20or10", methods = ['PUT', 'POST'])
|
||||
def setTop20or10():
|
||||
|
||||
data= request.data.decode('utf-8')
|
||||
input_settings = json.loads(data)
|
||||
|
||||
with open('csv/league_tables.json','r') as f:
|
||||
league_settings = json.load(f)
|
||||
|
||||
if input_settings == 'Top 20':
|
||||
input_settings = 20
|
||||
elif input_settings == 'Top 10':
|
||||
input_settings = 10
|
||||
else:
|
||||
input_settings = 20
|
||||
|
||||
league_settings['top20'] = input_settings
|
||||
|
||||
f = open('csv/league_tables.json', 'w')
|
||||
json.dump(league_settings, f)
|
||||
f.close()
|
||||
|
||||
return index()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -28,10 +28,10 @@ echo '{"feature": "Stocks", "speed": "medium","speed2": "medium", "animation": "
|
||||
|
||||
echo '{"feature": "Stocks", "speed": "fast", "speed2": "fast", "animation": "down", "percent": true, "point": true, "logos": true, "chart": false, "title": true, "symbols": {"BRENTOIL": {"current": "123.053", "unit": "bbl", "24hr_change": "1.0150", "percent_change": "0.83"}, "WTIOIL": {"current": "121.588", "unit": "bbl", "24hr_change": "0.8902", "percent_change": "0.74"}, "XAU": {"current": "1821.205", "unit": "oz", "24hr_change": "4.0045", "percent_change": "0.22"}, "XAG": {"current": "21.1034", "unit": "oz", "24hr_change": "-0.0550", "percent_change": "-0.26"}, "XCU": {"current": "0.2633", "unit": "oz", "24hr_change": "-0.0006", "percent_change": "-0.22"}, "NG": {"current": "8.6595", "unit": "mmbtu", "24hr_change": "-0.0236", "percent_change": "-0.27"}, "WHEAT": {"current": "393.123", "unit": "ton", "24hr_change": "-1.2642", "percent_change": "-0.32"}, "COTTON": {"current": "1.4494", "unit": "lb", "24hr_change": "0.0004", "percent_change": "0.03"}, "RICE": {"current": "16.3849", "unit": "cwt", "24hr_change": "0.0093", "percent_change": "0.06"}, "SUGAR": {"current": "0.1866", "unit": "lb", "24hr_change": "-0.0007", "percent_change": "-0.40"}, "COCOA": {"current": "2374.074", "unit": "ton", "24hr_change": "2.5206", "percent_change": "0.11"}, "LUMBER": {"current": "527.842", "unit": "oz", "24hr_change": "0.2641", "percent_change": "0.05"}, "SOYBEAN": {"current": "17.1621", "unit": "bu", "24hr_change": "0.0270", "percent_change": "0.16"}}}' >> commodities_settings.json
|
||||
echo '{"feature": "Stocks", "speed": "fast", "speed2": "slow", "animation": "up", "percent": true, "point": true, "logos": true, "chart": false, "title": true, "symbols": {"^HSI": {"name": "HSI", "current": "18083.06", "point_change": "1003.55", "percent_change": "5.88"}, "^GSPC": {"name": "S&P 500", "current": "3790.93", "point_change": "112.50", "percent_change": "3.06"}, "^RUT": {"name": "RUSSELL 2000", "current": "1775.77", "point_change": "66.90", "percent_change": "3.91"}, "^GDAXI": {"name": "DAX", "current": "12648.95", "point_change": "-21.53", "percent_change": "-0.17"}, "^FTSE": {"name": "FTSE 100", "current": "7058.68", "point_change": "-27.82", "percent_change": "-0.39"}, "^FCHI": {"name": "CAC 40", "current": "6031.45", "point_change": "-8.24", "percent_change": "-0.14"}, "399001.SZ": {"name": "SZSE", "current": "10778.61", "point_change": "-140.83", "percent_change": "-1.29"}, "^STOXX50E": {"name": "STOXX 50", "current": "3476.55", "point_change": "-7.93", "percent_change": "-0.23"}, "^AXJO": {"name": "ASX 200", "current": "6815.70", "point_change": "116.40", "percent_change": "1.74"}, "^DJI": {"name": "DOW JONES", "current": "30316.32", "point_change": "825.43", "percent_change": "2.80"}, "^STOXX": {"name": "STOXX 600", "current": "402.33", "point_change": "-0.70", "percent_change": "-0.17"}}}' >> indices_settings.json
|
||||
echo '{"feature": "Sports (Team Stats)", "speed": "medium", "speed2": "medium","animation": "down", "title": true, "leagues": {}}' >> league_tables.json
|
||||
echo {\"feature\": \"Current Weather\", \"speed\": \"medium\", \"animation\": \"down\", \"temp\": \"celsius\", \"wind_speed\": \"miles/sec\", \"colour\": \"white\", \"city_colour\": \"yellow\", \"title\": true, \"locations\": {}, \"current_weather\": true} >> current_weather.json
|
||||
echo '{"feature": "Sports (Team Stats)", "speed": "medium", "speed2": "medium","animation": "down", "title": true, "top20": 20, "leagues": {}}' >> league_tables.json
|
||||
echo {\"feature\": \"Current Weather\", \"speed\": \"medium\", \"animation\": \"down\", \"temp\": \"celsius\", \"wind_speed\": \"miles/hour\", \"colour\": \"white\", \"city_colour\": \"yellow\", \"title\": true, \"locations\": {}, \"current_weather\": true} >> current_weather.json
|
||||
echo '{"feature": "Stocks", "speed": "medium", "speed2": "medium", "animation": "down", "percent": false, "point": true, "logos": true, "chart": false, "title": true, "symbols": {"AAPL": {"current": "164.02", "change": "-1.59", "percent_change": "-0.97"}, "MSFT": {"current": "288.29", "change": "-1.32", "percent_change": "-0.46"}, "GOOG": {"current": "2586.74", "change": "-34.01", "percent_change": "-1.31"}, "NFLX": {"current": "380.52", "change": "-7.59", "percent_change": "-1.99"}}, "prepost": false}' >> stocks_settings.json
|
||||
echo {\"feature\": \"Current Weather\", \"speed\": \"medium\", \"animation\": \"down\", \"temp\": \"celsius\", \"wind_speed\": \"miles/sec\", \"colour\": \"white\", \"city_colour\": \"yellow\", \"title\": true, \"locations\": {}, \"current_weather\": true} >> daily_weather.json
|
||||
echo {\"feature\": \"Current Weather\", \"speed\": \"medium\", \"animation\": \"down\", \"temp\": \"celsius\", \"wind_speed\": \"miles/hour\", \"colour\": \"white\", \"city_colour\": \"yellow\", \"title\": true, \"locations\": {}, \"current_weather\": true} >> daily_weather.json
|
||||
echo '{"feature": "Sports (Live Games)", "speed": "medium", "speed2": "medium", "animation": "down", "title": true, "leagues": {}}' >> live_games.json
|
||||
echo '{"feature": "Sports (Live Games)", "speed": "medium", "speed2": "medium", "animation": "down", "title": true, "leagues": {"MLB": [[{"home_team": "Columbus Blue Jackets", "home_score": "4", "away_team": "Buffalo Sabres", "away_score": "9", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Philadelphia Flyers", "home_score": "1", "away_team": "Washington Capitals", "away_score": "4", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Calgary Flames", "home_score": "5", "away_team": "Minnesota Wild", "away_score": "3", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Colorado Avalanche", "home_score": "0", "away_team": "Boston Bruins", "away_score": "4", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Edmonton Oilers", "home_score": "8", "away_team": "Arizona Coyotes", "away_score": "2", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Vegas Golden Knights", "home_score": "1", "away_team": "New York Rangers", "away_score": "5", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "San Jose Sharks", "home_score": "5", "away_team": "Vancouver Canucks", "away_score": "6", "time": "Final/OT", "date": "2022-12-08", "isLive": "post"}], false, "no_live", "no_upcoming"]}}' >> live_mlb.json
|
||||
echo '{"feature": "Sports (Live Games)", "speed": "medium", "speed2": "medium", "animation": "down", "title": true, "leagues": {"MLS": [[{"home_team": "Columbus Blue Jackets", "home_score": "4", "away_team": "Buffalo Sabres", "away_score": "9", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Philadelphia Flyers", "home_score": "1", "away_team": "Washington Capitals", "away_score": "4", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Calgary Flames", "home_score": "5", "away_team": "Minnesota Wild", "away_score": "3", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Colorado Avalanche", "home_score": "0", "away_team": "Boston Bruins", "away_score": "4", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Edmonton Oilers", "home_score": "8", "away_team": "Arizona Coyotes", "away_score": "2", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "Vegas Golden Knights", "home_score": "1", "away_team": "New York Rangers", "away_score": "5", "time": "Final", "date": "2022-12-08", "isLive": "post"}, {"home_team": "San Jose Sharks", "home_score": "5", "away_team": "Vancouver Canucks", "away_score": "6", "time": "Final/OT", "date": "2022-12-08", "isLive": "post"}], false, "no_live", "no_upcoming"]}}' >> live_mls.json
|
||||
|
144
static/app.js
144
static/app.js
@ -1252,14 +1252,12 @@ function getWeatherSettings(page) {
|
||||
let speed = getSelected(page.querySelectorAll(".wind-speed-select")[0]);
|
||||
|
||||
let title = page.querySelectorAll(".title-select")[0].checked;
|
||||
let api_key = page.querySelectorAll(".api-key")[0];
|
||||
|
||||
let
|
||||
settings = {
|
||||
temp: temp,
|
||||
wind_speed: speed,
|
||||
title: title,
|
||||
api_key:api_key
|
||||
};
|
||||
|
||||
//only for daily weather
|
||||
@ -1276,45 +1274,45 @@ function getWeatherSettings(page) {
|
||||
return settings;
|
||||
}
|
||||
|
||||
function saveWeatherAPIKey(){
|
||||
let featureSelector = document.getElementById("drop");
|
||||
feature = getSelected(featureSelector);
|
||||
let features = [
|
||||
"Stocks",
|
||||
"Crypto",
|
||||
"Forex",
|
||||
"Current Weather",
|
||||
"Daily Forecast",
|
||||
"News",
|
||||
"Sports (Upcoming Games)",
|
||||
"Sports (Past Games)",
|
||||
"Sports (Live Games)",
|
||||
"Sports (Team Stats)",
|
||||
"Custom Images",
|
||||
"Custom GIFs",
|
||||
"Custom Messages",
|
||||
"Commodities",
|
||||
"Indices",
|
||||
"Movies",
|
||||
"IPO Calendar",
|
||||
];
|
||||
let pageNum = features.indexOf(feature) + 1;
|
||||
let pageSelector = "Page" + pageNum.toString();
|
||||
// function saveWeatherAPIKey(){
|
||||
// let featureSelector = document.getElementById("drop");
|
||||
// feature = getSelected(featureSelector);
|
||||
// let features = [
|
||||
// "Stocks",
|
||||
// "Crypto",
|
||||
// "Forex",
|
||||
// "Current Weather",
|
||||
// "Daily Forecast",
|
||||
// "News",
|
||||
// "Sports (Upcoming Games)",
|
||||
// "Sports (Past Games)",
|
||||
// "Sports (Live Games)",
|
||||
// "Sports (Team Stats)",
|
||||
// "Custom Images",
|
||||
// "Custom GIFs",
|
||||
// "Custom Messages",
|
||||
// "Commodities",
|
||||
// "Indices",
|
||||
// "Movies",
|
||||
// "IPO Calendar",
|
||||
// ];
|
||||
// let pageNum = features.indexOf(feature) + 1;
|
||||
// let pageSelector = "Page" + pageNum.toString();
|
||||
|
||||
let page = document.getElementById(pageSelector);
|
||||
// let page = document.getElementById(pageSelector);
|
||||
|
||||
let api_key = page.querySelectorAll(".api-key")[0].value;
|
||||
let settings = {
|
||||
api_key:api_key
|
||||
};
|
||||
// let api_key = page.querySelectorAll(".api-key")[0].value;
|
||||
// let settings = {
|
||||
// api_key:api_key
|
||||
// };
|
||||
|
||||
console.log(settings);
|
||||
// console.log(settings);
|
||||
|
||||
fetch("/saveWeatherAPIKey", {
|
||||
method: "POST",
|
||||
body: JSON.stringify(settings),
|
||||
});
|
||||
}
|
||||
// fetch("/saveWeatherAPIKey", {
|
||||
// method: "POST",
|
||||
// body: JSON.stringify(settings),
|
||||
// });
|
||||
// }
|
||||
|
||||
|
||||
function saveMovieAPIKey(){
|
||||
@ -1404,8 +1402,8 @@ ipoAPIbtn.addEventListener("click", saveIpoAPIKey);
|
||||
var movieAPIbtn = document.getElementById("movie-api-btn");
|
||||
movieAPIbtn.addEventListener("click", saveMovieAPIKey);
|
||||
|
||||
var weatherAPIbtn = document.getElementById("weather-api-btn");
|
||||
weatherAPIbtn.addEventListener("click", saveWeatherAPIKey);
|
||||
// var weatherAPIbtn = document.getElementById("weather-api-btn");
|
||||
// weatherAPIbtn.addEventListener("click", saveWeatherAPIKey);
|
||||
|
||||
function getNewsSettings(page) {
|
||||
|
||||
@ -1879,22 +1877,22 @@ function showDivTwo() {
|
||||
|
||||
// Display message asking for restart of ticker when new API key added for weather
|
||||
|
||||
function showWeatherP() {
|
||||
if(document.getElementById("api-key1").value==="") {
|
||||
// function showWeatherP() {
|
||||
// if(document.getElementById("api-key1").value==="") {
|
||||
|
||||
document.getElementById('weather-api-p').style.display = "none";
|
||||
}
|
||||
// document.getElementById('weather-api-p').style.display = "none";
|
||||
// }
|
||||
|
||||
else if (document.getElementById("api-key1").value==="Weather API Key") {
|
||||
document.getElementById('weather-api-p').style.display = "none";
|
||||
// else if (document.getElementById("api-key1").value==="Weather API Key") {
|
||||
// document.getElementById('weather-api-p').style.display = "none";
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
else {
|
||||
document.getElementById('weather-api-p').style.display = "block"
|
||||
}
|
||||
// else {
|
||||
// document.getElementById('weather-api-p').style.display = "block"
|
||||
// }
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
// Display message asking for restart of ticker when new API key added for movie
|
||||
@ -1939,32 +1937,32 @@ function showIpoP() {
|
||||
// Disable adding cities when no API key detected
|
||||
|
||||
|
||||
if(document.getElementById("api-key1").value==="") {
|
||||
document.getElementById('inputTextBtn6').disabled = true;
|
||||
}
|
||||
// if(document.getElementById("api-key1").value==="") {
|
||||
// document.getElementById('inputTextBtn6').disabled = true;
|
||||
// }
|
||||
|
||||
else if (document.getElementById("api-key1").value==="Weather API Key") {
|
||||
document.getElementById('inputTextBtn6').disabled = true;
|
||||
}
|
||||
// else if (document.getElementById("api-key1").value==="Weather API Key") {
|
||||
// document.getElementById('inputTextBtn6').disabled = true;
|
||||
// }
|
||||
|
||||
else {
|
||||
document.getElementById('inputTextBtn6').disabled = false;
|
||||
}
|
||||
// else {
|
||||
// document.getElementById('inputTextBtn6').disabled = false;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
if(document.getElementById("api-key").value==="") {
|
||||
document.getElementById('inputTextBtn7').disabled = true;
|
||||
}
|
||||
// if(document.getElementById("api-key").value==="") {
|
||||
// document.getElementById('inputTextBtn7').disabled = true;
|
||||
// }
|
||||
|
||||
else if (document.getElementById("api-key").value==="Weather API Key") {
|
||||
document.getElementById('inputTextBtn7').disabled = true;
|
||||
}
|
||||
// else if (document.getElementById("api-key").value==="Weather API Key") {
|
||||
// document.getElementById('inputTextBtn7').disabled = true;
|
||||
// }
|
||||
|
||||
else {
|
||||
document.getElementById('inputTextBtn7').disabled = false;
|
||||
}
|
||||
// else {
|
||||
// document.getElementById('inputTextBtn7').disabled = false;
|
||||
// }
|
||||
|
||||
|
||||
// Stocks validation
|
||||
@ -2695,3 +2693,13 @@ function saveSchedulerSettings() {
|
||||
document.getElementById('saved').style.display = "block";
|
||||
}
|
||||
|
||||
|
||||
// CHANGE TOP 20 OR TOP 10 WORLD GOLF RANKING
|
||||
function setTop20() {
|
||||
let top20 = document.getElementById("golf-ranking-number").value;
|
||||
fetch("/setTop20or10", {
|
||||
method: "POST",
|
||||
body: JSON.stringify(top20),
|
||||
});
|
||||
}
|
||||
|
||||
|
780
stockTicker.py
780
stockTicker.py
File diff suppressed because it is too large
Load Diff
@ -1,73 +1,45 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
|
||||
<meta charset="UTF-8" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
|
||||
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
|
||||
|
||||
<meta http-equiv="Pragma" content="no-cache" />
|
||||
|
||||
<meta http-equiv="Expires" content="0" />
|
||||
|
||||
<title>Fintic - Web Control Panel</title>
|
||||
|
||||
<link rel="icon" type="image/png" href="/static/images/favicon.png">
|
||||
|
||||
<!-- Bootstrap 5 CDN Links -->
|
||||
|
||||
<script
|
||||
|
||||
src="{{ url_for('static', filename='bootstrap/js/bootstrap.bundle.min.js') }}"
|
||||
|
||||
></script>
|
||||
|
||||
<link
|
||||
|
||||
href="{{ url_for('static', filename='bootstrap/css/bootstrap.min.css') }}"
|
||||
|
||||
rel="stylesheet"
|
||||
|
||||
/>
|
||||
|
||||
|
||||
|
||||
<!-- Fontawesome - for icons -->
|
||||
|
||||
<link
|
||||
|
||||
rel="stylesheet"
|
||||
|
||||
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css"
|
||||
|
||||
integrity="sha512-+4zCK9k+qNFUR5X+cKL9EIR+ZOhtIloNl9GIKS57V1MyNsYpYcUrUeQc9vNfzsWfV28IaLL3i96P9sdNyeRssA=="
|
||||
|
||||
crossorigin="anonymous"
|
||||
|
||||
/>
|
||||
|
||||
<link
|
||||
|
||||
rel="stylesheet"
|
||||
|
||||
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/fontawesome.min.css"
|
||||
|
||||
integrity="sha512-kJ30H6g4NGhWopgdseRb8wTsyllFUYIx3hiUwmGAkgA9B/JbzUBDQVr2VVlWGde6sdBVOG7oU8AL35ORDuMm8g=="
|
||||
|
||||
crossorigin="anonymous"
|
||||
|
||||
/>
|
||||
|
||||
|
||||
|
||||
<!-- CSS Stylesheet linking -->
|
||||
|
||||
<!-- <link href="{{ url_for('static', filename='style.css') }}" type="text/css" rel="stylesheet" /> ALWAYS CHANGE VERSIONING WHENEVER CHANGES ARE MADE TO AVOID BAD CACHING -->
|
||||
<link rel="stylesheet" type="text/css" href="../static/style.css?ver=1.3.4"/>
|
||||
<link rel="stylesheet" type="text/css" href="../static/style.css?ver=1.3.5"/>
|
||||
|
||||
</head>
|
||||
|
||||
@ -127,7 +99,7 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<p class="text-white" id="version-text">Version 1.3.4</p>
|
||||
<p class="text-white" id="version-text">Version 1.3.5</p>
|
||||
<p class="text-white" id="version-text"><a href="https://docs.google.com/document/d/1TzvukZv_0Pd3TUM6Xe2wEkymn9uIT2qXUBFnMCQwp5g/edit?usp=sharing" target="_blank" id="footerlinks">Changelog</a></p>
|
||||
</nav>
|
||||
|
||||
@ -4054,43 +4026,25 @@
|
||||
|
||||
|
||||
|
||||
<div class="row g-3 align-items-center mt-3">
|
||||
|
||||
<!-- <div class="row g-3 align-items-center mt-3">
|
||||
<div class="col-auto">
|
||||
|
||||
<label for="inputText" class="col-form-label">API Key: </label>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-auto">
|
||||
|
||||
<input
|
||||
|
||||
type="text"
|
||||
|
||||
id="api-key1"
|
||||
|
||||
placeholder="Weather API Key"
|
||||
|
||||
class="form-control api-key"
|
||||
|
||||
aria-describedby="TextHelpInline"
|
||||
|
||||
value="{{ api_keys }}"
|
||||
|
||||
/>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-auto">
|
||||
|
||||
<button id="weather-api-btn" class="btn set-btn" onClick="showWeatherP()">Add</button>
|
||||
|
||||
</div>
|
||||
|
||||
<p id="weather-api-p" style="display: none">New weather API key detected, please restart the ticker in order for the feature to work properly.</p>
|
||||
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
</div>
|
||||
|
||||
@ -4510,41 +4464,23 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row g-3 align-items-center mt-3">
|
||||
|
||||
<!-- <div class="row g-3 align-items-center mt-3">
|
||||
<div class="col-auto">
|
||||
|
||||
<label for="inputText" class="col-form-label">API Key: </label>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-auto">
|
||||
|
||||
<input
|
||||
|
||||
type="text"
|
||||
|
||||
id="api-key"
|
||||
|
||||
placeholder="Weather API Key"
|
||||
|
||||
class="form-control api-key"
|
||||
|
||||
aria-describedby="TextHelpInline"
|
||||
|
||||
value="{{ api_keys }}"
|
||||
|
||||
/>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-auto">
|
||||
|
||||
<!-- <button id="weather-api-btn" class="btn set-btn">Add</button> -->
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
</div>
|
||||
|
||||
@ -6181,17 +6117,10 @@
|
||||
<div class="col-auto">
|
||||
|
||||
<select
|
||||
|
||||
id="inputScrollSpeedRow10"
|
||||
|
||||
class="form-select speed-select"
|
||||
|
||||
>
|
||||
|
||||
class="form-select speed-select">
|
||||
<option {%if team_stats.speed2 == 'medium' %} selected {% endif %}>Medium</option>
|
||||
|
||||
<option {%if team_stats.speed2 == 'slow' %} selected {% endif %}>Slow</option>
|
||||
|
||||
<option {%if team_stats.speed2 == 'fast' %} selected {% endif %}>Fast</option>
|
||||
|
||||
</select>
|
||||
@ -6220,14 +6149,10 @@
|
||||
|
||||
id="inputTransition10"
|
||||
|
||||
class="form-select animation-select"
|
||||
|
||||
>
|
||||
class="form-select animation-select">
|
||||
|
||||
<option {%if team_stats.animation == 'down' %} selected {% endif %}>Down</option>
|
||||
|
||||
<option {%if team_stats.animation == 'up' %} selected {% endif %}>Up</option>
|
||||
|
||||
<option {%if team_stats.animation == 'continuous' %} selected {% endif %}>Continuous</option>
|
||||
|
||||
</select>
|
||||
@ -6239,50 +6164,53 @@
|
||||
|
||||
|
||||
<div class="row g-3 align-items-center mt-3">
|
||||
|
||||
<div class="col-auto">
|
||||
|
||||
<label for="inputTransition103Z" class="col-form-label"
|
||||
|
||||
>Sport League:
|
||||
|
||||
</label>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-auto">
|
||||
|
||||
<select id="inputTransition103" class="form-select">
|
||||
|
||||
<option>NFL</option>
|
||||
|
||||
<option>NBA</option>
|
||||
|
||||
<option>NHL</option>
|
||||
|
||||
<option>PREMIERLEAGUE</option>
|
||||
|
||||
<option>MLB</option>
|
||||
|
||||
<option>MLS</option>
|
||||
|
||||
<option>PGA</option>
|
||||
<option>LPGA</option>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-auto">
|
||||
|
||||
<button id="inputTransitionBtn103" class="btn set-btn">
|
||||
|
||||
Add
|
||||
|
||||
</button>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row g-3 align-items-center mt-3">
|
||||
<div class="col-auto">
|
||||
<label for="inputTransition103Z" class="col-form-label"
|
||||
>Golf Rankings:
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<select id="golf-ranking-number" class="form-select">
|
||||
<option {%if team_stats.top20 == 20 %} selected {% endif %}>Top 20</option>
|
||||
<option {%if team_stats.top20 == 10 %} selected {% endif %}>Top 10</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<button id="golf-ranking-set" class="btn set-btn" onclick="setTop20()">
|
||||
Set
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row g-3 align-items-center mt-3">
|
||||
|
||||
@ -6308,14 +6236,8 @@
|
||||
|
||||
id="flexCheckChecked24"
|
||||
|
||||
{%
|
||||
|
||||
if
|
||||
|
||||
team_stats.title%}
|
||||
|
||||
{% if team_stats.title%}
|
||||
checked
|
||||
|
||||
{%endif%}
|
||||
|
||||
/>
|
||||
@ -8531,7 +8453,7 @@
|
||||
|
||||
<p>© 2020-2023 Fintic Limited., All Rights Reserved. <a href="mailto:info@fintic.io" id="footerlinks">Contact Us.</a></p>
|
||||
|
||||
<p>Data Provided by IEX Cloud, Openweathermap, CoinGecko, Exchangerate-API, TheSportsDB, Google News, Yahoo Finance, ESPN, The Movie DB, Finnhub</p>
|
||||
<p>Data Provided by IEX Cloud, Open-Meteo, CoinGecko, Exchangerate-API, TheSportsDB, Google News, Yahoo Finance, ESPN, The Movie DB, Finnhub</p>
|
||||
|
||||
<p>Useful resources: <a href="https://www.youtube.com/playlist?list=PLf8pW0bNjnebNZh3y0AsY18sxJj6IhAsv" id="footerlinks" target="_blank">YouTube Tutorials</a> , <a href="https://docs.google.com/spreadsheets/d/1IZkEl49j97xvG8jcEdWc5XdOLOUb_-ZLVHle2vezWCc/edit?usp=sharing" id="footerlinks" target="_blank">Formatting Guide & Info</a> , <a href="https://fintic.io" id="footerlinks" target="_blank">Official Website</a></p>
|
||||
|
||||
@ -8545,7 +8467,7 @@
|
||||
<script src="{{ url_for('static', filename='js/jquery-2.1.1.js') }}"></script>
|
||||
|
||||
<!-- <script src="{{ url_for('static', filename='app.js') }}"></script>. ALWAYS CHANGE VERSIONING WHENEVER CHANGES ARE MADE TO AVOID BAD CACHING -->
|
||||
<script type='text/javascript' src='../static/app.js?ver=1.3.4'></script>
|
||||
<script type='text/javascript' src='../static/app.js?ver=1.3.5'></script>
|
||||
|
||||
<script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user