Permalink
Browse files

randomish inspector cleanup

  • Loading branch information...
1 parent 0ea0dec commit 8dd0cd506434d881edbf264b65c7544cb656cbff @greatseth greatseth committed Feb 23, 2009
Showing with 14 additions and 30 deletions.
  1. +14 −30 lib/rvideo/inspector.rb
View
@@ -84,88 +84,72 @@ def initialize_with_file(file, ffmpeg_binary = nil)
#
def valid?
- if @unknown_format or @unreadable_file
- false
- else
- true
- end
+ not (@unknown_format or @unreadable_file)
end
#
# Returns false if the file can be read successfully. Returns false otherwise.
#
def invalid?
- !valid?
+ not valid?
end
#
# True if the format is not understood ("Unknown Format")
#
def unknown_format?
- if @unknown_format
- true
- else
- false
- end
+ @unknown_format ? true : false
end
#
# True if the file is not readable ("Duration: N/A, bitrate: N/A")
#
def unreadable_file?
- if @unreadable_file
- true
- else
- false
- end
+ @unreadable_file ? true : false
end
#
# Does the file have an audio stream?
#
def audio?
- if audio_match.nil?
- false
- else
- true
- end
+ not audio_match.nil?
end
#
# Does the file have a video stream?
#
def video?
- if video_match.nil?
- false
- else
- true
- end
+ not video_match.nil?
end
#
- # Take a screengrab of a movie. Requires an input file and a time parameter, and optionally takes an output filename. If no output filename is specfied, constructs one.
+ # Take a screengrab of a movie. Requires an input file and a time parameter,
+ # and optionally takes an output filename. If no output filename is specfied,
+ # constructs one.
#
- # Three types of time parameters are accepted - percentage (e.g. 3%), time in seconds (e.g. 60 seconds), and raw frame (e.g. 37). Will raise an exception if the time in seconds or the frame are out of the bounds of the input file.
+ # Three types of time parameters are accepted - percentage (e.g. 3%), time in
+ # seconds (e.g. 60 seconds), and raw frame (e.g. 37). Will raise an exception if
+ # the time in seconds or the frame are out of the bounds of the input file.
#
# Types:
# 37s (37 seconds)
# 37f (frame 37)
# 37% (37 percent)
# 37 (default to seconds)
#
- # If a time is outside of the duration of the file, it will choose a frame at the 99% mark.
+ # If a time is outside of the duration of the file, it will choose a frame at the
+ # 99% mark.
#
# Example:
#
# t = RVideo::Transcoder.new('path/to/input_file.mp4')
# t.capture_frame('10%') # => '/path/to/screenshot/input-10p.jpg'
#
-
def capture_frame(timecode, output_file = nil)
t = calculate_time(timecode)
output_file ||= "#{TEMP_PATH}/#{File.basename(@full_filename, ".*")}-#{timecode.gsub("%","p")}.jpg"

0 comments on commit 8dd0cd5

Please sign in to comment.