aboutsummaryrefslogtreecommitdiff
path: root/pyAggr3g470r.py
diff options
context:
space:
mode:
authorcedricbonhomme <devnull@localhost>2010-07-23 12:28:12 +0200
committercedricbonhomme <devnull@localhost>2010-07-23 12:28:12 +0200
commitdb70d267ebc6eca375c2a5b3253ed246dddcb2ec (patch)
treea99c65cb831561019d7e79eb771566f651054187 /pyAggr3g470r.py
parentAdded PyQRNative module. (diff)
downloadnewspipe-db70d267ebc6eca375c2a5b3253ed246dddcb2ec.tar.gz
newspipe-db70d267ebc6eca375c2a5b3253ed246dddcb2ec.tar.bz2
newspipe-db70d267ebc6eca375c2a5b3253ed246dddcb2ec.zip
Minor improvement when a URL is too long for the QR Code generation.
Diffstat (limited to 'pyAggr3g470r.py')
-rwxr-xr-xpyAggr3g470r.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py
index 45341381..eb1597d2 100755
--- a/pyAggr3g470r.py
+++ b/pyAggr3g470r.py
@@ -362,13 +362,21 @@ class Root:
for article in articles_list:
if article_id == article[0]:
+ try:
+ os.makedirs("./var/qrcode/")
+ except OSError:
+ pass
if not os.path.isfile("./var/qrcode/"+article_id+".png"):
# QR code generation
- qr = PyQRNative.QRCode(5, PyQRNative.QRErrorCorrectLevel.L)
- qr.addData(article[3])
- qr.make()
- im = qr.makeImage()
- im.save("./var/qrcode/"+article_id+".png", format='png')
+ try:
+ qr = PyQRNative.QRCode(15, PyQRNative.QRErrorCorrectLevel.L)
+ qr.addData(article[3])
+ qr.make()
+ im = qr.makeImage()
+ im.save("./var/qrcode/"+article_id+".png", format='png')
+ except Exception, e:
+ # Code length overflow
+ print e
if article[5] == "0":
self.mark_as_read("Article:"+article[3]) # update the database
bgstack15