forked from ihoka/encoding-dot-com
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding a MediaInfo response for info action
- Loading branch information
1 parent
80754da
commit 756b87a
Showing
4 changed files
with
94 additions
and
0 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
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
require 'parsedate' | ||
|
||
module EncodingDotCom | ||
# Represents a video or image in the encoding.com queue | ||
class MediaInfo | ||
attr_reader :bitrate, :duration, :video_codec, :video_bitrate, :frame_rate, :size, :pixel_aspect_ratio, :display_aspect_ratio, :audio_codec, :audio_sample_rate, :audio_channels | ||
|
||
# Creates a MediaInfo object, given a <response> Nokogiri::XML::Node | ||
# | ||
# See the encoding.com documentation for GetMediaInfo action for more details | ||
def initialize(node) | ||
@bitrate = (node / "bitrate").text | ||
@duration = (node / "duration").text.to_f | ||
@video_codec = (node / "video_codec").text | ||
@video_bitrate = (node / "video_bitrate").text | ||
@frame_rate = (node / "frame_rate").text.to_f | ||
@size = (node / "size").text | ||
@pixel_aspect_ratio = (node / "pixel_aspect_ratio").text | ||
@display_aspect_ratio = (node / "display_aspect_ratio").text | ||
@audio_codec = (node / "audio_codec").text | ||
@audio_sample_rate = (node / "audio_sample_rate").text.to_i | ||
@audio_channels = (node / "audio_channels").text.to_i | ||
end | ||
end | ||
end |
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