Sha256: 1383639580f3d1314bd7064c479dd17fcb06da7d61c291a34bf1ae1c301e3fe9

Contents?: true

Size: 1.5 KB

Versions: 3

Compression:

Stored size: 1.5 KB

Contents

# frozen_string_literal: true

require 'thor'
require 'evideo/vars1'
require 'evideo/vars2'
require 'evideo/processa'
require 'evideo/version'

# (see Evideo)
module Evideo
  who = `whoami`.chomp
  ADI = ["/home/#{who}/lust", "/media/#{who}/hrv2", "/media/#{who}/hrv2/lust"].freeze

  # CLI para analisar/processar videos
  class CLI < Thor
    class_option :d, banner: 'DIR', type: :array, desc: 'Onde procurar videos', default: ADI
    class_option :i, banner: 'IN',  default: 'ftv', desc: 'Pasta inicial'
    class_option :o, banner: 'OUT', default: 'out', desc: 'Pasta final'

    desc 'conv', 'converte videos'
    option :x, type: :boolean, default: false, desc: 'executa/mostra comando converte videos'
    option :s, type: :numeric, default: 0, desc: 'Segundos cortados no inicio do video final 0=sem cortes'
    option :t, type: :numeric, default: 0, desc: 'Segundos duracao video final 0=sem cortes'
    # converte videos
    def conv
      # cria pasta final para videos processados
      system("mkdir -p #{ipasta}/#{options[:o]}")

      Dir.glob("#{ipasta}/*.???").sort.each do |file|
        Video.new(file, options).processa
      end
    end

    desc 'test', 'testa videos'
    # testa videos
    def test
      Dir.glob("#{ipasta}/*.???").sort.each do |file|
        puts(Video.new(file, options).inout)
      end
    end

    default_task :test
    no_commands do
      # @return [String] pasta absoluta inicial dos videos
      def ipasta
        "#{options[:d][0]}/#{options[:i]}"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
evideo-0.2.7 lib/evideo.rb
evideo-0.2.6 lib/evideo.rb
evideo-0.2.5 lib/evideo.rb