|
@@ -18,6 +18,19 @@ def eink_qr(args):
|
|
|
epd.sleep()
|
|
epd.sleep()
|
|
|
epd.Dev_exit()
|
|
epd.Dev_exit()
|
|
|
|
|
|
|
|
|
|
+def eink_qr_shorturl(args):
|
|
|
|
|
+ import requests
|
|
|
|
|
+ from urllib.parse import urlencode
|
|
|
|
|
+ try:
|
|
|
|
|
+ params = urlencode({
|
|
|
|
|
+ "url": args.text,
|
|
|
|
|
+ })
|
|
|
|
|
+ r = requests.get('https://tinyurl.com/api-create.php?'+str(params))
|
|
|
|
|
+ args.text = r.text
|
|
|
|
|
+ except Exception as ex:
|
|
|
|
|
+ args.text = str(ex)[:100]
|
|
|
|
|
+ eink_qr(args)
|
|
|
|
|
+
|
|
|
def eink_quote_qr(args):
|
|
def eink_quote_qr(args):
|
|
|
pass
|
|
pass
|
|
|
|
|
|
|
@@ -41,7 +54,7 @@ def eink_text(args):
|
|
|
image = Image.new('1', (epd.height, epd.width), 0)
|
|
image = Image.new('1', (epd.height, epd.width), 0)
|
|
|
draw = ImageDraw.Draw(image)
|
|
draw = ImageDraw.Draw(image)
|
|
|
|
|
|
|
|
- text, longline = simpilib.wrapText(args.text, line_width_factor=5)
|
|
|
|
|
|
|
+ text, longline = simpilib.wrapText(args.text, line_width_factor=7)
|
|
|
font = simpilib.loadFontSize(text, draw, image, fontpath)
|
|
font = simpilib.loadFontSize(text, draw, image, fontpath)
|
|
|
|
|
|
|
|
w, h = draw.textsize(text, font=font)
|
|
w, h = draw.textsize(text, font=font)
|