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

Stan Seibert volsung at xiph.org
Sat Sep 6 14:26:11 PDT 2003



volsung     03/09/06 17:26:11

  Modified:    positron cmd_del.py
  Log:
  Remember that SAI index is not preserved if the database is modified.
  Look up index just before you need it.  Fixes bug 410.

Revision  Changes    Path
1.3       +7 -7      positron/positron/cmd_del.py

Index: cmd_del.py
===================================================================
RCS file: /usr/local/cvsroot/positron/positron/cmd_del.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- cmd_del.py	25 May 2003 01:44:03 -0000	1.2
+++ cmd_del.py	6 Sep 2003 21:26:10 -0000	1.3
@@ -50,7 +50,7 @@
         if sai_index == None:
             empty = False
         else:
-            filelist.append((fullname, sai_index))
+            filelist.append((fullname, neuros_path))
                     
     elif path.isdir(pathname):
         subs = os.listdir(pathname)
@@ -71,14 +71,14 @@
     return (filelist, empty)
 
 
-def del_track(config, neuros, sourcename, sai_index):
+def del_track(config, neuros, sourcename, filename):
     try:
         os.remove(sourcename)
-        neuros_path = neuros.db["audio"].get_record(sai_index)[8].lower()
+        sai_index = neuros.db["audio"].find(filename, 8)
         
         # Remove entry from database
         neuros.db["audio"].delete_record(sai_index)
-        config.add_deleted(neuros_path)
+        config.add_deleted(filename.lower())
         
     except os.error, e:
         print "Error:", e
@@ -109,11 +109,11 @@
     else:
         tracks = len([item for item in filelist if item[1] != None])
         print "Removing %d tracks from the Neuros..." % (tracks,)
-        for (sourcename, sai_index) in filelist:
+        for (sourcename, filename) in filelist:
             basename = path.basename(sourcename)
-            if sai_index != None:
+            if filename != None:
                 print "  %s..." % (basename, )
-                del_track(config, neuros, sourcename, sai_index)
+                del_track(config, neuros, sourcename, filename)
             else:
                 print "  Removing empty directory %s..." % (sourcename, )
                 try:

<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