Skip to content

Commit

Permalink
Some more proper error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Nodude committed Mar 26, 2023
1 parent 09711f8 commit c852391
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions kinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ def loadfile():
filename = fd.askopenfile(title='Open a file')
if (filename == None):
return
data = None
audio_file = os.path.basename(filename.name)
cur_file = audio_file
master.title(cur_file)
audio_file = os.path.splitext(audio_file)[0] + ".wav"
audio_file = os.path.join("tmp", audio_file)

Expand All @@ -152,17 +152,23 @@ def loadfile():
except:
pass

subprocess.check_call([
"ffmpeg",
"-y",
"-i", filename.name,
"-ar", "48000",
audio_file
])

data = load_audio_data(audio_file)
res()
ree()
try:
subprocess.check_call([
"ffmpeg",
"-y",
"-i", filename.name,
"-ar", "48000",
audio_file
])

data = load_audio_data(audio_file)
master.title(cur_file)
except Exception as ex:
print(ex)
master.title("Error")
finally:
res()
ree()

def savefile():
with fd.asksaveasfile(
Expand Down

0 comments on commit c852391

Please sign in to comment.