Skip to content

Commit

Permalink
derivative and caption naming
Browse files Browse the repository at this point in the history
  • Loading branch information
jwellnit committed Jan 17, 2025
1 parent 79c9430 commit b6a1877
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion app/services/spot/derivatives/audio_derivative_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ def create_derivatives(filename)
#
# @return [Boolean]
def check_premade_derivatives(filename)
prefix = filename.to_s.split('/')[-1].split('.')[0] + "_derivative"
base_file = filename.to_s.split('/')[-1].split('.')[0]
project_name = base_file.split('_')[0]
prefix = project_name + "/" + base_file + "_derivative"
object_list = s3_client.list_objects(bucket: s3_source, prefix: prefix).to_h[:contents]

return false if object_list.nil?
Expand Down
8 changes: 6 additions & 2 deletions app/services/spot/derivatives/video_derivative_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ def create_derivatives(filename)
#
# @return [Boolean]
def check_premade_derivatives(filename)
prefix = filename.to_s.split('/')[-1].split('.')[0] + "_derivative"
base_file = filename.to_s.split('/')[-1].split('.')[0]
project_name = base_file.split('_')[0]
prefix = project_name + "/" + base_file + "_derivative"
object_list = s3_client.list_objects(bucket: s3_source, prefix: prefix).to_h[:contents]

return false if object_list.nil?
Expand Down Expand Up @@ -74,7 +76,9 @@ def rename_premade_derivative(derivative, index)
# @param [String,Pathname] filename, the src path of the file
# @return [void]
def check_transcript(filename)
transcript_name = filename.to_s.split('/')[-1].split('.')[0] + ".vtt"
base_file = filename.to_s.split('/')[-1].split('.')[0]
project_name = base_file.split('_')[0]
transcript_name = project_name + "/" + base_file + "_caption.vtt"
begin
s3_client.head_object(bucket: s3_source, key: transcript_name)
rescue Aws::S3::Errors::NotFound
Expand Down

0 comments on commit b6a1877

Please sign in to comment.