History

use os.path in task.cut to derive default output filenames use os.path in task.cut to derive default output filenames

Paul Brossier committed 20 years ago

Commit cf349221 parent 16109b31 file · +6 −5Browse files

Showing the changes to python (1 of 1 file). Show all

Unified · Split

python/aubio/task/cut.py+6−5
@@ -6,9 +6,11 @@ class taskcut(task): · 5 unmodified lines
66 """ open the input file and initialize arguments
77 parameters should be set *before* calling this method.
88 """
9+ from os.path import basename,splitext
910 task.__init__(self,input,output=None,params=params)
10− self.newname = "%s%s%09.5f%s%s" % (self.input.split(".")[0].split("/")[-1],".",
11− self.frameread*self.params.step,".",self.input.split(".")[-1])
11+ self.soundoutbase, self.soundoutext = splitext(basename(self.input))
12+ self.newname = "%s%s%09.5f%s%s" % (self.soundoutbase,".",
13+ self.frameread*self.params.step,".",self.soundoutext)
1214 self.fileo = sndfile(self.newname,model=self.filei)
1315 self.myvec = fvec(self.params.hopsize,self.channels)
1416 self.mycopy = fvec(self.params.hopsize,self.channels)
@@ -31,9 +33,8 @@ class taskcut(task): · 16 unmodified lines
3133 fromcross += 1
3234 zerocross += 1
3335 del self.fileo
34− self.fileo = sndfile("%s%s%09.5f%s%s" %
35− (self.input.split(".")[0].split("/")[-1],".",
36− self.frameread*self.params.step,".",self.input.split(".")[-1]),model=self.filei)
36+ self.fileo = sndfile("%s%s%09.5f%s%s" % (self.soundoutbase,".",
37+ self.frameread*self.params.step,".",self.soundoutext),model=self.filei)
3738 writesize = self.fileo.write(fromcross,self.mycopy)
3839 else:
3940 writesize = self.fileo.write(self.readsize,self.myvec)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t