A i t :
: P G A FC C
{"id":1,
"date":"2017-05-23T06:25:50",
"date_gmt":"2017-05-23T06:25:50",
"guid":{"rendered":"http://demo.wp-api.org/?p=1"},
"modified":"2017-05-23T06:25:50",
"modified_gmt":"2017-05-23T06:25:50",
"slug":"hello-world",
"status":"publish",
"type":"post",
"link":"https://demo.wp-api.org/2017/05/23/hello-world/",
"title":{"rendered":"Hello world!"},
"content":{"rendered":"<p>Welcome to...
- p
G OCIG PVODGS
api="http://example.net/wp-json/wapuu/v1/get"
def img_number():
try:
html = urllib.urlopen( api ).read()
except:
return None
data = json.loads(html)
return data['id']
e t c
G S WG OCIG D PVODGS
image_dir = "~/wapuu/"
viewer = "~/rpi-rgb-led-matrix/utils/led-image-viewer"
opt = " --led-daemon --led-gpio-mapping=adafruit-hat" +
" --led-no-hardware-pulse --led-chain=4 -L"
prev = None
while True:
time.sleep(2)
number = img_number()
if number is None: continue
files = glob.glob(image_dir+number+"-*.png")
if len(files) < 1: continue
if files[0] == prev: continue
if prev is not None: kill_img()
commands.getstatusoutput("sudo "+viewer+opt+files[0])
prev = files[0]
j t c
?VSP QHH OCIG JGP EJCPIG
pattern = r"^ *(d+) .*/led-image-viewer"
def kill_img ():
id = []
ps_list = commands.getoutput('ps awx')
for process in ps_list.split("n"):
match = re.match(pattern, process)
if not match: continue
id.append(match.group(1))
commands.getoutput("sudo kill "+" ".join(id))