annotate sawautil/Utilities.py @ 25:4a4bd554b4c1 tip

Closing this sub branch.
author Daniele Barchiesi <daniele.barchiesi@eecs.qmul.ac.uk>
date Mon, 25 Mar 2013 14:02:54 +0000
parents 032bc65ebafc
children
rev   line source
gyorgy@0 1 import os
gyorgy@0 2
gyorgy@0 3 # ============================================
gyorgy@0 4 # Some global utility functions
gyorgy@0 5 # ============================================
gyorgy@0 6
gyorgy@0 7 def convertFilename(upload_filename):
gyorgy@0 8 # we don't have to convert everything to unicode. It works just fine.
gyorgy@0 9 # upload_filename = upload_filename.decode('utf-8')
gyorgy@0 10 filename = upload_filename.replace('\\','/').replace(' ','_')
gyorgy@0 11 filename = os.path.basename(filename)
gyorgy@0 12 #remove additional dots since that confuses sonic annotator
gyorgy@0 13 base,ext = os.path.splitext(filename)
gyorgy@0 14 base = base.replace('.','_')
gyorgy@0 15 filename = ''.join([base,ext])
gyorgy@0 16 return filename