@@ -55,6 +55,7 @@ def resource_path(relative_path):
5555
5656modulecol2 = sg .Column ([
5757 [sg .Checkbox ('Prefix' , key = "-PREFIXBOOL-" , background_color = bgcolor ), sg .In (size = (10 ,0 ), key = "-PREFIXSTR-" )],
58+ [sg .Checkbox ('Suffix' , key = "-SUFFIXBOOL-" , background_color = bgcolor ), sg .In (size = (10 ,0 ), key = "-SUFFIXSTR-" )],
5859 [sg .Checkbox ('Replace Text' , key = "-REPL-" , background_color = bgcolor ), sg .In (size = (10 ,0 ), key = "-RPLFROM-" , enable_events = True ), sg .Text ('>>>' , background_color = bgcolor ), sg .In (size = (10 ,0 ), key = "-RPLTO-" )]
5960 ],
6061 vertical_alignment = "top" ,
@@ -182,6 +183,17 @@ def setprefix(files, prefix):
182183 if curproc == len (files ):
183184 updatefilelist (values ["-SHOWPATHS-" ], getfiles (d , values ['-REC-' ]))
184185
186+ def setsuffix (files , suffix ):
187+ curproc = 0
188+ for file in files :
189+ fname = os .path .basename (file ).split ("." )[0 ]
190+ d = os .path .dirname (file )
191+ os .rename (file , d + "/" + fname + suffix + ".wav" )
192+ filelog ("Renamed to " + fname + suffix + ".wav" )
193+ curproc += 1
194+ if curproc == len (files ):
195+ updatefilelist (values ["-SHOWPATHS-" ], getfiles (d , values ['-REC-' ]))
196+
185197def findrepl (files , rplfrom , rplto ):
186198 curproc = 0
187199 for file in files :
@@ -245,6 +257,10 @@ def filelog(logmsg):
245257 convertsamplerate (currentfiles )
246258 if values ['-PREFIXBOOL-' ] == True :
247259 setprefix (currentfiles , values ["-PREFIXSTR-" ])
260+ currentfiles = getfiles (folder , values ['-REC-' ])
261+ if values ['-SUFFIXBOOL-' ] == True :
262+ setsuffix (currentfiles , values ["-SUFFIXSTR-" ])
263+ currentfiles = getfiles (folder , values ['-REC-' ])
248264 if values ['-REPL-' ] == True :
249265 try :
250266 findrepl (currentfiles , values ["-RPLFROM-" ], values ["-RPLTO-" ])
0 commit comments