-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use static files for example instead of online services * Print secure URLs for results * Cleanup log output * Fix linting
- Loading branch information
Showing
10 changed files
with
30 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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("http://thecatapi.com/api/images/get") do |f| | ||
p "starting transcoding job..." | ||
File.open("#{__dir__}/assets/cat.jpg") do |f| | ||
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]["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("https://www.nasa.gov/640379main_Computers_are_in_Control.m4r") do |f| | ||
p "starting transcoding job..." | ||
File.open("#{__dir__}/assets/Computers_are_in_Control.flac") do |f| | ||
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]["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 = [ | ||
"https://www.nasa.gov/mp3/640148main_APU%20Shutdown.mp3", | ||
"https://www.nasa.gov/mp3/640164main_Go%20for%20Deploy.mp3", | ||
"https://www.nasa.gov/mp3/640165main_Lookin%20At%20It.mp3" | ||
"#{__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]["url"] | ||
p "\n" | ||
puts response[:message] | ||
puts response[:results]["concat"][0]["ssl_url"] | ||
puts "\n" |