From cf34922f1fb0778fdc5bf7cd13650345f865ade0 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Mon, 12 Jun 2006 12:54:47 +0000 Subject: [PATCH] use os.path in task.cut to derive default output filenames use os.path in task.cut to derive default output filenames --- python/aubio/task/cut.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/python/aubio/task/cut.py b/python/aubio/task/cut.py index 0b749ac3..6f3f1e77 100644 --- a/python/aubio/task/cut.py +++ b/python/aubio/task/cut.py @@ -6,9 +6,11 @@ class taskcut(task): """ open the input file and initialize arguments parameters should be set *before* calling this method. """ + from os.path import basename,splitext task.__init__(self,input,output=None,params=params) - self.newname = "%s%s%09.5f%s%s" % (self.input.split(".")[0].split("/")[-1],".", - self.frameread*self.params.step,".",self.input.split(".")[-1]) + self.soundoutbase, self.soundoutext = splitext(basename(self.input)) + self.newname = "%s%s%09.5f%s%s" % (self.soundoutbase,".", + self.frameread*self.params.step,".",self.soundoutext) self.fileo = sndfile(self.newname,model=self.filei) self.myvec = fvec(self.params.hopsize,self.channels) self.mycopy = fvec(self.params.hopsize,self.channels) @@ -31,9 +33,8 @@ class taskcut(task): fromcross += 1 zerocross += 1 del self.fileo - self.fileo = sndfile("%s%s%09.5f%s%s" % - (self.input.split(".")[0].split("/")[-1],".", - self.frameread*self.params.step,".",self.input.split(".")[-1]),model=self.filei) + self.fileo = sndfile("%s%s%09.5f%s%s" % (self.soundoutbase,".", + self.frameread*self.params.step,".",self.soundoutext),model=self.filei) writesize = self.fileo.write(fromcross,self.mycopy) else: writesize = self.fileo.write(self.readsize,self.myvec) -- 2.26.2