Skip to content

Commit

Permalink
Cleanup log output
Browse files Browse the repository at this point in the history
  • Loading branch information
Acconut committed Jan 10, 2024
1 parent e2f0fc2 commit 8fd69d8
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 28 deletions.
6 changes: 3 additions & 3 deletions examples/README.md
Expand Up @@ -65,7 +65,7 @@ begin

steps.push(store)
rescue KeyError => e
p 's3 config not set. Skipping s3 storage...'
puts 's3 config not set. Skipping s3 storage...'
end

```
Expand Down Expand Up @@ -119,7 +119,7 @@ begin

steps.push(store)
rescue KeyError => e
p 's3 config not set. Skipping s3 storage...'
puts 's3 config not set. Skipping s3 storage...'
end
```

Expand Down Expand Up @@ -205,7 +205,7 @@ begin

steps.push(store)
rescue KeyError => e
p 's3 config not set. Skipping s3 storage...'
puts 's3 config not set. Skipping s3 storage...'
end

assembly = transloadit_client.assembly(steps: steps)
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/audio-concat-transcoder.rb
Expand Up @@ -27,7 +27,7 @@ def transcode!(files)

steps.push(store)
rescue KeyError
p "s3 config not set. Skipping s3 storage..."
puts "s3 config not set. Skipping s3 storage..."
end

assembly = transloadit_client.assembly(steps: steps)
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/audio-transcoder.rb
Expand Up @@ -30,7 +30,7 @@ def transcode!(file)

steps.push(store)
rescue KeyError
p "s3 config not set. Skipping s3 storage..."
puts "s3 config not set. Skipping s3 storage..."
end

assembly = transloadit_client.assembly(steps: steps)
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/image-transcoder.rb
Expand Up @@ -23,7 +23,7 @@ def transcode!(file)

steps.push(store)
rescue KeyError
p "s3 config not set. Skipping s3 storage..."
puts "s3 config not set. Skipping s3 storage..."
end

assembly = transloadit_client.assembly(steps: steps)
Expand Down
37 changes: 15 additions & 22 deletions examples/basic/main.rb
@@ -1,63 +1,56 @@
require "open-uri"
require_relative "media-transcoder"
require_relative "image-transcoder"
require_relative "audio-transcoder"
require_relative "audio-concat-transcoder"

p "starting image transcoding job..."
p "fetching image from the cat api..."
puts "starting image transcoding job..."

open("#{__dir__}/assets/cat.jpg") do |f|
p "starting transcoding job..."
image_transcoder = ImageTranscoder.new
response = image_transcoder.transcode!(f)

# if you are using rails one thing you can do would be to start an ActiveJob process that recursively
# checks on the status of the assembly until it is finished
p "checking job status..."
puts "checking job status..."
response.reload_until_finished!

p response[:message]
p response[:results]["image"][0]["ssl_url"]
puts response[:message]
puts response[:results]["image"][0]["ssl_url"]
puts "\n"
end

p "starting audio transcoding job..."
p "fetching soundbite from nasa..."
p "\n"
puts "starting audio transcoding job..."

open("#{__dir__}/assets/Computers_are_in_Control.flac") do |f|
p "starting transcoding job..."
audio_transcoder = AudioTranscoder.new
response = audio_transcoder.transcode!(f)

# if you are using rails one thing you can do would be to start an ActiveJob process that recursively
# checks on the status of the assembly until it is finished
p "checking job status..."
puts "checking job status..."
response.reload_until_finished!

p response[:message]
p response[:results]["mp3"][0]["ssl_url"]
p "\n"
puts response[:message]
puts response[:results]["mp3"][0]["ssl_url"]
puts "\n"
end

p "starting audio concat transcoding job..."
p "fetching 3 soundbites from nasa..."
puts "starting audio concat transcoding job..."

files = [
"#{__dir__}/assets/APU_Shutdown.mp3",
"#{__dir__}/assets/Go_for_Deploy.mp3",
"#{__dir__}/assets/Lookin_At_It.mp3"
]

p "starting transcoding job..."
audio_concat_transcoder = AudioConcatTranscoder.new
response = audio_concat_transcoder.transcode!(files)

# if you are using rails one thing you can do would be to start an ActiveJob process that recursively
# checks on the status of the assembly until it is finished
p "checking job status..."
puts "checking job status..."
response.reload_until_finished!

p response[:message]
p response[:results]["concat"][0]["ssl_url"]
p "\n"
puts response[:message]
puts response[:results]["concat"][0]["ssl_url"]
puts "\n"

0 comments on commit 8fd69d8

Please sign in to comment.