[xiph-cvs] cvs commit: positron/positron/db MDB.py WOID.py

Stan Seibert volsung at xiph.org
Sat Oct 25 08:18:57 PDT 2003



volsung     03/10/25 11:18:57

  Modified:    .        ChangeLog
               positron/db MDB.py WOID.py
  Log:
  Firmwares after 1.41 change the semantics of the isModified bit so that
  it should be set if the database was modified by the sync program.
  (Previously only the Neuros would set the bit if the firmware modified a
  database.)  It does not appear that older firmwares ever clear this bit,
  but it doesn't appear to cause any problems.  Closes bug 469.

Revision  Changes    Path
1.7       +12 -1     positron/ChangeLog

Index: ChangeLog
===================================================================
RCS file: /usr/local/cvsroot/positron/ChangeLog,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ChangeLog	2 Jul 2003 17:57:30 -0000	1.6
+++ ChangeLog	25 Oct 2003 15:18:56 -0000	1.7
@@ -1,7 +1,18 @@
 Version ??? (???):
         * mp3_support option added to permit MP3 support to be disabled.
         Handy for testing firmwares that lack MP3 support.
-
+	* Fixed serious bug that caused deletion of multiple files to be done
+	incorrectly.
+	* Positron now preserves the access and modification times of files
+	when copying them to the Neuros, allowing the use of standard
+	synchronization tools like rsync.
+	* Major improvement of MP3 detection and parsing code.
+	* Vastly improved database sorting, including sorting by track number.
+	Note that you will need to use "positron rebuild" to resort your
+	existing databases.
+	* Database handling fix that forces firmwares after 1.41 to cache 
+	the database when it is modified.
+	
 Version 1.0 (June 19, 2003):
         * Ogg Vorbis support added.  (Turned off by default)  Requires 
         vorbis and ogg python modules by Andrew Chatham.  

<p><p>1.4       +14 -0     positron/positron/db/MDB.py

Index: MDB.py
===================================================================
RCS file: /usr/local/cvsroot/positron/positron/db/MDB.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- MDB.py	25 May 2003 23:22:34 -0000	1.3
+++ MDB.py	25 Oct 2003 15:18:57 -0000	1.4
@@ -422,6 +422,20 @@
 
         return f.read(length)
 
+    def set_modified_flag(self, new_state=True):
+        # Only do something if there has been a state change to
+        # save disk access.
+        if self.header["isModified"] != new_state:
+            # Flip status bit
+            self.header["Status"] = self.header["Status"] ^ 0x01
+            self.header["isModified"] = new_state
+            # Write it to disk
+            status_word = struct.pack(">H", self.header["Status"])
+            self.file.seek(to_offset(2))
+            self.file.write(status_word)
+            self.file.flush()
+            
+
     def clear(self):
         """Remove all entries from database.
 

<p><p>1.5       +8 -2      positron/positron/db/WOID.py

Index: WOID.py
===================================================================
RCS file: /usr/local/cvsroot/positron/positron/db/WOID.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- WOID.py	6 Sep 2003 23:02:55 -0000	1.4
+++ WOID.py	25 Oct 2003 15:18:57 -0000	1.5
@@ -262,6 +262,9 @@
         new_sai_record = (mdb_pointer, pai_pointer) 
         self.sai.append(new_sai_record)
 
+        # Mark the modification
+        self.mdb.set_modified_flag()
+
         # Now we update the child PAI files with back pointers and
         # keep SAI file in sync if an offset occured
         for index, child_pai_module_ptr in child_pai_modules:
@@ -308,6 +311,8 @@
                 if num_entries == 0:
                     child_db.delete_record(child_index)
 
+        self.mdb.set_modified_flag()
+
     def clear(self):
         """Removes all records in this database and child databases."""
         for child in self.children:
@@ -322,6 +327,7 @@
             
         # Add required null record
         self.sai.append((null_rec_pointer, pai_ptr))
+        self.mdb.set_modified_flag()
 
     def count_deleted(self):
         "Returns the number of deleted records in this database"
@@ -378,6 +384,8 @@
         for child in self.children:
             child.sort(tracklist_filename, root_mdb)
 
+        self.mdb.set_modified_flag()
+
     def close(self):
         self.mdb.close()
         self.sai.close()
@@ -387,5 +395,3 @@
         for child in self.children:
             child.close()
         self.__init__()  # Reset variables to undefined state
-
-    

<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