Skip to content

Commit

Permalink
Consolidate bad audio logic
Browse files Browse the repository at this point in the history
  • Loading branch information
cavis committed Dec 16, 2024
1 parent da903f2 commit 63c4c5b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/models/task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ def job_id
def source_url
end

def bad_audio?
bad_audio_duration? || bad_audio_bytes? || bad_audio_vbr?
end

def bad_audio_duration?
porter_callback_inspect.dig(:Audio, :DurationDiscrepancy).to_i > 500
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/tasks/copy_media_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def update_media_resource

media_resource.save!

if media_resource.status_complete? && (bad_audio_duration? || bad_audio_bytes? || bad_audio_vbr?)
if media_resource.status_complete? && bad_audio?
fix_media!
else
slice_media!
Expand Down

0 comments on commit 63c4c5b

Please sign in to comment.