Sha256: ad4499c4722c348c4b61fbf0d42d867911d288652d9b7f90cf58d6c4e4573b3f

Contents?: true

Size: 825 Bytes

Versions: 2

Compression:

Stored size: 825 Bytes

Contents

#!/usr/bin/env ruby

require 'strip_audio'

module StripAudio

  class InValidArguments < StandardError
  end

  class CLI

    VIDEO_FORMATS = %w[mp4 avi flv mkv mov]

    def initialize
      @videos = ARGV

      doctor

      @stripper = Stripper.new format:"mp3"
      process
    end

    def process
      @videos.each do |video|
        @stripper.strip(video)
      end
    end

    private

    def doctor
      unless files_exist? && valid_video_formats?
        raise InValidArguments, "Please check the video file names provided." 
      end
    end

    def files_exist?
      @videos.all? do |video|
        File.file?(video)
      end
    end

    def valid_video_formats?
      @videos.all? do |video|
        VIDEO_FORMATS.include? File.extname(video)[1..-1]
      end
    end

  end

  app =  CLI.new

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
strip_audio-0.0.2 bin/strip_audio
strip_audio-0.0.1 bin/strip_audio