point changes and logo options added
This commit is contained in:
@@ -1 +1 @@
|
|||||||
{"speed": "medium", "animation": "continuous", "title": true, "pause": "", "images": ["open.gif", "close.gif"]}
|
{"speed": "medium", "animation": "down", "title": true, "pause": "2", "images": ["open.gif", "close.gif"]}
|
@@ -1 +1 @@
|
|||||||
{"feature": "Stocks", "speed": "medium", "animation": "traditional", "percent": false, "point": true, "logos": true, "chart": false, "title": true, "symbols": {"NEO,USD": {"current": 43.42, "24hr_change": -3.963839231643678}, "BTC,USD": {"current": 49343, "24hr_change": 0.902025932223419}, "ETH,BTC": {"current": 0.06930671, "24hr_change": -1.7367682270496585}, "ADA,GBP": {"current": 1.62, "24hr_change": -3.549646457710461}}}
|
{"feature": "Stocks", "speed": "medium", "animation": "down", "percent": false, "point": true, "logos": true, "chart": false, "title": true, "symbols": {"NEO,USD": {"current": 43.42, "24hr_change": -3.963839231643678}, "BTC,USD": {"current": 49343, "24hr_change": 0.902025932223419}, "ETH,BTC": {"current": 0.06930671, "24hr_change": -1.7367682270496585}, "ADA,GBP": {"current": 1.62, "24hr_change": -3.549646457710461}}}
|
@@ -1 +1 @@
|
|||||||
["Stocks", "Crypto", "Forex"]
|
["Forex Prof", "Stocks Prof", "Crypto Prof"]
|
@@ -1 +1 @@
|
|||||||
{"feature": "Stocks", "speed": "fast", "animation": "down", "percent": false, "point": true, "logos": true, "chart": false, "title": true, "symbols": {"NZD,GBP": {"current": 1.9471, "24hr_change": 0.0029000000000001247}, "CAD,USD": {"current": 1.271, "24hr_change": 0.0033999999999998476}}}
|
{"feature": "Stocks", "speed": "medium", "animation": "down", "percent": false, "point": true, "logos": false, "chart": false, "title": true, "symbols": {"NZD,GBP": {"current": 1.9471, "24hr_change": 0.0029000000000001247}, "CAD,USD": {"current": 1.271, "24hr_change": 0.0033999999999998476}}}
|
@@ -1 +1 @@
|
|||||||
{"speed": "medium", "animation": "traditional", "title": true, "pause": "3", "images": ["XOM.png", "ZBRA.png"]}
|
{"speed": "slow", "animation": "down", "title": true, "pause": "/", "images": ["XOM.png", "ZBRA.png"]}
|
@@ -1 +1 @@
|
|||||||
{"feature": "Stocks", "speed": "slow", "animation": "down", "percent": true, "point": false, "logos": true, "chart": false, "title": true, "symbols": {"MSFT": {"current": 282.63, "opening": 287.28}, "GOOG": {"current": 2665.2, "opening": 2713.99}}}
|
{"feature": "Stocks", "speed": "medium", "animation": "down", "percent": false, "point": true, "logos": false, "chart": false, "title": true, "symbols": {"MSFT": {"current": 282.63, "opening": 287.28}, "GOOG": {"current": 2665.2, "opening": 2713.99}}}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
display_images/working_gif.gif
Normal file
BIN
display_images/working_gif.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.6 KiB |
136
stockTicker.py
136
stockTicker.py
@@ -311,7 +311,7 @@ class StockTicker():
|
|||||||
|
|
||||||
def set_delay(self,speed):
|
def set_delay(self,speed):
|
||||||
if speed.lower() == 'slow':
|
if speed.lower() == 'slow':
|
||||||
self.delay = 0.04
|
self.delay = 0.03
|
||||||
elif speed.lower() == 'medium':
|
elif speed.lower() == 'medium':
|
||||||
self.delay = 0.02
|
self.delay = 0.02
|
||||||
elif speed.lower() == 'fast':
|
elif speed.lower() == 'fast':
|
||||||
@@ -886,17 +886,23 @@ class StockTicker():
|
|||||||
ticker, base = cb.split(',')
|
ticker, base = cb.split(',')
|
||||||
current = coin_info[cb]["current"]
|
current = coin_info[cb]["current"]
|
||||||
change = coin_info[cb]["24hr_change"]
|
change = coin_info[cb]["24hr_change"]
|
||||||
|
current = '%.2f' % current
|
||||||
|
|
||||||
|
arrow, change = self.getArrow(change)
|
||||||
|
|
||||||
if all_crypto_settings["point"]:
|
if all_crypto_settings["point"]:
|
||||||
# convert percent to points
|
# convert percent to points
|
||||||
change = change/100 * current
|
change = change/100 * current
|
||||||
|
|
||||||
current = '%.2f' % current
|
|
||||||
|
|
||||||
arrow, change = self.getArrow(change)
|
|
||||||
change = '%.2f' % change
|
change = '%.2f' % change
|
||||||
|
else:
|
||||||
|
change = '%.2f' % change +'%'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
midFrame = self.textToImage(ticker + '(' + base + ')', current, change, arrow) #IMAGE THE TEXT
|
midFrame = self.textToImage(ticker + '(' + base + ')', current, change, arrow) #IMAGE THE TEXT
|
||||||
|
|
||||||
|
if all_crypto_settings['logos']:
|
||||||
try:
|
try:
|
||||||
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'crypto')
|
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'crypto')
|
||||||
|
|
||||||
@@ -905,6 +911,9 @@ class StockTicker():
|
|||||||
except:
|
except:
|
||||||
|
|
||||||
stitchedStock = midFrame
|
stitchedStock = midFrame
|
||||||
|
else:
|
||||||
|
stitchedStock = midFrame
|
||||||
|
|
||||||
image_list.append(stitchedStock)
|
image_list.append(stitchedStock)
|
||||||
|
|
||||||
image_list.append(self.blank)
|
image_list.append(self.blank)
|
||||||
@@ -943,16 +952,23 @@ class StockTicker():
|
|||||||
current = coin_info[cb]["current"]
|
current = coin_info[cb]["current"]
|
||||||
change = coin_info[cb]["24hr_change"]
|
change = coin_info[cb]["24hr_change"]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
arrow, change = self.getArrow(change, professional=True)
|
||||||
|
|
||||||
if all_crypto_settings["point"]:
|
if all_crypto_settings["point"]:
|
||||||
# convert percent to points
|
# convert percent to points
|
||||||
change = change/100 * current
|
change = change/100 * current
|
||||||
|
change = '%.2f' % change
|
||||||
|
else:
|
||||||
|
|
||||||
|
change = '%.2f' % change +'%'
|
||||||
|
|
||||||
current = '%.2f' % current
|
current = '%.2f' % current
|
||||||
|
|
||||||
arrow, change = self.getArrow(change, professional=True)
|
|
||||||
change = '%.2f' % change
|
|
||||||
midFrame = self.textToImageProf(ticker + '(' + base + ')', current, change, arrow, font=ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
|
midFrame = self.textToImageProf(ticker + '(' + base + ')', current, change, arrow, font=ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
|
||||||
|
if all_crypto_settings['logos']:
|
||||||
try:
|
try:
|
||||||
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'crypto')
|
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'crypto')
|
||||||
logo = Image.open(os.path.join(logos_path, ticker + '.png'))
|
logo = Image.open(os.path.join(logos_path, ticker + '.png'))
|
||||||
@@ -962,6 +978,8 @@ class StockTicker():
|
|||||||
stitchedStock = self.stitchImage([logo,midFrame])
|
stitchedStock = self.stitchImage([logo,midFrame])
|
||||||
except:
|
except:
|
||||||
|
|
||||||
|
stitchedStock = midFrame
|
||||||
|
else:
|
||||||
stitchedStock = midFrame
|
stitchedStock = midFrame
|
||||||
image_list.append(stitchedStock)
|
image_list.append(stitchedStock)
|
||||||
|
|
||||||
@@ -995,12 +1013,25 @@ class StockTicker():
|
|||||||
current = forex_settings[sb]['current']
|
current = forex_settings[sb]['current']
|
||||||
change = forex_settings[sb]['24hr_change']
|
change = forex_settings[sb]['24hr_change']
|
||||||
|
|
||||||
current = '%.3f' % current
|
|
||||||
|
|
||||||
arrow, change = self.getArrow(change)
|
arrow, change = self.getArrow(change)
|
||||||
|
|
||||||
|
if all_forex_settings["percent"]:
|
||||||
|
# convert percent to points
|
||||||
|
change = change/current * 100
|
||||||
|
|
||||||
|
change = '%.2f' % change + '%'
|
||||||
|
else:
|
||||||
change = '%.6f' % change
|
change = '%.6f' % change
|
||||||
|
|
||||||
|
current = '%.3f' % current
|
||||||
|
|
||||||
|
|
||||||
midFrame = self.textToImage(symbol+ '(' + base + ')', current, change, arrow) #IMAGE THE TEXT
|
midFrame = self.textToImage(symbol+ '(' + base + ')', current, change, arrow) #IMAGE THE TEXT
|
||||||
|
|
||||||
|
|
||||||
|
if all_forex_settings['logos']:
|
||||||
try:
|
try:
|
||||||
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'currencies')
|
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'currencies')
|
||||||
|
|
||||||
@@ -1051,14 +1082,23 @@ class StockTicker():
|
|||||||
current = forex_settings[sb]['current']
|
current = forex_settings[sb]['current']
|
||||||
change = forex_settings[sb]['24hr_change']
|
change = forex_settings[sb]['24hr_change']
|
||||||
|
|
||||||
current = '%.3f' % current
|
|
||||||
|
|
||||||
|
|
||||||
arrow, change = self.getArrow(change, professional = True)
|
arrow, change = self.getArrow(change, professional = True)
|
||||||
|
|
||||||
|
|
||||||
|
if all_forex_settings["percent"]:
|
||||||
|
# convert percent to points
|
||||||
|
change = change/current * 100
|
||||||
|
|
||||||
|
change = '%.2f' % change + '%'
|
||||||
|
else:
|
||||||
change = '%.6f' % change
|
change = '%.6f' % change
|
||||||
|
current = '%.3f' % current
|
||||||
midFrame = self.textToImageProf(symbol + '(' + base + ')', current, change, arrow, font = ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
|
midFrame = self.textToImageProf(symbol + '(' + base + ')', current, change, arrow, font = ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
|
||||||
|
|
||||||
|
if all_forex_settings['logos']:
|
||||||
try:
|
try:
|
||||||
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'currencies')
|
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'currencies')
|
||||||
|
|
||||||
@@ -1116,13 +1156,22 @@ class StockTicker():
|
|||||||
|
|
||||||
change = float(info['current'])-float(info['opening']) #TEXT
|
change = float(info['current'])-float(info['opening']) #TEXT
|
||||||
ticker = symbol #TEXT
|
ticker = symbol #TEXT
|
||||||
current = '%.2f' % float(info['current']) #TEXT
|
|
||||||
|
|
||||||
arrow, change = self.getArrow(change)
|
arrow, change = self.getArrow(change)
|
||||||
|
|
||||||
|
if all_stocks_settings["percent"]:
|
||||||
|
change = change/float(info['current']) * 100
|
||||||
|
|
||||||
|
change = '%.2f' % change + '%'
|
||||||
|
else:
|
||||||
change = '%.2f' % change
|
change = '%.2f' % change
|
||||||
|
|
||||||
|
|
||||||
|
current = '%.2f' % float(info['current']) #TEXT
|
||||||
midFrame = self.textToImage(ticker, current, change, arrow) #IMAGE THE TEXT
|
midFrame = self.textToImage(ticker, current, change, arrow) #IMAGE THE TEXT
|
||||||
|
|
||||||
|
if all_stocks_settings['logos']:
|
||||||
try:
|
try:
|
||||||
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'stocks')
|
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'stocks')
|
||||||
|
|
||||||
@@ -1131,6 +1180,8 @@ class StockTicker():
|
|||||||
except:
|
except:
|
||||||
|
|
||||||
stitchedStock = midFrame
|
stitchedStock = midFrame
|
||||||
|
else:
|
||||||
|
stitchedStock = midFrame
|
||||||
|
|
||||||
image_list.append(stitchedStock)
|
image_list.append(stitchedStock)
|
||||||
|
|
||||||
@@ -1169,14 +1220,22 @@ class StockTicker():
|
|||||||
|
|
||||||
change = float(info['current'])-float(info['opening']) #TEXT
|
change = float(info['current'])-float(info['opening']) #TEXT
|
||||||
ticker = symbol #TEXT
|
ticker = symbol #TEXT
|
||||||
current = '%.2f' % float(info['current']) #TEXT
|
|
||||||
|
|
||||||
|
|
||||||
arrow, change = self.getArrow(change, professional=True)
|
arrow, change = self.getArrow(change, professional=True)
|
||||||
|
|
||||||
|
if all_stocks_settings["percent"]:
|
||||||
|
# convert percent to points
|
||||||
|
change = change/float(info['current'])* 100
|
||||||
|
|
||||||
|
change = '%.2f' % change + '%'
|
||||||
|
else:
|
||||||
change = '%.2f' % change
|
change = '%.2f' % change
|
||||||
|
current = '%.2f' % float(info['current']) #TEXT
|
||||||
midFrame = self.textToImageProf(ticker, current, change, arrow, font=ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
|
midFrame = self.textToImageProf(ticker, current, change, arrow, font=ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
|
||||||
|
|
||||||
|
if all_stocks_settings['logos']:
|
||||||
try:
|
try:
|
||||||
try: #load the tiny logo
|
try: #load the tiny logo
|
||||||
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'tiny_stocks')
|
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'tiny_stocks')
|
||||||
@@ -1196,6 +1255,8 @@ class StockTicker():
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
||||||
stitchedStock = midFrame
|
stitchedStock = midFrame
|
||||||
|
else:
|
||||||
|
stitchedStock = midFrame
|
||||||
|
|
||||||
image_list.append(stitchedStock)
|
image_list.append(stitchedStock)
|
||||||
|
|
||||||
@@ -2152,19 +2213,21 @@ class StockTicker():
|
|||||||
|
|
||||||
def getUserImages(self):
|
def getUserImages(self):
|
||||||
|
|
||||||
title_img = self.openImage('feature_titles/images.png')
|
|
||||||
|
|
||||||
f = open('csv/image_settings.json', 'r')
|
f = open('csv/image_settings.json', 'r')
|
||||||
all_settings = json.load(f)
|
all_settings = json.load(f)
|
||||||
f.close()
|
f.close()
|
||||||
if all_settings['title']:
|
|
||||||
imgs = [title_img]
|
|
||||||
else:
|
|
||||||
imgs = []
|
imgs = []
|
||||||
|
for ind,image in enumerate(all_settings['images']):
|
||||||
for image in all_settings['images']:
|
|
||||||
|
|
||||||
img = self.openImage(os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'user_uploads'), image))
|
img = self.openImage(os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'user_uploads'), image))
|
||||||
|
|
||||||
|
if all_settings['title'] and ind == 0:
|
||||||
|
title_img = self.openImage('feature_titles/images.png')
|
||||||
|
imgs.append(self.stitchImage([title_img, img]))
|
||||||
|
|
||||||
|
else:
|
||||||
imgs.append(img)
|
imgs.append(img)
|
||||||
|
|
||||||
|
|
||||||
@@ -2175,14 +2238,29 @@ class StockTicker():
|
|||||||
all_settings = json.load(f)
|
all_settings = json.load(f)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
if all_settings['title']:
|
|
||||||
title_img = self.openImage('feature_titles/gifs.png')
|
|
||||||
GIFs = [title_img]
|
|
||||||
else:
|
|
||||||
GIFs = []
|
GIFs = []
|
||||||
|
|
||||||
for f in all_settings['images']:
|
for ind,fle in enumerate(all_settings['images']):
|
||||||
GIF = Image.open(os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'user_uploads'), f))
|
|
||||||
|
|
||||||
|
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 = []
|
||||||
|
title_img = self.openImage('feature_titles/gifs.png')
|
||||||
|
|
||||||
|
for i, frame in enumerate(ImageSequence.Iterator(GIF)):
|
||||||
|
|
||||||
|
|
||||||
|
f = self.stitchImage([title_img, frame])
|
||||||
|
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:
|
||||||
|
|
||||||
GIFs.append(GIF)
|
GIFs.append(GIF)
|
||||||
|
|
||||||
#below code stitches title and GIF together
|
#below code stitches title and GIF together
|
||||||
|
@@ -1988,8 +1988,11 @@
|
|||||||
id="inputText12"
|
id="inputText12"
|
||||||
class="form-control pause-select"
|
class="form-control pause-select"
|
||||||
aria-describedby="TextHelpInline"
|
aria-describedby="TextHelpInline"
|
||||||
|
value={{image_settings.pause}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!--
|
||||||
<div class="col-auto">
|
<div class="col-auto">
|
||||||
<input
|
<input
|
||||||
class="form-check-input"
|
class="form-check-input"
|
||||||
@@ -1999,6 +2002,7 @@
|
|||||||
checked
|
checked
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
-->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row g-3 align-items-center mt-3">
|
<div class="row g-3 align-items-center mt-3">
|
||||||
@@ -2140,8 +2144,10 @@
|
|||||||
id="inputText112"
|
id="inputText112"
|
||||||
class="form-control pause-select"
|
class="form-control pause-select"
|
||||||
aria-describedby="TextHelpInline"
|
aria-describedby="TextHelpInline"
|
||||||
|
value={{GIF_settings.pause}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<!--
|
||||||
<div class="col-auto">
|
<div class="col-auto">
|
||||||
<input
|
<input
|
||||||
class="form-check-input"
|
class="form-check-input"
|
||||||
@@ -2151,6 +2157,7 @@
|
|||||||
checked
|
checked
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
-->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row g-3 align-items-center mt-3">
|
<div class="row g-3 align-items-center mt-3">
|
||||||
|
Reference in New Issue
Block a user