Fix a bug so that old audio files are deleted correctly

This commit is contained in:
MatthiasSaihttam 2021-05-10 00:18:50 -04:00
parent 7183ca8317
commit af3d3a57c5
1 changed files with 2 additions and 2 deletions

View File

@ -98,10 +98,10 @@ def post(request):
thought.save() # Save so that we have a file to work with
subprocess.run(["ffmpeg",
"-i", thought.media.path,
"-codec:a", "aac",
"-codec:a", "aac", "-vn",
os.path.join(settings.MEDIA_ROOT, f"{thought.uuid}.aac")
])
os.remove(f"{thought.uuid}.m4a") # Remove the original file
os.remove(os.path.join(settings.MEDIA_ROOT, f"{thought.uuid}.m4a")) # Remove the original file
thought.media.name = f"{thought.uuid}.aac" # Update the file in the DB
thought.save()