minor fixes
Before Width: | Height: | Size: 199 B |
Before Width: | Height: | Size: 192 B |
@ -238,8 +238,10 @@ def save():
|
||||
@app.route("/upload", methods = ['PUT', 'POST', 'GET'])
|
||||
def upload():
|
||||
try:
|
||||
remove_old_uploads()
|
||||
images = request.files
|
||||
names = list(request.files.keys())
|
||||
|
||||
for name in names:
|
||||
images[name].save('user_uploads/' +name)
|
||||
|
||||
@ -247,7 +249,14 @@ def upload():
|
||||
print(e)
|
||||
return index()
|
||||
|
||||
def remove_old_uploads():
|
||||
#remove old files
|
||||
|
||||
image_settings = json.load(open('csv/image_settings.json', 'r'))
|
||||
GIF_settings = json.load(open('csv/GIF_settings.json', 'r'))
|
||||
for filename in os.listdir('user_uploads'):
|
||||
if filename not in image_settings['images'] and filename not in GIF_settings['images']:
|
||||
os.remove('user_uploads/'+filename)
|
||||
|
||||
|
||||
|
||||
|
@ -348,7 +348,6 @@ class StockTicker():
|
||||
if options[i % len(options)] == 'Custom Images':
|
||||
images = self.getUserImages()
|
||||
|
||||
|
||||
elif options[i % len(options)] == 'Custom GIFs':
|
||||
images = self.getUserGIFs()
|
||||
|
||||
@ -366,10 +365,8 @@ class StockTicker():
|
||||
img_width, img_height = image.size
|
||||
|
||||
offset_x = 0
|
||||
if animation == 'traditional':
|
||||
if animation == 'continuous':
|
||||
offset_x = 128
|
||||
elif animation == 'continuous':
|
||||
offset_x = 0
|
||||
elif animation in ['up', 'down']:
|
||||
offset_x = max(0, 128-img_width)
|
||||
|
||||
@ -470,14 +467,14 @@ class StockTicker():
|
||||
delay_t2 = self.set_delay(settings2['speed'])
|
||||
animation2 = settings2['animation'].lower()
|
||||
|
||||
if animation1 == 'traditional':
|
||||
if animation1 == 'continuous':
|
||||
offset_y1 = 0
|
||||
offset_x1 = 128
|
||||
else:
|
||||
offset_y1 = -16
|
||||
offset_x1 = 0
|
||||
|
||||
if animation2 == 'traditional':
|
||||
if animation2 == 'continuous':
|
||||
offset_y2 = 16
|
||||
offset_x2 = 128
|
||||
else:
|
||||
@ -503,7 +500,7 @@ class StockTicker():
|
||||
delay_t1 = self.set_delay(settings1['speed'])
|
||||
animation1 = settings1['animation'].lower()
|
||||
|
||||
if animation1 == 'traditional':
|
||||
if animation1 == 'continuous':
|
||||
offset_y1 = 0
|
||||
offset_x1 = 128
|
||||
else:
|
||||
@ -523,7 +520,7 @@ class StockTicker():
|
||||
delay_t2 = self.set_delay(settings2['speed'])
|
||||
animation2 = settings2['animation'].lower()
|
||||
|
||||
if animation2 == 'traditional':
|
||||
if animation2 == 'continuous':
|
||||
offset_y2 = 16
|
||||
offset_x2 = 128
|
||||
else:
|
||||
@ -793,11 +790,11 @@ class StockTicker():
|
||||
self.greenORred
|
||||
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'stocks')
|
||||
if(CHANGE>0):
|
||||
Arrow = Image.open(os.path.join(logos_path, 'up.png'))
|
||||
Arrow = Image.open(os.path.join(logos_path, 'up-1.png'))
|
||||
self.greenORred = (0, 255, 0)
|
||||
|
||||
else:
|
||||
Arrow = Image.open(os.path.join(logos_path, 'down.png'))
|
||||
Arrow = Image.open(os.path.join(logos_path, 'down-1.png'))
|
||||
self.greenORred = (255, 0, 0)
|
||||
CHANGE = (CHANGE * -1)
|
||||
|
||||
@ -1829,9 +1826,11 @@ class StockTicker():
|
||||
|
||||
|
||||
temp = current_weather['temp']
|
||||
feels_temp = current_weather['feels_like']
|
||||
if all_settings['temp'] == 'kelvin':
|
||||
temp = current_weather['temp'] + 273.15
|
||||
elif all_settings['temp'] == 'fahrenheit':
|
||||
feels_temp = current_weather['feels_like']*9/5 + 32
|
||||
temp = current_weather['temp']*9/5 + 32
|
||||
|
||||
temp_img = self.textImage(str("{0:.0f}".format(temp)), large_font)
|
||||
@ -1845,7 +1844,8 @@ class StockTicker():
|
||||
main_img = self.textImage(main.upper(), small_font)
|
||||
img.paste(main_img, (35, 26))
|
||||
|
||||
feels_img = self.textImage('Feels like:'.upper() + str("{0:.0f}".format(current_weather['feels_like'])), small_font)
|
||||
|
||||
feels_img = self.textImage('Feels like:'.upper() + str("{0:.0f}".format(feels_temp)), small_font)
|
||||
img.paste(feels_img, (location_img.size[0] + 10, 0))
|
||||
|
||||
min_img = self.textImage( "{0:.0f}".format(current_weather['min_temp']), small_font, r=0, g=0, b=255)
|
||||
|
@ -411,7 +411,7 @@
|
||||
>
|
||||
<option>Down</option>
|
||||
<option>Up</option>
|
||||
<option>Traditional</option>
|
||||
<option>Continuous</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -643,7 +643,7 @@
|
||||
>
|
||||
<option>Down</option>
|
||||
<option>Up</option>
|
||||
<option>Traditional</option>
|
||||
<option>Continuous</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -876,7 +876,7 @@
|
||||
>
|
||||
<option>Down</option>
|
||||
<option>Up</option>
|
||||
<option>Traditional</option>
|
||||
<option>Continuous</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -1110,7 +1110,7 @@
|
||||
>
|
||||
<option>Down</option>
|
||||
<option>Up</option>
|
||||
<option>Traditional</option>
|
||||
<option>Continuous</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -1146,7 +1146,7 @@
|
||||
>
|
||||
<option>Celsius</option>
|
||||
<option>Fahrenheit</option>
|
||||
<option>Kelvin</option>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -1170,41 +1170,9 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row g-3 align-items-center mt-3">
|
||||
<div class="col-auto">
|
||||
<label for="inputScrollSpeed" class="col-form-label"
|
||||
>Text Color:
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<select
|
||||
id="inputScrollSpeed43"
|
||||
class="form-select colour-select"
|
||||
>
|
||||
<option>White</option>
|
||||
<option>Yellow</option>
|
||||
<option>Red</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row g-3 align-items-center mt-3">
|
||||
<div class="col-auto">
|
||||
<label for="inputTransition43" class="col-form-label"
|
||||
>City Text Color:
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<select
|
||||
id="inputTransition43"
|
||||
class="form-select city-colour-select"
|
||||
>
|
||||
<option>Yellow</option>
|
||||
<option>White</option>
|
||||
<option>Red</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="row g-3 align-items-center mt-3">
|
||||
<div class="col-auto">
|
||||
@ -1331,7 +1299,7 @@
|
||||
>
|
||||
<option>Down</option>
|
||||
<option>Up</option>
|
||||
<option>Traditional</option>
|
||||
<option>Continuous</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -1392,41 +1360,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row g-3 align-items-center mt-3">
|
||||
<div class="col-auto">
|
||||
<label for="inputScrollSpeed53" class="col-form-label"
|
||||
>Text Color:
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<select
|
||||
id="inputScrollSpeed53"
|
||||
class="form-select colour-select"
|
||||
>
|
||||
<option>White</option>
|
||||
<option>Yellow</option>
|
||||
<option>Red</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row g-3 align-items-center mt-3">
|
||||
<div class="col-auto">
|
||||
<label for="inputTransition53" class="col-form-label"
|
||||
>City Text Color:
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<select
|
||||
id="inputTransition53"
|
||||
class="form-select city-colour-select"
|
||||
>
|
||||
<option>Yellow</option>
|
||||
<option>White</option>
|
||||
<option>Red</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row g-3 align-items-center mt-3">
|
||||
<div class="col-auto">
|
||||
@ -1570,7 +1504,7 @@
|
||||
>
|
||||
<option>Down</option>
|
||||
<option>Up</option>
|
||||
<option>Traditional</option>
|
||||
<option>Continuous</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -1775,7 +1709,7 @@
|
||||
>
|
||||
<option>Down</option>
|
||||
<option>Up</option>
|
||||
<option>Traditional</option>
|
||||
<option>Continuous</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -1926,7 +1860,7 @@
|
||||
>
|
||||
<option>Down</option>
|
||||
<option>Up</option>
|
||||
<option>Traditional</option>
|
||||
<option>Continuous</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -2077,7 +2011,7 @@
|
||||
>
|
||||
<option>Down</option>
|
||||
<option>Up</option>
|
||||
<option>Traditional</option>
|
||||
<option>Continuous</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -2227,7 +2161,7 @@
|
||||
>
|
||||
<option>Down</option>
|
||||
<option>Up</option>
|
||||
<option>Traditional</option>
|
||||
<option>Continuous</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -2398,7 +2332,7 @@
|
||||
>
|
||||
<option>Down</option>
|
||||
<option>Up</option>
|
||||
<option>Traditional</option>
|
||||
<option>Continuous</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -2578,7 +2512,7 @@
|
||||
>
|
||||
<option>Down</option>
|
||||
<option>Up</option>
|
||||
<option>Traditional</option>
|
||||
<option>Continuous</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -2756,7 +2690,6 @@
|
||||
>
|
||||
<option>Down</option>
|
||||
<option>Up</option>
|
||||
<option>Traditional</option>
|
||||
<option>Continuous</option>
|
||||
</select>
|
||||
</div>
|
||||
|
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.2 KiB |
0
user_uploads/close.gif
Executable file → Normal file
Before Width: | Height: | Size: 821 B After Width: | Height: | Size: 821 B |
Before Width: | Height: | Size: 747 B |