bug fixes
This commit is contained in:
parent
eb284137a8
commit
f27e4eec4d
@ -422,8 +422,20 @@ def updateLeagueTables(api_key, league_ids):
|
|||||||
r = requests.get(url)
|
r = requests.get(url)
|
||||||
try:
|
try:
|
||||||
all_data = r.json()
|
all_data = r.json()
|
||||||
except: # there is no data available
|
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
|
continue
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
teams = []
|
teams = []
|
||||||
|
|
||||||
|
|
||||||
@ -479,8 +491,17 @@ def updateLeagueEvents(api_key, league_ids, time):
|
|||||||
r = requests.get(url)
|
r = requests.get(url)
|
||||||
try:
|
try:
|
||||||
all_data = r.json()
|
all_data = r.json()
|
||||||
except: # there is no data available
|
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
|
continue
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
events = []
|
events = []
|
||||||
@ -634,7 +655,7 @@ if __name__ == '__main__':
|
|||||||
#stocks
|
#stocks
|
||||||
stock_time = datetime.strptime(last_updates['stocks'], "%d/%m/%Y %H:%M:%S")
|
stock_time = datetime.strptime(last_updates['stocks'], "%d/%m/%Y %H:%M:%S")
|
||||||
stock_frequency = update_frequencies['stocks']
|
stock_frequency = update_frequencies['stocks']
|
||||||
if checkStocks(stock_time, stock_frequency):
|
if checkStocks(stock_time, stock_frequency) or msg == 's':
|
||||||
stock_time = NY_time.strftime("%d/%m/%Y %H:%M:%S")
|
stock_time = NY_time.strftime("%d/%m/%Y %H:%M:%S")
|
||||||
last_updates['stocks'] = stock_time
|
last_updates['stocks'] = stock_time
|
||||||
|
|
||||||
@ -644,7 +665,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
NY_time = datetime.now(NY_zone).replace(tzinfo=None)
|
NY_time = datetime.now(NY_zone).replace(tzinfo=None)
|
||||||
diff = (NY_time - crypto_time).total_seconds()/60 #minutes
|
diff = (NY_time - crypto_time).total_seconds()/60 #minutes
|
||||||
if diff >= update_frequencies['crypto']:
|
if diff >= update_frequencies['crypto'] or msg == 'c':
|
||||||
crypto_time = NY_time.strftime("%d/%m/%Y %H:%M:%S")
|
crypto_time = NY_time.strftime("%d/%m/%Y %H:%M:%S")
|
||||||
updateCrypto()
|
updateCrypto()
|
||||||
last_updates['crypto'] = crypto_time
|
last_updates['crypto'] = crypto_time
|
||||||
@ -656,7 +677,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
NY_time = datetime.now(NY_zone).replace(tzinfo=None)
|
NY_time = datetime.now(NY_zone).replace(tzinfo=None)
|
||||||
diff = (NY_time - weather_time).total_seconds()/60 #minutes
|
diff = (NY_time - weather_time).total_seconds()/60 #minutes
|
||||||
if diff >= update_frequencies['weather']:
|
if diff >= update_frequencies['weather'] or msg == 'w':
|
||||||
weather_time = NY_time.strftime("%d/%m/%Y %H:%M:%S")
|
weather_time = NY_time.strftime("%d/%m/%Y %H:%M:%S")
|
||||||
updateWeather()
|
updateWeather()
|
||||||
last_updates['weather'] = weather_time
|
last_updates['weather'] = weather_time
|
||||||
@ -668,7 +689,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
NY_time = datetime.now(NY_zone).replace(tzinfo=None)
|
NY_time = datetime.now(NY_zone).replace(tzinfo=None)
|
||||||
diff = (NY_time - news_time).total_seconds()/60 #minutes
|
diff = (NY_time - news_time).total_seconds()/60 #minutes
|
||||||
if diff >= update_frequencies['news']:
|
if diff >= update_frequencies['news'] or msg == 'n':
|
||||||
news_time = NY_time.strftime("%d/%m/%Y %H:%M:%S")
|
news_time = NY_time.strftime("%d/%m/%Y %H:%M:%S")
|
||||||
updateNews()
|
updateNews()
|
||||||
last_updates['news'] = news_time
|
last_updates['news'] = news_time
|
||||||
@ -679,7 +700,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
NY_time = datetime.now(NY_zone).replace(tzinfo=None)
|
NY_time = datetime.now(NY_zone).replace(tzinfo=None)
|
||||||
diff = (NY_time - sports_time).total_seconds()/60 #minutes
|
diff = (NY_time - sports_time).total_seconds()/60 #minutes
|
||||||
if diff >= update_frequencies['sports']:
|
if diff >= update_frequencies['sports'] or msg == 'S':
|
||||||
sports_time = NY_time.strftime("%d/%m/%Y %H:%M:%S")
|
sports_time = NY_time.strftime("%d/%m/%Y %H:%M:%S")
|
||||||
updateSports()
|
updateSports()
|
||||||
last_updates['sports'] = sports_time
|
last_updates['sports'] = sports_time
|
||||||
@ -691,7 +712,7 @@ if __name__ == '__main__':
|
|||||||
CET_time = datetime.now(CET_zone)
|
CET_time = datetime.now(CET_zone)
|
||||||
yday_update = (CET_time.replace(hour=17, minute=00, second=0, microsecond=0) - dt.timedelta(days=1)).replace(tzinfo=None)
|
yday_update = (CET_time.replace(hour=17, minute=00, second=0, microsecond=0) - dt.timedelta(days=1)).replace(tzinfo=None)
|
||||||
|
|
||||||
if forex_time < yday_update:
|
if forex_time < yday_update or msg == 'f':
|
||||||
forex_time = CET_time.strftime("%d/%m/%Y %H:%M:%S")
|
forex_time = CET_time.strftime("%d/%m/%Y %H:%M:%S")
|
||||||
last_updates['forex'] = forex_time
|
last_updates['forex'] = forex_time
|
||||||
updateForex()
|
updateForex()
|
||||||
|
@ -1 +1 @@
|
|||||||
{"feature": "Stocks", "speed": "medium", "animation": "down", "percent": true, "point": true, "logos": true, "chart": false, "title": true, "symbols": {"NEO,USD": {"current": 41.53, "24hr_change": 3.0530667588098535}, "BTC,USD": {"current": 61214, "24hr_change": 3.5007811771288146}, "ETH,BTC": {"current": 0.0688888, "24hr_change": 4.981732790736668}, "ADA,GBP": {"current": 1.46, "24hr_change": 1.6355039771734323}}}
|
{"feature": "Stocks", "speed": "medium", "animation": "down", "percent": false, "point": false, "logos": true, "chart": false, "title": true, "symbols": {"NEO,USD": {"current": 43.45, "24hr_change": -8.868602959790408}, "BTC,USD": {"current": 60427, "24hr_change": -5.50343462209234}, "ETH,BTC": {"current": 0.07072443, "24hr_change": -7.189558281316787}, "ADA,GBP": {"current": 1.41, "24hr_change": -6.194047327868864}}}
|
@ -1 +1 @@
|
|||||||
{"feature": "Current Weather", "speed": "medium", "animation": "continuous", "temp": "celsius", "wind_speed": "miles/sec", "colour": "white", "city_colour": "yellow", "title": true, "locations": {"Beijing": {"main_weather": "Clouds", "description": "overcast clouds", "temp": 10.43, "min_temp": 10.43, "max_temp": 18.87, "feels_like": 9.33, "humidity": 69, "clouds": 95, "wind_speed": 1.17, "wind_direction": 39, "visibility": 10000, "uv": 0, "rain_chance": 0}, "Tokyo": {"main_weather": "Clouds", "description": "few clouds", "temp": 13.65, "min_temp": 13.65, "max_temp": 19.19, "feels_like": 12.4, "humidity": 51, "clouds": 20, "wind_speed": 2.24, "wind_direction": 15, "visibility": 10000, "uv": 0, "rain_chance": 0}, "London": {"main_weather": "Clouds", "description": "overcast clouds", "temp": 13.16, "min_temp": 12.37, "max_temp": 15.93, "feels_like": 12.72, "humidity": 84, "clouds": 100, "wind_speed": 4.12, "wind_direction": 160, "visibility": 10000, "uv": 0, "rain_chance": 0}, "Moscow": {"main_weather": "Clouds", "description": "overcast clouds", "temp": 7.03, "min_temp": 4.95, "max_temp": 9.93, "feels_like": 4.45, "humidity": 80, "clouds": 100, "wind_speed": 3.81, "wind_direction": 353, "visibility": 10000, "uv": 0, "rain_chance": 0}}, "current_weather": true}
|
{"feature": "Current Weather", "speed": "medium", "animation": "down", "temp": "celsius", "wind_speed": "miles/sec", "colour": "white", "city_colour": "yellow", "title": true, "locations": {"Beijing": {"main_weather": "Clear", "description": "clear sky", "temp": 0.94, "min_temp": 0.94, "max_temp": 13.85, "feels_like": 0.94, "humidity": 72, "clouds": 0, "wind_speed": 0.6, "wind_direction": 307, "visibility": 10000, "uv": 0, "rain_chance": 0}, "London": {"main_weather": "Clouds", "description": "few clouds", "temp": 9.54, "min_temp": 7.43, "max_temp": 11.11, "feels_like": 8.23, "humidity": 88, "clouds": 20, "wind_speed": 2.57, "wind_direction": 230, "visibility": 10000, "uv": 0, "rain_chance": 0}, "Tokyo": {"main_weather": "Clouds", "description": "broken clouds", "temp": 12.24, "min_temp": 12.24, "max_temp": 15.91, "feels_like": 11.09, "humidity": 60, "clouds": 75, "wind_speed": 0.89, "wind_direction": 33, "visibility": 10000, "uv": 0, "rain_chance": 0.02}, "Moscow": {"main_weather": "Clear", "description": "clear sky", "temp": -2.25, "min_temp": -2.57, "max_temp": 0.29, "feels_like": -7.63, "humidity": 80, "clouds": 0, "wind_speed": 4.84, "wind_direction": 273, "visibility": 10000, "uv": 0, "rain_chance": 0}}, "current_weather": true}
|
@ -1 +1 @@
|
|||||||
{"feature": "Current Weather", "speed": "medium", "animation": "continuous", "temp": "celsius", "wind_speed": "miles/sec", "colour": "white", "city_colour": "yellow", "title": true, "locations": {"Beijing": [{"main_weather": "Clear", "description": "clear sky", "min_temp": 10.43, "max_temp": 18.87}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 11.79, "max_temp": 20.3}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 11.75, "max_temp": 17.06}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 9.83, "max_temp": 15.21}, {"main_weather": "Clouds", "description": "broken clouds", "min_temp": 10.02, "max_temp": 16.08}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 10.22, "max_temp": 17.99}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 11.18, "max_temp": 19.34}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 12.1, "max_temp": 15.76}], "Tokyo": [{"main_weather": "Clouds", "description": "scattered clouds", "min_temp": 13.65, "max_temp": 19.19}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 13.79, "max_temp": 18.73}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 16.17, "max_temp": 20.03}, {"main_weather": "Rain", "description": "light rain", "min_temp": 16.41, "max_temp": 20.18}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 16.73, "max_temp": 19.89}, {"main_weather": "Rain", "description": "light rain", "min_temp": 15.76, "max_temp": 20.23}, {"main_weather": "Rain", "description": "light rain", "min_temp": 15.45, "max_temp": 17.57}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 14.26, "max_temp": 20.42}], "London": [{"main_weather": "Clouds", "description": "few clouds", "min_temp": 12.37, "max_temp": 15.93}, {"main_weather": "Rain", "description": "light rain", "min_temp": 11.81, "max_temp": 14.55}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 10.27, "max_temp": 13.92}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 8.95, "max_temp": 13.13}, {"main_weather": "Clouds", "description": "scattered clouds", "min_temp": 7.76, "max_temp": 11.97}, {"main_weather": "Rain", "description": "light rain", "min_temp": 7.48, "max_temp": 11.03}, {"main_weather": "Clouds", "description": "scattered clouds", "min_temp": 5.69, "max_temp": 10.83}, {"main_weather": "Clouds", "description": "scattered clouds", "min_temp": 5.58, "max_temp": 10.35}], "Moscow": [{"main_weather": "Rain", "description": "light rain", "min_temp": 4.95, "max_temp": 9.93}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 5.4, "max_temp": 8.06}, {"main_weather": "Clouds", "description": "scattered clouds", "min_temp": 7.55, "max_temp": 12.8}, {"main_weather": "Clouds", "description": "few clouds", "min_temp": 6.22, "max_temp": 11.06}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 5.43, "max_temp": 10.23}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 4.38, "max_temp": 9.17}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 3.2, "max_temp": 8.07}, {"main_weather": "Rain", "description": "light rain", "min_temp": 6.67, "max_temp": 8.85}]}, "current_weather": true}
|
{"feature": "Current Weather", "speed": "medium", "animation": "continuous", "temp": "celsius", "wind_speed": "miles/sec", "colour": "white", "city_colour": "yellow", "title": true, "locations": {"Beijing": [{"main_weather": "Clouds", "description": "scattered clouds", "min_temp": 0.94, "max_temp": 13.85}, {"main_weather": "Clouds", "description": "scattered clouds", "min_temp": 6.16, "max_temp": 13.29}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 5.69, "max_temp": 9.87}, {"main_weather": "Clouds", "description": "broken clouds", "min_temp": 5.62, "max_temp": 9.94}, {"main_weather": "Clouds", "description": "broken clouds", "min_temp": 2.8, "max_temp": 9.15}, {"main_weather": "Clear", "description": "clear sky", "min_temp": -0.28, "max_temp": 3.8}, {"main_weather": "Clear", "description": "clear sky", "min_temp": -1.2, "max_temp": 3.28}, {"main_weather": "Clear", "description": "clear sky", "min_temp": -0.49, "max_temp": 5.87}], "London": [{"main_weather": "Clear", "description": "clear sky", "min_temp": 7.43, "max_temp": 11.11}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 7.51, "max_temp": 11}, {"main_weather": "Clouds", "description": "broken clouds", "min_temp": 7.05, "max_temp": 12.71}, {"main_weather": "Clouds", "description": "scattered clouds", "min_temp": 8.97, "max_temp": 12.83}, {"main_weather": "Clouds", "description": "few clouds", "min_temp": 8.1, "max_temp": 12.31}, {"main_weather": "Rain", "description": "light rain", "min_temp": 6.12, "max_temp": 10.84}, {"main_weather": "Rain", "description": "light rain", "min_temp": 4.61, "max_temp": 9.35}, {"main_weather": "Clouds", "description": "scattered clouds", "min_temp": 5.3, "max_temp": 8.62}], "Tokyo": [{"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 12.24, "max_temp": 15.91}, {"main_weather": "Rain", "description": "light rain", "min_temp": 13.48, "max_temp": 14.39}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 12.63, "max_temp": 17.46}, {"main_weather": "Clouds", "description": "scattered clouds", "min_temp": 12.47, "max_temp": 16.3}, {"main_weather": "Rain", "description": "light rain", "min_temp": 13.08, "max_temp": 14.47}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 11.16, "max_temp": 15.37}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 12.42, "max_temp": 14.94}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 10.5, "max_temp": 14.7}], "Moscow": [{"main_weather": "Clouds", "description": "few clouds", "min_temp": -2.57, "max_temp": 0.29}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": -1.92, "max_temp": 0.29}, {"main_weather": "Snow", "description": "light snow", "min_temp": -1.86, "max_temp": 0.44}, {"main_weather": "Snow", "description": "light snow", "min_temp": -1.68, "max_temp": 0.94}, {"main_weather": "Snow", "description": "rain and snow", "min_temp": -0.34, "max_temp": 3.57}, {"main_weather": "Snow", "description": "light snow", "min_temp": -0.52, "max_temp": 1.01}, {"main_weather": "Snow", "description": "light snow", "min_temp": -5.53, "max_temp": 0.3}, {"main_weather": "Snow", "description": "light snow", "min_temp": -5.31, "max_temp": -2.03}]}, "current_weather": true}
|
@ -1 +1 @@
|
|||||||
["Forex"]
|
["Current Weather"]
|
@ -1 +1 @@
|
|||||||
{"feature": "Stocks", "speed": "medium", "animation": "down", "percent": false, "point": true, "logos": false, "chart": false, "title": true, "symbols": {"NZD,GBP": {"current": 1.9136, "24hr_change": -0.0041999999999999815}, "CAD,USD": {"current": 1.2357, "24hr_change": -0.005099999999999882}}}
|
{"feature": "Stocks", "speed": "medium", "animation": "down", "percent": false, "point": false, "logos": false, "chart": false, "title": true, "symbols": {"NZD,GBP": {"current": 1.9148, "24hr_change": 0.015700000000000047}, "CAD,USD": {"current": 1.2533, "24hr_change": 0.0008000000000001339}}}
|
@ -1 +1 @@
|
|||||||
{"stocks": "28/10/2021 14:43:29", "crypto": "28/10/2021 14:36:22", "news": "28/10/2021 14:36:24", "weather": "28/10/2021 14:36:22", "forex": "28/10/2021 20:36:26", "sports": "28/10/2021 14:36:24"}
|
{"stocks": "16/11/2021 14:09:37", "crypto": "16/11/2021 14:07:15", "news": "16/11/2021 13:47:18", "weather": "16/11/2021 14:07:00", "forex": "16/11/2021 19:47:20", "sports": "16/11/2021 13:59:46"}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
|||||||
{"feature": "Stocks", "speed": "medium", "animation": "down", "percent": true, "point": true, "logos": false, "chart": false, "title": true, "symbols": {"MSFT": {"current": 323.7, "opening": 324.325}, "GOOG": {"current": 2923.335, "opening": 2947.07}}}
|
{"feature": "Stocks", "speed": "medium", "animation": "down", "percent": true, "point": true, "logos": false, "chart": false, "title": true, "symbols": {"MSFT": {"current": 340.32, "opening": 335.665}, "GOOG": {"current": 2987.62, "opening": 2983.36}}}
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
14
server.py
14
server.py
@ -407,7 +407,7 @@ def combine_dict(current_settings, input_symbols, current_key):
|
|||||||
# add any stock that arent current in the settings
|
# add any stock that arent current in the settings
|
||||||
for IS in input_symbols:
|
for IS in input_symbols:
|
||||||
if IS not in current_symbols:
|
if IS not in current_symbols:
|
||||||
current_settings[current_key][IS] = -1
|
current_settings[current_key][IS] = []
|
||||||
|
|
||||||
# remove stocks not in settings
|
# remove stocks not in settings
|
||||||
for CS in current_symbols:
|
for CS in current_symbols:
|
||||||
@ -436,6 +436,13 @@ def save_trade_settings(input_settings):
|
|||||||
|
|
||||||
json.dump(current_settings, open('csv/' + filename, 'w+'))
|
json.dump(current_settings, open('csv/' + filename, 'w+'))
|
||||||
|
|
||||||
|
if input_settings['feature'].lower() == 'stocks':
|
||||||
|
api_caller.sendline('s')
|
||||||
|
elif input_settings['feature'].lower() == 'crypto':
|
||||||
|
api_caller.sendline('c')
|
||||||
|
elif input_settings['feature'].lower() == 'forex':
|
||||||
|
api_caller.sendline('f')
|
||||||
|
|
||||||
def save_weather_settings(input_settings):
|
def save_weather_settings(input_settings):
|
||||||
|
|
||||||
|
|
||||||
@ -459,6 +466,8 @@ def save_weather_settings(input_settings):
|
|||||||
|
|
||||||
json.dump(current_settings, open('csv/' + filename, 'w+'))
|
json.dump(current_settings, open('csv/' + filename, 'w+'))
|
||||||
|
|
||||||
|
api_caller.sendline('w')
|
||||||
|
|
||||||
def save_news_settings(input_settings):
|
def save_news_settings(input_settings):
|
||||||
filename = 'news_settings.json'
|
filename = 'news_settings.json'
|
||||||
|
|
||||||
@ -474,6 +483,7 @@ def save_news_settings(input_settings):
|
|||||||
current_settings['sources'] = list(set(current_settings['sources'] + input_settings['sources']))
|
current_settings['sources'] = list(set(current_settings['sources'] + input_settings['sources']))
|
||||||
|
|
||||||
json.dump(current_settings, open('csv/' + filename, 'w+'))
|
json.dump(current_settings, open('csv/' + filename, 'w+'))
|
||||||
|
api_caller.sendline('n')
|
||||||
|
|
||||||
def save_sports_settings(input_settings):
|
def save_sports_settings(input_settings):
|
||||||
|
|
||||||
@ -499,6 +509,8 @@ def save_sports_settings(input_settings):
|
|||||||
|
|
||||||
json.dump(current_settings, open('csv/' + filename, 'w+'))
|
json.dump(current_settings, open('csv/' + filename, 'w+'))
|
||||||
|
|
||||||
|
api_caller.sendline('S')
|
||||||
|
|
||||||
# for images and GIFs
|
# for images and GIFs
|
||||||
def save_image_settings(input_settings):
|
def save_image_settings(input_settings):
|
||||||
filename = 'image_settings.json' if input_settings['feature'] == 'Custom Images' else 'GIF_settings.json'
|
filename = 'image_settings.json' if input_settings['feature'] == 'Custom Images' else 'GIF_settings.json'
|
||||||
|
@ -807,7 +807,10 @@ class StockTicker():
|
|||||||
#Draw Ticker, current and change onto one image
|
#Draw Ticker, current and change onto one image
|
||||||
def textToImage(self, TICKER, CURRENT, ARROW, percent_change = False, point_change = False, font = ImageFont.load("./fonts/10x20.pil")):
|
def textToImage(self, TICKER, CURRENT, ARROW, percent_change = False, point_change = False, font = ImageFont.load("./fonts/10x20.pil")):
|
||||||
|
|
||||||
text_width_current, text_height = self.get_text_dimensions(CURRENT, font)
|
w1, text_height = self.get_text_dimensions(CURRENT, font)
|
||||||
|
w2, text_height = self.get_text_dimensions(TICKER, font)
|
||||||
|
|
||||||
|
text_width_current = max(w1,w2)
|
||||||
|
|
||||||
img = Image.new('RGB', (text_width_current +100 , 32))
|
img = Image.new('RGB', (text_width_current +100 , 32))
|
||||||
d = ImageDraw.Draw(img)
|
d = ImageDraw.Draw(img)
|
||||||
@ -817,19 +820,26 @@ class StockTicker():
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
img.paste(ARROW, ((text_width_current + 9),18))
|
|
||||||
if point_change:
|
if point_change:
|
||||||
d.text(((text_width_current+29), 16), point_change, fill=self.greenORred, font=font)
|
d.text(((text_width_current+29), 16), point_change, fill=self.greenORred, font=font)
|
||||||
|
|
||||||
if percent_change:
|
if percent_change:
|
||||||
d.text(((text_width_current+29), 14 - text_height), percent_change, fill=self.greenORred, font=font)
|
d.text(((text_width_current+29), 14 - text_height), percent_change, fill=self.greenORred, font=font)
|
||||||
|
|
||||||
|
if point_change or percent_change:
|
||||||
|
img.paste(ARROW, ((text_width_current + 9),18))
|
||||||
|
|
||||||
|
|
||||||
|
text_width_change=0
|
||||||
if percent_change:
|
if percent_change:
|
||||||
text_width_change, text_height = self.get_text_dimensions(percent_change, font)
|
width, text_height = self.get_text_dimensions(percent_change, font)
|
||||||
|
text_width_change = max(width, text_width_change)
|
||||||
elif point_change:
|
elif point_change:
|
||||||
text_width_change, text_height = self.get_text_dimensions(point_change, font)
|
width, text_height = self.get_text_dimensions(point_change, font)
|
||||||
else:
|
text_width_change = max(width, text_width_change)
|
||||||
text_width_change=0
|
|
||||||
|
|
||||||
|
|
||||||
newWidth = text_width_current + text_width_change +30
|
newWidth = text_width_current + text_width_change +30
|
||||||
|
|
||||||
@ -1032,7 +1042,10 @@ class StockTicker():
|
|||||||
|
|
||||||
point_change = '%.2f' % abs(change/100 * current)
|
point_change = '%.2f' % abs(change/100 * current)
|
||||||
|
|
||||||
|
if not all_forex_settings['percent']:
|
||||||
|
percent_change = False
|
||||||
|
if not all_forex_settings['point']:
|
||||||
|
point_change = False
|
||||||
|
|
||||||
arrow, change = self.getArrow(change)
|
arrow, change = self.getArrow(change)
|
||||||
|
|
||||||
|
@ -1463,7 +1463,7 @@
|
|||||||
<select id="inputTransition73" class="form-select">
|
<select id="inputTransition73" class="form-select">
|
||||||
<option>NFL</option>
|
<option>NFL</option>
|
||||||
<option>NBA</option>
|
<option>NBA</option>
|
||||||
<option>NHA</option>
|
<option>NHL</option>
|
||||||
<option>Premier League</option>
|
<option>Premier League</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -1589,7 +1589,7 @@
|
|||||||
<select id="inputTransition83" class="form-select">
|
<select id="inputTransition83" class="form-select">
|
||||||
<option>NFL</option>
|
<option>NFL</option>
|
||||||
<option>NBA</option>
|
<option>NBA</option>
|
||||||
<option>NHA</option>
|
<option>NHL</option>
|
||||||
<option>Premier League</option>
|
<option>Premier League</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -1715,7 +1715,7 @@
|
|||||||
<select id="inputTransition93" class="form-select">
|
<select id="inputTransition93" class="form-select">
|
||||||
<option>NFL</option>
|
<option>NFL</option>
|
||||||
<option>NBA</option>
|
<option>NBA</option>
|
||||||
<option>NHA</option>
|
<option>NHL</option>
|
||||||
<option>Premier League</option>
|
<option>Premier League</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -1840,7 +1840,7 @@
|
|||||||
<select id="inputTransition103" class="form-select">
|
<select id="inputTransition103" class="form-select">
|
||||||
<option>NFL</option>
|
<option>NFL</option>
|
||||||
<option>NBA</option>
|
<option>NBA</option>
|
||||||
<option>NHA</option>
|
<option>NHL</option>
|
||||||
<option>Premier League</option>
|
<option>Premier League</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user