From f2b55338a22d705d6c986a804409e8ead3a84e01 Mon Sep 17 00:00:00 2001 From: Anjok07 <68268275+Anjok07@users.noreply.github.com> Date: Wed, 11 May 2022 01:42:20 -0500 Subject: [PATCH] Add files via upload --- UVR.py | 48 +++++++++++++++++++++++++++++++--------- inference_MDX.py | 9 ++++---- inference_v5.py | 9 ++++---- inference_v5_ensemble.py | 9 ++++---- 4 files changed, 53 insertions(+), 22 deletions(-) diff --git a/UVR.py b/UVR.py index 8b6360a..be09061 100644 --- a/UVR.py +++ b/UVR.py @@ -163,6 +163,9 @@ def drop(event, accept_mode: str = 'files'): """ Drag & Drop verification process """ + global dnd + global dnddir + path = event.data if accept_mode == 'folder': @@ -179,8 +182,11 @@ def drop(event, accept_mode: str = 'files'): path = path.split('} ') path[-1] = path[-1].replace('}', '') # Set Variables + dnd = 'yes' root.inputPaths = path root.update_inputPaths() + dnddir = os.path.dirname(path[0]) + print('dnddir ', str(dnddir)) else: # Invalid accept mode return @@ -779,6 +785,9 @@ class MainWindow(TkinterDnD.Tk): # Opening filedialogs def open_file_filedialog(self): """Make user select music files""" + global dnd + global nondnd + if self.lastDir is not None: if not os.path.isdir(self.lastDir): self.lastDir = None @@ -791,8 +800,10 @@ class MainWindow(TkinterDnD.Tk): ) if paths: # Path selected self.inputPaths = paths + dnd = 'no' self.update_inputPaths() - self.lastDir = os.path.dirname(paths[0]) + nondnd = os.path.dirname(paths[0]) + print('last dir', self.lastDir) def open_export_filedialog(self): """Make user select a folder to export the converted files in""" @@ -813,11 +824,24 @@ class MainWindow(TkinterDnD.Tk): def open_inputPath_filedialog(self): """Open Input Directory""" + + try: + if dnd == 'yes': + self.lastDir = str(dnddir) + filename = str(self.lastDir) + if sys.platform == "win32": + os.startfile(filename) + if dnd == 'no': + self.lastDir = str(nondnd) + filename = str(self.lastDir) + + if sys.platform == "win32": + os.startfile(filename) + except: + filename = str(self.lastDir) - filename = self.lastDir - - if sys.platform == "win32": - os.startfile(filename) + if sys.platform == "win32": + os.startfile(filename) def start_conversion(self): """ @@ -854,13 +878,15 @@ class MainWindow(TkinterDnD.Tk): return # -Check for invalid inputs- + for path in input_paths: if not os.path.isfile(path): - tk.messagebox.showwarning(master=self, - title='Invalid Music File', - message='You have selected an invalid music file! Please make sure that the file still exists!', - detail=f'File path: {path}') - return + tk.messagebox.showwarning(master=self, + title='Drag and Drop Feature Failed or Invalid Input', + message='The input is invalid, or the drag and drop feature failed to select your files properly.\n\nPlease try the following:\n\n1. Select your inputs using the \"Select Input\" button\n2. Verify the input is valid.\n3. Then try again.') + return + + if self.aiModel_var.get() == 'VR Architecture': if not os.path.isfile(instrumentalModel_path): tk.messagebox.showwarning(master=self, @@ -938,6 +964,8 @@ class MainWindow(TkinterDnD.Tk): # Empty Selection text = '' self.inputPathsEntry_var.set(text) + + def update_loop(self): """Update the dropdown menu""" diff --git a/inference_MDX.py b/inference_MDX.py index 9e4a01e..276419d 100644 --- a/inference_MDX.py +++ b/inference_MDX.py @@ -911,8 +911,9 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress text_widget.write("\n" + base_text + f'Separation failed for the following audio file:\n') text_widget.write(base_text + f'"{os.path.basename(music_file)}"\n') text_widget.write(f'\nError Received:\n\n') - text_widget.write(f'FFmpeg is missing or corrupt.\n') - text_widget.write(f'You will only be able to process .wav files until FFmpeg is available on this system.\n') + text_widget.write(f'The input file type is not supported or FFmpeg is missing.\n') + text_widget.write(f'Please select a file type supported by FFmpeg and try again.\n\n') + text_widget.write(f'If FFmpeg is missing or not installed, you will only be able to process \".wav\" files \nuntil it is available on this system.\n\n') text_widget.write(f'See the \"More Info\" tab in the Help Guide.\n\n') text_widget.write(f'If this error persists, please contact the developers.\n\n') text_widget.write(f'Time Elapsed: {time.strftime("%H:%M:%S", time.gmtime(int(time.perf_counter() - stime)))}') @@ -922,8 +923,8 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress f.write(f'Last Error Received:\n\n' + f'Error Received while processing "{os.path.basename(music_file)}":\n' + f'Process Method: MDX-Net\n\n' + - f'FFmpeg is missing or corrupt.\n' + - f'You will only be able to process .wav files until FFmpeg is available on this system.\n' + + f'The input file type is not supported or FFmpeg is missing.\nPlease select a file type supported by FFmpeg and try again.\n\n' + + f'If FFmpeg is missing or not installed, you will only be able to process \".wav\" files until it is available on this system.\n\n' + f'See the \"More Info\" tab in the Help Guide.\n\n' + f'If this error persists, please contact the developers.\n\n' + message + f'\nError Time Stamp [{datetime.now().strftime("%Y-%m-%d %H:%M:%S")}]\n') diff --git a/inference_v5.py b/inference_v5.py index 4c1b1ae..105d0ad 100644 --- a/inference_v5.py +++ b/inference_v5.py @@ -936,8 +936,9 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress text_widget.write("\n" + base_text + f'Separation failed for the following audio file:\n') text_widget.write(base_text + f'"{os.path.basename(music_file)}"\n') text_widget.write(f'\nError Received:\n\n') - text_widget.write(f'FFmpeg is missing or corrupt.\n') - text_widget.write(f'You will only be able to process .wav files until FFmpeg is available on this system.\n') + text_widget.write(f'The input file type is not supported or FFmpeg is missing.\n') + text_widget.write(f'Please select a file type supported by FFmpeg and try again.\n\n') + text_widget.write(f'If FFmpeg is missing or not installed, you will only be able to process \".wav\" files \nuntil it is available on this system.\n\n') text_widget.write(f'See the \"More Info\" tab in the Help Guide.\n\n') text_widget.write(f'If this error persists, please contact the developers.\n\n') text_widget.write(f'Time Elapsed: {time.strftime("%H:%M:%S", time.gmtime(int(time.perf_counter() - stime)))}') @@ -947,8 +948,8 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress f.write(f'Last Error Received:\n\n' + f'Error Received while processing "{os.path.basename(music_file)}":\n' + f'Process Method: VR Architecture\n\n' + - f'FFmpeg is missing or corrupt.\n' + - f'You will only be able to process .wav files until FFmpeg is available on this system.\n' + + f'The input file type is not supported or FFmpeg is missing.\nPlease select a file type supported by FFmpeg and try again.\n\n' + + f'If FFmpeg is missing or not installed, you will only be able to process \".wav\" files until it is available on this system.\n\n' + f'See the \"More Info\" tab in the Help Guide.\n\n' + f'If this error persists, please contact the developers.\n\n' + message + f'\nError Time Stamp [{datetime.now().strftime("%Y-%m-%d %H:%M:%S")}]\n') diff --git a/inference_v5_ensemble.py b/inference_v5_ensemble.py index 97f26ec..8f1de42 100644 --- a/inference_v5_ensemble.py +++ b/inference_v5_ensemble.py @@ -1928,8 +1928,9 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress text_widget.write("\n" + base_text + f'Separation failed for the following audio file:\n') text_widget.write(base_text + f'"{os.path.basename(music_file)}"\n') text_widget.write(f'\nError Received:\n\n') - text_widget.write(f'FFmpeg is missing or corrupt.\n') - text_widget.write(f'You will only be able to process .wav files until FFmpeg is available on this system.\n') + text_widget.write(f'The input file type is not supported or FFmpeg is missing.\n') + text_widget.write(f'Please select a file type supported by FFmpeg and try again.\n\n') + text_widget.write(f'If FFmpeg is missing or not installed, you will only be able to process \".wav\" files \nuntil it is available on this system.\n\n') text_widget.write(f'See the \"More Info\" tab in the Help Guide.\n\n') text_widget.write(f'If this error persists, please contact the developers.\n\n') text_widget.write(f'Time Elapsed: {time.strftime("%H:%M:%S", time.gmtime(int(time.perf_counter() - stime)))}') @@ -1939,8 +1940,8 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress f.write(f'Last Error Received:\n\n' + f'Error Received while processing "{os.path.basename(music_file)}":\n' + f'Process Method: Ensemble Mode\n\n' + - f'FFmpeg is missing or corrupt.\n' + - f'You will only be able to process .wav files until FFmpeg is available on this system.\n' + + f'The input file type is not supported or FFmpeg is missing.\nPlease select a file type supported by FFmpeg and try again.\n\n' + + f'If FFmpeg is missing or not installed, you will only be able to process \".wav\" files until it is available on this system.\n\n' + f'See the \"More Info\" tab in the Help Guide.\n\n' + f'If this error persists, please contact the developers.\n\n' + message + f'\nError Time Stamp [{datetime.now().strftime("%Y-%m-%d %H:%M:%S")}]\n')