real time updating during continuous scrolling added
This commit is contained in:
@@ -9,7 +9,7 @@ sandboxAPIkey = "sandbox_c24qddqad3ickpckgg8g"
|
|||||||
finnhubClient = finnhub.Client(api_key=APIkey)
|
finnhubClient = finnhub.Client(api_key=APIkey)
|
||||||
|
|
||||||
NY_zone = pytz.timezone('America/New_York')
|
NY_zone = pytz.timezone('America/New_York')
|
||||||
NY_time = datetime.now(NY_zone)
|
|
||||||
|
|
||||||
opening = NY_time.replace(hour=9, minute=30, second=0, microsecond=0)
|
opening = NY_time.replace(hour=9, minute=30, second=0, microsecond=0)
|
||||||
closing = NY_time.replace(hour=16, minute=0, second=0, microsecond=0)
|
closing = NY_time.replace(hour=16, minute=0, second=0, microsecond=0)
|
||||||
@@ -19,6 +19,8 @@ closing = NY_time.replace(hour=16, minute=0, second=0, microsecond=0)
|
|||||||
|
|
||||||
|
|
||||||
def getStockPrices():
|
def getStockPrices():
|
||||||
|
NY_time = datetime.now(NY_zone)
|
||||||
|
|
||||||
|
|
||||||
if opening < NY_time < closing:
|
if opening < NY_time < closing:
|
||||||
apiCalledError = False
|
apiCalledError = False
|
||||||
|
@@ -106,12 +106,16 @@ class StockTicker():
|
|||||||
while True:
|
while True:
|
||||||
|
|
||||||
if current_img == 1:
|
if current_img == 1:
|
||||||
|
self.getFullStockImage(1)
|
||||||
image1 = self.openImage(image_files[0])
|
image1 = self.openImage(image_files[0])
|
||||||
image2 = self.openImage(image_files[1])
|
image2 = self.openImage(image_files[1])
|
||||||
elif current_img == 2:
|
elif current_img == 2:
|
||||||
|
self.getFullStockImage(2)
|
||||||
image1 = self.openImage(image_files[1])
|
image1 = self.openImage(image_files[1])
|
||||||
image2 = self.openImage(image_files[0])
|
image2 = self.openImage(image_files[0])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
img_width, img_height = image1.size
|
img_width, img_height = image1.size
|
||||||
print('wh:', self.matrix.width, self.matrix.height)
|
print('wh:', self.matrix.width, self.matrix.height)
|
||||||
|
|
||||||
@@ -226,7 +230,7 @@ class StockTicker():
|
|||||||
self.matrix.SetPixel(x , y , 0,0,0)
|
self.matrix.SetPixel(x , y , 0,0,0)
|
||||||
|
|
||||||
#Connect all the pieces togeather creating 1 long final stock image
|
#Connect all the pieces togeather creating 1 long final stock image
|
||||||
def getFullStockImage(self):
|
def getFullStockImage(self, updated_img):
|
||||||
|
|
||||||
image_list = []
|
image_list = []
|
||||||
|
|
||||||
@@ -263,7 +267,11 @@ class StockTicker():
|
|||||||
image_list.append(stitchedStock)
|
image_list.append(stitchedStock)
|
||||||
|
|
||||||
finalDisplayImage = self.stitchImage(image_list)
|
finalDisplayImage = self.stitchImage(image_list)
|
||||||
finalDisplayImage.save('final.ppm')
|
|
||||||
|
if updated_img == 1:
|
||||||
|
finalDisplayImage.save('final.ppm')
|
||||||
|
elif updated_img == 2:
|
||||||
|
finalDisplayImage.save('final1.ppm')
|
||||||
|
|
||||||
#Send the final stitched image to the display for set amount of time
|
#Send the final stitched image to the display for set amount of time
|
||||||
def displayMatrix(self):
|
def displayMatrix(self):
|
||||||
@@ -331,7 +339,7 @@ class StockTicker():
|
|||||||
def process_msg(self, msg):
|
def process_msg(self, msg):
|
||||||
|
|
||||||
if msg == 'S':
|
if msg == 'S':
|
||||||
self.getFullStockImage()
|
self.getFullStockImage(1)
|
||||||
self.displayMatrix()
|
self.displayMatrix()
|
||||||
|
|
||||||
|
|
||||||
@@ -361,16 +369,16 @@ if __name__ == '__main__':
|
|||||||
speed, brightness = row
|
speed, brightness = row
|
||||||
|
|
||||||
print(speed, brightness)
|
print(speed, brightness)
|
||||||
stock_ticker.process_msg(brightness)
|
#stock_ticker.process_msg(brightness)
|
||||||
stock_ticker.process_msg(speed)
|
#stock_ticker.process_msg(speed)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#t = time.time()
|
#t = time.time()
|
||||||
#api_caller = pexpect.spawn("sudo -E python3 api_caller.py")
|
#api_caller = pexpect.spawn("sudo -E python3 api_caller.py")
|
||||||
#print('time to call api', time.time()-t)
|
#print('time to call api', time.time()-t)
|
||||||
#stock_ticker.getFullStockImage()
|
stock_ticker.getFullStockImage(1)
|
||||||
#stock_ticker.displayMatrix()
|
stock_ticker.displayMatrix()
|
||||||
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
Reference in New Issue
Block a user