[xiph-cvs] cvs commit: positron/positron add_file.py

Stan Seibert volsung at xiph.org
Mon Sep 8 07:12:19 PDT 2003



volsung     03/09/08 10:12:18

  Modified:    positron add_file.py
  Log:
  Provide feedback while scanning directories.  Closes bug 368.

Revision  Changes    Path
1.5       +11 -3     positron/positron/add_file.py

Index: add_file.py
===================================================================
RCS file: /usr/local/cvsroot/positron/positron/add_file.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- add_file.py	6 Sep 2003 23:02:55 -0000	1.4
+++ add_file.py	8 Sep 2003 14:12:18 -0000	1.5
@@ -17,18 +17,19 @@
 
 "Utility module for adding files to the Neuros.  Used by cmd_sync and cmd_add."
 
+import sys
 import os
 from os import path
 import audiofile
 from neuros import Neuros
 import util
 
-
 def gen_filelist(neuros, prefix, suffix, target_prefix,
-                 allowed_types, silent=False):
+                 allowed_types, silent=False, status=True):
     filelist = []
     fullname = path.join(prefix, suffix)
-
+    clearline =  "\r"+" "*70+"\r"
+    
     if path.isdir(fullname):
         files = [path.join(suffix,name) for name in os.listdir(fullname)]
     else:
@@ -57,6 +58,13 @@
                     filelist.append((fullname, targetname, metadata))
                     
         elif path.isdir(fullname):
+            if status:
+                sys.stderr.write(clearline)
+                status = "Scanning %s" % (fullname,)
+                if len(status) > 70:
+                    status = status[:67] + "..." 
+                sys.stderr.write(status+"\r")
+                    
             filelist.extend(gen_filelist(neuros, prefix, name, target_prefix,
                                          allowed_types, silent))
         else:

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list