aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2017-02-27 11:35:54 +0100
committerneodarz <neodarz@neodarz.net>2017-02-27 11:35:54 +0100
commit3f92d6cce34f00cff5c273b14a5c5191d631a131 (patch)
treeb0a7bfc1b5241a54b0ed74c133efdb47a71a7783 /web
parent708dc012953f555e0434b366cb004977d0821979 (diff)
downloadthe_transcriber_backend-3f92d6cce34f00cff5c273b14a5c5191d631a131.tar.xz
the_transcriber_backend-3f92d6cce34f00cff5c273b14a5c5191d631a131.zip
Add the detection of the file duration
Diffstat (limited to 'web')
-rw-r--r--web/controllers/audio_file_api_controller.ex3
1 files changed, 2 insertions, 1 deletions
diff --git a/web/controllers/audio_file_api_controller.ex b/web/controllers/audio_file_api_controller.ex
index afc23ac..5bafbf1 100644
--- a/web/controllers/audio_file_api_controller.ex
+++ b/web/controllers/audio_file_api_controller.ex
@@ -15,11 +15,12 @@ defmodule TheTranscriberBackend.AudioFileAPIController do
changeset = AudioFile.changeset(%AudioFile{},
%{audio_path: upload.filename,
audio_name: audio_name,
- audio_duration: audio_duration})
+ audio_duration: "#{FFprobe.duration(upload.path)}"})
case Repo.insert(changeset) do
{:ok, audio_file_api} ->
File.cp(upload.path, "#{path}#{audio_file_api.id}_#{upload.filename}")
+
conn
|> put_status(:created)
|> put_resp_header("location", audio_file_api_path(conn, :show, audio_file_api))