Fixed Stacked Folder Naming Convention Bug

This commit is contained in:
DilanBoskan 2020-11-10 13:02:48 +01:00
parent 067fc3812b
commit 638b7529b8
2 changed files with 20 additions and 28 deletions

View File

@ -269,7 +269,7 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
"""Save output music files""" """Save output music files"""
vocal_name = None vocal_name = None
instrumental_name = None instrumental_name = None
folder = '' save_path = os.path.dirname(base_name)
# Get the Suffix Name # Get the Suffix Name
if (not loop_num or if (not loop_num or
@ -302,13 +302,11 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
# Reverse names # Reverse names
vocal_name, instrumental_name = instrumental_name, vocal_name vocal_name, instrumental_name = instrumental_name, vocal_name
elif data['saveAllStacked']: elif data['saveAllStacked']:
folder = os.path.splitext(os.path.basename(base_name))[0] + ' Stacked Outputs' # nopep8 folder_name = os.path.basename(base_name) + ' Stacked Outputs' # nopep8
folder = os.path.basename(folder) + '/' save_path = os.path.join(save_path, folder_name)
folder_path = os.path.dirname(base_name)
folder_path = os.path.join(folder_path, folder)
if not os.path.isdir(folder_path): if not os.path.isdir(save_path):
os.mkdir(folder_path) os.mkdir(save_path)
if data['stackOnly']: if data['stackOnly']:
vocal_name = f'(Vocal_{loop_num}_Stacked_Output)' vocal_name = f'(Vocal_{loop_num}_Stacked_Output)'
@ -333,18 +331,16 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
# -Save files- # -Save files-
# Instrumental # Instrumental
if instrumental_name is not None: if instrumental_name is not None:
instrumental_path = '{base_path}/{folder}{file_name}.wav'.format( instrumental_path = '{save_path}/{file_name}.wav'.format(
base_path=os.path.dirname(base_name), save_path=save_path,
folder=folder,
file_name=f'{os.path.basename(base_name)}_{instrumental_name}{appendModelFolderName}', file_name=f'{os.path.basename(base_name)}_{instrumental_name}{appendModelFolderName}',
) )
sf.write(instrumental_path, sf.write(instrumental_path,
wav_instrument.T, sr) wav_instrument.T, sr)
# Vocal # Vocal
if vocal_name is not None: if vocal_name is not None:
vocal_path = '{base_path}/{folder}{file_name}.wav'.format( vocal_path = '{save_path}/{file_name}.wav'.format(
base_path=os.path.dirname(base_name), save_path=save_path,
folder=folder,
file_name=f'{os.path.basename(base_name)}_{vocal_name}{appendModelFolderName}', file_name=f'{os.path.basename(base_name)}_{vocal_name}{appendModelFolderName}',
) )
sf.write(vocal_path, sf.write(vocal_path,

View File

@ -283,7 +283,7 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
"""Save output music files""" """Save output music files"""
vocal_name = None vocal_name = None
instrumental_name = None instrumental_name = None
folder = '' save_path = os.path.dirname(base_name)
# Get the Suffix Name # Get the Suffix Name
if (not loop_num or if (not loop_num or
@ -316,13 +316,11 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
# Reverse names # Reverse names
vocal_name, instrumental_name = instrumental_name, vocal_name vocal_name, instrumental_name = instrumental_name, vocal_name
elif data['saveAllStacked']: elif data['saveAllStacked']:
folder = os.path.splitext(os.path.basename(base_name))[0] + ' Stacked Outputs' # nopep8 folder_name = os.path.basename(base_name) + ' Stacked Outputs' # nopep8
folder = os.path.basename(folder) + '/' save_path = os.path.join(save_path, folder_name)
folder_path = os.path.dirname(base_name)
folder_path = os.path.join(folder_path, folder)
if not os.path.isdir(folder_path): if not os.path.isdir(save_path):
os.mkdir(folder_path) os.mkdir(save_path)
if data['stackOnly']: if data['stackOnly']:
vocal_name = f'(Vocal_{loop_num}_Stacked_Output)' vocal_name = f'(Vocal_{loop_num}_Stacked_Output)'
@ -347,9 +345,8 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
# -Save files- # -Save files-
# Instrumental # Instrumental
if instrumental_name is not None: if instrumental_name is not None:
instrumental_path = '{base_path}/{folder}{file_name}.wav'.format( instrumental_path = '{save_path}/{file_name}.wav'.format(
base_path=os.path.dirname(base_name), save_path=save_path,
folder=folder,
file_name=f'{os.path.basename(base_name)}_{instrumental_name}{appendModelFolderName}', file_name=f'{os.path.basename(base_name)}_{instrumental_name}{appendModelFolderName}',
) )
@ -357,9 +354,8 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
wav_instrument.T, sr) wav_instrument.T, sr)
# Vocal # Vocal
if vocal_name is not None: if vocal_name is not None:
vocal_path = '{base_path}/{folder}{file_name}.wav'.format( vocal_path = '{save_path}/{file_name}.wav'.format(
base_path=os.path.dirname(base_name), save_path=save_path,
folder=folder,
file_name=f'{os.path.basename(base_name)}_{vocal_name}{appendModelFolderName}', file_name=f'{os.path.basename(base_name)}_{vocal_name}{appendModelFolderName}',
) )
sf.write(vocal_path, sf.write(vocal_path,