-#!@PYTHON@
+#!/usr/bin/python
import sys
import getopt
+import subprocess
from sys import argv
try:
import zbar
-d, --device=DEVICE use device DEVICE\n\
-s, --silent do not show preview windows\n\
-h, --help print this help\n\
+ -v, --verbose be verbose\n\
Report bugs to gnunet-developers@gnu.org.\n\
GNUnet home page: http://www.gnu.org/software/gnunet/\n\
General help using GNU software: http://www.gnu.org/gethelp/'
if __name__ == '__main__':
configuration = ''
device = '/dev/video0'
+ url = ''
+ verbose = False
+
silent = False
# Parse arguments
try:
- opts, args = getopt.gnu_getopt(sys.argv[1:], "c:hd:s", ["config","help", "device","silent"])
+ opts, args = getopt.gnu_getopt(sys.argv[1:], "c:hd:sv", ["config","help", "device","silent","verbose"])
except getopt.GetoptError as e:
help ()
print str (e)
device = a
elif o in ("-s", "--silent"):
silent = True
+ elif o in ("-v", "--verbose"):
+ silent = True
# create a Processor
proc = zbar.Processor()
# enable the preview window
if (True == silent):
- proc.visible = False
- else:
proc.visible = True
+ else:
+ proc.visible = False
# read at least one barcode (or until window closed)
try:
# extract results
for symbol in proc.results:
- # do something useful with results
- print 'Found ', symbol.type, ' symbol ', '"%s"' % symbol.data
\ No newline at end of file
+ # do something useful with results
+ if (verbose):
+ print 'Found ', symbol.type, ' symbol ', '"%s"' % symbol.data
+ args = list()
+ args.append("gnunet-uri")
+ if (configuration != ''):
+ args.append ("-c " + str(configuration))
+ args.append (url)
+ if (verbose):
+ for a in args:
+ cmd += str (a)
+ print 'Running ' + cmd
+ ls_output=subprocess.call(args)
+ print ls_output
+ exit (ls_output)
+
+
\ No newline at end of file