[xiph-cvs] cvs commit: positron/positron cmd_add.py cmd_rebuild.py neuros.py

Stan Seibert volsung at xiph.org
Sun May 25 15:30:04 PDT 2003



volsung     03/05/25 18:30:04

  Modified:    positron cmd_add.py cmd_rebuild.py neuros.py
  Log:
  Convert extended ASCII characters to underscores in filenames because
  these cause the Neuros firmware to lockup.  Closes bug #355.

Revision  Changes    Path
1.2       +1 -1      positron/positron/cmd_add.py

Index: cmd_add.py
===================================================================
RCS file: /usr/local/cvsroot/positron/positron/cmd_add.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- cmd_add.py	22 May 2003 04:42:52 -0000	1.1
+++ cmd_add.py	25 May 2003 22:30:03 -0000	1.2
@@ -100,7 +100,7 @@
 
     if config.sort_database:
         print "\nSorting tracks..."
-        audio_db.pack(util.cmp_records)
+        audio_db.sort()
         
     print "Done!"
     neuros.close_db("audio")

<p><p>1.2       +1 -1      positron/positron/cmd_rebuild.py

Index: cmd_rebuild.py
===================================================================
RCS file: /usr/local/cvsroot/positron/positron/cmd_rebuild.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- cmd_rebuild.py	22 May 2003 04:42:52 -0000	1.1
+++ cmd_rebuild.py	25 May 2003 22:30:03 -0000	1.2
@@ -109,7 +109,7 @@
             add_track(neuros, None, track,
                       recording=recording_source(track))
         if config.sort_database:
-            audio_db.pack(util.cmp_records)
+            audio_db.sort()
         neuros.close_db("audio")
 
         print "\nAdding HiSi clips to unidedhisi database..."

<p><p>1.4       +14 -5     positron/positron/neuros.py

Index: neuros.py
===================================================================
RCS file: /usr/local/cvsroot/positron/positron/neuros.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- neuros.py	25 May 2003 21:05:51 -0000	1.3
+++ neuros.py	25 May 2003 22:30:03 -0000	1.4
@@ -41,11 +41,12 @@
     return path_parts
 
 def FAT_mangle_filename(filename):
-    """Creates a FAT-friendly filename.
+    """Creates a Neuros and FAT-friendly filename.
 
     Substitute replacement characters (usually '_') for characters in
     filename that are not allowed on FAT filesystems.  Double quotes are
-    replaced with single quotes."""
+    replaced with single quotes.  Also replaces characters that cause
+    problems with the Neuros firmware (like accented characters)."""
 
     # Keys are bad characters for FAT filesystems, and values are the
     # replacement
@@ -57,10 +58,18 @@
                      '<' : '_',
                      '>' : '_',
                      '|' : '_' }
+    
+    new_filename = ""
+    mangle_table_keys = mangle_table.keys()
+    for old_char in filename:
+        if ord(old_char) >= 0x7F:
+            new_char = "_"
+        elif old_char in mangle_table_keys:
+            new_char = mangle_table[old_char]
+        else:
+            new_char = old_char
 
-    new_filename = filename
-    for bad_char, replace_char in mangle_table.items():
-        new_filename = new_filename.replace(bad_char, replace_char)
+        new_filename += new_char
 
     return new_filename
 

<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