gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r31151 - gnunet/src/util
Date: Fri, 6 Dec 2013 17:25:50 +0100

Author: wachs
Date: 2013-12-06 17:25:50 +0100 (Fri, 06 Dec 2013)
New Revision: 31151

Modified:
   gnunet/src/util/gnunet-qr.py.in
Log:
not working 


Modified: gnunet/src/util/gnunet-qr.py.in
===================================================================
--- gnunet/src/util/gnunet-qr.py.in     2013-12-06 15:52:55 UTC (rev 31150)
+++ gnunet/src/util/gnunet-qr.py.in     2013-12-06 16:25:50 UTC (rev 31151)
@@ -1,4 +1,4 @@
-#!/usr/bin/python
address@hidden@
 import sys
 import getopt
 import subprocess
@@ -28,7 +28,6 @@
        device = '/dev/video0'
        url = ''
        verbose = False 
-       
        silent = False
        # Parse arguments
        try:
@@ -37,19 +36,21 @@
                help ()
                print str (e)
                exit (1)
-
-               for o,a in opts:
-                       if o in ("-h", "--help"):
-                               help ()            
-                               sys.exit (0)
-                       elif o in ("-c", "--config"):
-                               configuration = a
-                       elif o in ("-d", "--device"):
-                               device = a
-                       elif o in ("-s", "--silent"):
-                               silent = True
-                       elif o in ("-v", "--verbose"):
-                               silent = True                           
+       print "asdsa"
+       for o,a in opts:
+               if o in ("-h", "--help"):
+                       help ()            
+                       sys.exit (0)
+               elif o in ("-c", "--config"):
+                       configuration = a
+               elif o in ("-d", "--device"):
+                       device = a
+               elif o in ("-s", "--silent"):
+                       silent = True
+               elif o in ("-v", "--verbose"):
+                       verbose = True                  
+       id (True == verbose):
+               print 'Initializing'
        # create a Processor
        proc = zbar.Processor()
 
@@ -58,19 +59,24 @@
 
        # initialize the Processor
        try:
+               id (True == verbose):
+                       print 'Opening video device ' + device
                proc.init(device)
        except Exception as e:
                print 'Failed to open device ' + device
                exit (1)
        
        # enable the preview window
-       if (True == silent):
-               proc.visible = True
-       else:
-               proc.visible = False
+       #if (True == silent):
+       #       proc.visible = True
+       #else:
+       #               proc.visible = False
        
+       proc.visible = True
        # read at least one barcode (or until window closed)
        try:
+               id (True == verbose):
+                       print 'Capturing'
                proc.process_one()
        except Exception as e:
                # Window was closed without finding code
@@ -82,19 +88,20 @@
        # extract results
        for symbol in proc.results:
                # do something useful with results
-               if (verbose):
+               if (True == 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)
+                       args.append (str("-c " + str(configuration)))
+               args.append (str(symbol.data))
+               cmd = ''
+               for a in args:
+                       cmd += " " + str(a)
                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
+               res=subprocess.call(args)
+               if (0 != res):
+                       print 'Failed to '
+               exit (res)
+       exit (1)




reply via email to

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