fix check_call usages
This commit is contained in:
parent
0e907ef255
commit
649624fb25
16
app.py
16
app.py
|
@ -24,8 +24,8 @@ def convert_to_wav(file_name: str):
|
|||
print(f"{extension=}")
|
||||
command = [
|
||||
"tape2wav",
|
||||
file_name,
|
||||
f"${output}.wav",
|
||||
os.path.join("uploads", file_name),
|
||||
os.path.join("uploads", f"${output}.wav"),
|
||||
]
|
||||
try:
|
||||
check_call(command)
|
||||
|
@ -35,10 +35,13 @@ def convert_to_wav(file_name: str):
|
|||
|
||||
|
||||
def run_cassetta(cassetta: str):
|
||||
command = f"aplay uploads/{cassetta}"
|
||||
command = [
|
||||
"aplay",
|
||||
os.path.join("uploads", cassetta),
|
||||
]
|
||||
|
||||
try:
|
||||
check_call(command.split())
|
||||
check_call(command)
|
||||
except CalledProcessError as exc:
|
||||
print(f"aplay failed: {exc.output=}\n{exc.stderr=}")
|
||||
|
||||
|
@ -72,7 +75,10 @@ def upload_file():
|
|||
return "No file?"
|
||||
|
||||
save_path = os.path.join("uploads", file.filename)
|
||||
assert not os.path.exists(save_path)
|
||||
if os.path.exists(save_path):
|
||||
response = make_response(make_response("file already exists", 400))
|
||||
response.headers["Location"] = "/"
|
||||
response.status_code = 400
|
||||
|
||||
try:
|
||||
file.save(save_path)
|
||||
|
|
Loading…
Reference in New Issue
Block a user