123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- import requests
- import re
- import time
- import argparse
- from luma.led_matrix.device import max7219
- from luma.core.interface.serial import spi, noop
- from luma.core.render import canvas
- from luma.core.virtual import viewport
- from luma.core.legacy import text, show_message
- from luma.core.legacy.font import proportional, CP437_FONT, TINY_FONT, SINCLAIR_FONT, LCD_FONT
- while(1):
- page = requests.get("http://www.bitcoinblockhalf.com/")
- from bs4 import BeautifulSoup
- soup = BeautifulSoup(page.content, 'html.parser')
- data = []
- for paragraph in soup.find_all('td'):
- data.append(paragraph.string)
- disp = [0]*38
- for x in range(len(data)):
- if x % 2 == 0:
- disp.append(data[x])
- if data[x+1] == None:
- disp.append(data[x+1])
- else:
- disp.append((data[x+1]).replace(',',''))
- disp = list(filter(lambda a:a != 0, disp))
-
- serial = spi(port=0, device=0, gpio=noop())
- device = max7219(serial, cascaded=4 , block_orientation=-90, rotate=0)
- for i in range(len(disp)):
- show_message(device, disp[i], fill="white", font=proportional(LCD_FONT),scroll_delay = 0.02)
-
-
|