Add files via upload

This commit is contained in:
Anjok07 2022-05-11 01:42:20 -05:00 committed by GitHub
parent c235015d80
commit f2b55338a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 53 additions and 22 deletions

46
UVR.py
View File

@ -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"""
@ -814,10 +825,23 @@ class MainWindow(TkinterDnD.Tk):
def open_inputPath_filedialog(self):
"""Open Input Directory"""
filename = self.lastDir
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)
if sys.platform == "win32":
os.startfile(filename)
except:
filename = str(self.lastDir)
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,
@ -939,6 +965,8 @@ class MainWindow(TkinterDnD.Tk):
text = ''
self.inputPathsEntry_var.set(text)
def update_loop(self):
"""Update the dropdown menu"""
self.update_available_models()

View File

@ -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')

View File

@ -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')

View File

@ -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')