Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #7 from marvs/mp4-support
Browse files Browse the repository at this point in the history
Allow video/mp4 in content_type checking, resolves #6
  • Loading branch information
kookster committed Aug 21, 2015
2 parents 65f3d29 + 3f9b7e7 commit 74048d8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/speechmatics/user/jobs.rb
Expand Up @@ -29,7 +29,7 @@ def attach_audio(params={})

content_type = params[:content_type] || MimeMagic.by_path(file_path).to_s
raise "No content type specified for file, please provide a :content_type value" unless content_type
raise "Content type for file '#{file_path}' is not audio, it is '#{content_type}'." unless (content_type =~ /audio/)
raise "Content type for file '#{file_path}' is not audio or video, it is '#{content_type}'." unless (content_type =~ /audio|video/)

params[:data_file] = Faraday::UploadIO.new(file_path, content_type)
params
Expand Down
9 changes: 8 additions & 1 deletion test/user/jobs_test.rb
Expand Up @@ -93,12 +93,19 @@
jl.jobs.count.must_equal 2
end

it "creates job" do
it "creates job for an audio file" do
r = jobs.create(data_file: File.expand_path(File.dirname(__FILE__) + '/../zero.wav'))
r.id.must_equal 2
r.cost.must_equal 0.50
r.balance.must_equal 90
end

it "creates job for a video file" do
r = jobs.create(data_file: File.expand_path(File.dirname(__FILE__) + '/../zero.mp4'))
r.id.must_equal 2
r.cost.must_equal 0.50
r.balance.must_equal 90
end

it "gets transcript" do
t = jobs.transcript(job_id: 1)
Expand Down
Binary file added test/zero.mp4
Binary file not shown.

0 comments on commit 74048d8

Please sign in to comment.