view 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
line wrap: on
line source
import os

# ============================================
# Some global utility functions
# ============================================

def convertFilename(upload_filename):
	# we don't have to convert everything to unicode. It works just fine.
	# upload_filename = upload_filename.decode('utf-8')
	filename = upload_filename.replace('\\','/').replace(' ','_')
	filename = os.path.basename(filename)
	#remove additional dots since that confuses sonic annotator
	base,ext = os.path.splitext(filename)
	base = base.replace('.','_')
	filename = ''.join([base,ext])
	return filename