gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r31147 - gnunet/src/util


From: gnunet
Subject: [GNUnet-SVN] r31147 - gnunet/src/util
Date: Fri, 6 Dec 2013 15:54:41 +0100

Author: wachs
Date: 2013-12-06 15:54:40 +0100 (Fri, 06 Dec 2013)
New Revision: 31147

Modified:
   gnunet/src/util/gnunet-qr.py.in
Log:
calling gnunet-uri


Modified: gnunet/src/util/gnunet-qr.py.in
===================================================================
--- gnunet/src/util/gnunet-qr.py.in     2013-12-06 14:36:35 UTC (rev 31146)
+++ gnunet/src/util/gnunet-qr.py.in     2013-12-06 14:54:40 UTC (rev 31147)
@@ -1,6 +1,7 @@
address@hidden@
+#!/usr/bin/python
 import sys
 import getopt
+import subprocess
 from sys import argv
 try:
     import zbar
@@ -16,6 +17,7 @@
   -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 address@hidden
 GNUnet home page: http://www.gnu.org/software/gnunet/\n\
 General help using GNU software: http://www.gnu.org/gethelp/'
@@ -24,10 +26,13 @@
 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)
@@ -43,6 +48,8 @@
                                device = a
                        elif o in ("-s", "--silent"):
                                silent = True
+                       elif o in ("-v", "--verbose"):
+                               silent = True                           
        # create a Processor
        proc = zbar.Processor()
 
@@ -58,9 +65,9 @@
        
        # enable the preview window
        if (True == silent):
+               proc.visible = True
+       else:
                proc.visible = False
-       else:
-               proc.visible = True
        
        # read at least one barcode (or until window closed)
        try:
@@ -74,5 +81,20 @@
        
        # 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]