def local_uri_to_path(uri, media_dir):
 if ((not uri.startswith(u'local:directory:')) and (not uri.startswith(u'local:track:'))):
  raise ValueError(u'Invalid URI.')
 file_path = path.uri_to_path(uri).split(':', 1)[1]
 return os.path.join(media_dir, file_path)

def local_uri_to_path ( uri , media_dir ) : if ( ( not uri . startswith ( u'local:directory:' ) ) and ( not uri . startswith ( u'local:track:' ) ) ) : raise ValueError ( u'Invalid URI.' ) file_path = path . uri_to_path ( uri ) . split ( ':' , 1 ) [ 1 ] return os . path . join ( media_dir , file_path )
convert local track or directory uri to absolute path .