Sha256: 181f51789ad22ba36db20ea4c6641637e73391a06fd7f944c7720fe359e98c93

Contents?: true

Size: 1.52 KB

Versions: 2

Compression:

Stored size: 1.52 KB

Contents

#!/usr/bin/env ruby

lib = File.expand_path(File.dirname(__FILE__) + '/../lib')
$LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)

require 'optparse'
require 'propre'

options = {}
OptionParser.new do |opt|
  opt.banner = "Usage: #{ File.basename($0) } [OPTION]... SOURCE..."

  opt.on('-i', '--interactive', 'Run interactively') do |v|
    options[:interactive] = v
  end

  opt.on('-R', '--recursive', 'Run recursively') do |v|
    options[:recursive] = v
  end

  opt.on('-V', '--video-only', 'Search for video files only') do |v|
    options[:videonly] = v
  end

  opt.on('-s', '--sanitize', 'Sanitize filename before search') do |v|
    options[:sanitize] = v
  end

  opt.on('-d', '--dotfile', 'Don\'t ignore .dotfile') do |v|
    options[:dotfile] = v
  end

  opt.on_tail("-v", "--version", "Show version information about this program and quit.") do
    puts "#{Propre} - v#{Propre::VERSION}"
    exit
  end

  opt.on_tail("-h", "--help", "--usage", "Show this help message and quit.") do |v|
    puts opt.help
    exit
  end

  options[:help] = opt.help

end.parse!

def main(options)
  if ARGV.size < 1
    puts options[:help]
  else
    propre = Propre.new(options)
    if File.directory?(ARGV[0])
      puts "Searching for movies title..."
      propre.crawlDirectory(ARGV[0])
    end

    if File.file?(ARGV[0])
      puts "Searching for movie title..."
      propre.searchMovieFromFile(ARGV[0])
    end
  end
end

begin
  main(options)
rescue Interrupt
  puts "\nExiting..."  
rescue StandardError => e
  puts e
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
propre-0.1.0 bin/propre
propre-0.0.8 bin/propre