Gamaliel Espinoza 8 rokov pred
rodič
commit
fb64af9f5e
2 zmenil súbory, kde vykonal 10 pridanie a 4 odobranie
  1. 1 1
      tools/fourier/__init__.py
  2. 9 3
      tools/fourier/cli.py

+ 1 - 1
tools/fourier/__init__.py

@@ -1 +1 @@
-__version__ = '1.0.5'
+__version__ = '1.0.6'

+ 9 - 3
tools/fourier/cli.py

@@ -67,6 +67,7 @@ def main():
                           const=True,
                           default=False
                           )
+    dbparser.add_argument('-limit', type=int, dest='limit')
 
     stations_parser = subparsers.add_parser('station')
     stations_parser.add_argument('action')
@@ -203,9 +204,14 @@ def main():
             re_station = re.compile(r'^/var/fourier/[^/]+/([^/]+)')
             conn = sqlite3.connect(dbpath)
             cursor = conn.cursor()
-            cursor.execute(('select hash, filename '
-                            'from file '
-                            'where station is null'))
+            query = ('select hash, filename '
+                     'from file '
+                     'where station is null ')
+
+            if args.limit:
+                query += ' limit {}'.format(args.limit)
+                
+            cursor.execute(query)
 
             for row in cursor:
                 the_hash, filename, = row