-#@PYTHON@
+#!@PYTHON@
import sys
import getopt
import subprocess
from sys import argv
try:
- import zbar
+ import zbar
except ImportError as e:
- print 'Cannot run gnunet-qr, please install zbar-python'
- sys.exit (1)
+ print 'Cannot run gnunet-qr, please install zbar-python'
+ sys.exit (1)
def help ():
print 'gnunet-qr\n\
help ()
print str (e)
exit (1)
- print "asdsa"
for o,a in opts:
if o in ("-h", "--help"):
help ()
silent = True
elif o in ("-v", "--verbose"):
verbose = True
- id (True == verbose):
+ if (True == verbose):
print 'Initializing'
# create a Processor
proc = zbar.Processor()
# initialize the Processor
try:
- id (True == verbose):
+ if (True == verbose):
print 'Opening video device ' + device
proc.init(device)
except Exception as e:
proc.visible = True
# read at least one barcode (or until window closed)
try:
- id (True == verbose):
+ if (True == verbose):
print 'Capturing'
proc.process_one()
except Exception as e:
for a in args:
cmd += " " + str(a)
if (verbose):
- print 'Running ' + cmd
+ print 'Running `' + cmd +'`'
res=subprocess.call(args)
if (0 != res):
- print 'Failed to '
+ print 'Failed to add URI ' + str(symbol.data)
+ else:
+ print 'Added URI ' + str(symbol.data)
exit (res)
exit (1)