This commit is contained in:
Your Name 2021-12-22 09:43:36 +00:00
parent d6fb074923
commit 6a1c6040d2
3 changed files with 19 additions and 25 deletions

View File

@ -21,6 +21,10 @@ import numpy as np
import copy import copy
#stock_ticker = StockTicker() #stock_ticker = StockTicker()
#print('API CALLER NOT STARTED') #print('API CALLER NOT STARTED')
#open('log.txt', 'w').close() #wipe logs
api_caller = pexpect.spawn("sudo -E taskset -c 3 python3 api_caller.py") api_caller = pexpect.spawn("sudo -E taskset -c 3 python3 api_caller.py")
api_caller.sendline('A') api_caller.sendline('A')
displaying_screensaver = False displaying_screensaver = False
@ -238,7 +242,7 @@ def save():
@app.route("/upload", methods = ['PUT', 'POST', 'GET']) @app.route("/upload", methods = ['PUT', 'POST', 'GET'])
def upload(): def upload():
try: try:
remove_old_uploads()
images = request.files images = request.files
names = list(request.files.keys()) names = list(request.files.keys())
@ -458,8 +462,7 @@ def save_weather_settings(input_settings):
current_settings['animation'] = input_settings['animation'].lower() current_settings['animation'] = input_settings['animation'].lower()
current_settings['temp'] = input_settings['temp'].lower() current_settings['temp'] = input_settings['temp'].lower()
current_settings['wind_speed'] = input_settings['wind_speed'].lower() current_settings['wind_speed'] = input_settings['wind_speed'].lower()
current_settings['colour'] = input_settings['colour'].lower()
current_settings['city_colour'] = input_settings['city_colour'].lower()
current_settings['title'] = input_settings['title'] current_settings['title'] = input_settings['title']
if input_settings['feature'] == 'Daily Forecast': if input_settings['feature'] == 'Daily Forecast':
@ -532,6 +535,7 @@ def save_image_settings(input_settings):
del current_settings['feature'] del current_settings['feature']
json.dump(current_settings, open('csv/' + filename, 'w+')) json.dump(current_settings, open('csv/' + filename, 'w+'))
remove_old_uploads()
def save_message_settings(input_settings): def save_message_settings(input_settings):

View File

@ -1055,17 +1055,12 @@ function getTradingSettings(page) {
function getWeatherSettings(page) { function getWeatherSettings(page) {
let temp = getSelected(page.querySelectorAll(".temp-select")[0]); let temp = getSelected(page.querySelectorAll(".temp-select")[0]);
let speed = getSelected(page.querySelectorAll(".wind-speed-select")[0]); let speed = getSelected(page.querySelectorAll(".wind-speed-select")[0]);
let colour = getSelected(page.querySelectorAll(".colour-select")[0]);
let city_colour = getSelected(
page.querySelectorAll(".city-colour-select")[0]
);
let title = page.querySelectorAll(".title-select")[0].checked; let title = page.querySelectorAll(".title-select")[0].checked;
settings = { settings = {
temp: temp, temp: temp,
wind_speed: speed, wind_speed: speed,
colour: colour,
city_colour: city_colour,
title: title, title: title,
}; };
@ -1079,7 +1074,7 @@ function getWeatherSettings(page) {
let locations_el = page.querySelectorAll(".location-list")[0]; let locations_el = page.querySelectorAll(".location-list")[0];
let locations = getListItems(locations_el); let locations = getListItems(locations_el);
settings["locations"] = locations; settings["locations"] = locations;
console.log(settings);
return settings; return settings;
} }

View File

@ -2516,8 +2516,10 @@ class StockTicker():
try: try:
GIF = Image.open(os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'user_uploads'), fle)) GIF = Image.open(os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'user_uploads'), fle))
if ind == 0 and all_settings['title']:
frames = [] frames = []
if ind == 0 and all_settings['title']:
title_img = self.openImage('feature_titles/gifs.png') title_img = self.openImage('feature_titles/gifs.png')
for i, frame in enumerate(ImageSequence.Iterator(GIF)): for i, frame in enumerate(ImageSequence.Iterator(GIF)):
@ -2526,24 +2528,17 @@ class StockTicker():
f = self.stitchImage([title_img, frame]) f = self.stitchImage([title_img, frame])
frames.append(f) frames.append(f)
frames[0].save('./display_images/working_gif.gif', save_all=True, append_images=frames[1:], loop=0, optimize = False)
GIF = Image.open('./display_images/working_gif.gif')
GIFs.append(GIF)
else: else:
frames = []
for i, frame in enumerate(ImageSequence.Iterator(GIF)): for i, frame in enumerate(ImageSequence.Iterator(GIF)):
frame.thumbnail((99999, 32)) frame.thumbnail((99999, 32))
f = frame
frames.append(frame) frames.append(f)
frames[0].save('./display_images/working_gif.gif', save_all=True, append_images=frames[1:], loop=0, optimize = False) frames[0].save('./display_images/working_gif{}.gif'.format(str(ind)), save_all=True, append_images=frames[1:], loop=0, optimize = False)
GIF = Image.open('./display_images/working_gif.gif') GIF = Image.open('./display_images/working_gif{}.gif'.format(str(ind)))
GIFs.append(GIF) GIFs.append(GIF)
@ -2556,7 +2551,7 @@ class StockTicker():
self.logf.write('. type: ' + str(exc_type)) self.logf.write('. type: ' + str(exc_type))
self.logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))) self.logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
self.logf.write(str(GIFs))
#below code stitches title and GIF together #below code stitches title and GIF together
''' '''