module Videoinfo

Constants

VERSION

Public Class Methods

analyze_movie(name, file, screenshots = 0) click to toggle source

Helper method to analyze a movie.

# File lib/videoinfo.rb, line 24
def self.analyze_movie(name, file, screenshots = 0)
  Videos::Movie.new(name, file, screenshots).populate_result!
end
analyze_tv(name, file, screenshots = 0) click to toggle source

Helper method to analyze a tv episode or season.

# File lib/videoinfo.rb, line 29
def self.analyze_tv(name, file, screenshots = 0)
  Videos::Tv.new(name, file, screenshots).populate_result!
end
ffmpeg_binary() click to toggle source

Get the path to the ffmpeg binary, defaulting to 'ffmpeg'.

# File lib/videoinfo.rb, line 66
def self.ffmpeg_binary
  @ffmpeg_binary ||= 'ffmpeg'
end
ffmpeg_binary=(ffmpeg) click to toggle source

Set the path of the ffmpeg binary.

# File lib/videoinfo.rb, line 61
def self.ffmpeg_binary=(ffmpeg)
  @ffmpeg_binary = ffmpeg.to_s.shellescape
end
google(term) click to toggle source

Performs a google search and returns the top 10 results.

# File lib/videoinfo.rb, line 34
def self.google(term)
  uri = URI("https://www.google.com/search?hl=en&q=#{CGI.escape(term)}")
  begin
    response = Net::HTTP.get_response(uri)
    document = Nokogiri::HTML(response.body.encode('UTF-8', 'binary', :invalid => :replace, :undef => :replace, :replace => ''))
    document.css('cite').map { |node| node.inner_text }
  rescue => e
    raise Error, "could not search google for '#{term}'. #{e.message}"
  end
end
image_host() click to toggle source

Get the image host class, defaulting to ImageHosts::Imgur.new.

# File lib/videoinfo.rb, line 76
def self.image_host
  @image_host ||= ImageHosts::Imgur.new
end
image_host=(host) click to toggle source

Set the image host class. Must be an object that responds to upload(File) and returns a URL.

# File lib/videoinfo.rb, line 71
def self.image_host=(host)
  @image_host = host
end
interactive=(value) click to toggle source

Set interactive mode to true or false.

# File lib/videoinfo.rb, line 81
def self.interactive=(value)
  @interactive = value
end
interactive?() click to toggle source

True if interactive mode is enabled, defaulting to false.

# File lib/videoinfo.rb, line 86
def self.interactive?
  @interactive ||= false
end
mediainfo_binary() click to toggle source

Get the path to the mediainfo binary, defaulting to 'mediainfo'.

# File lib/videoinfo.rb, line 56
def self.mediainfo_binary
  @mediainfo_binary ||= 'mediainfo'
end
mediainfo_binary=(mediainfo) click to toggle source

Set the path of the mediainfo binary.

# File lib/videoinfo.rb, line 51
def self.mediainfo_binary=(mediainfo)
  @mediainfo_binary = mediainfo.to_s.shellescape
end
upload_screenshot(image) click to toggle source

Uploads a screenshot to the currently configured image_host and returns a URL to the image.

# File lib/videoinfo.rb, line 46
def self.upload_screenshot(image)
  image_host.upload(image)
end