Sha256: cb7af41b9141ceefe02ae27ab187d4e29214f2ceb50f8614a11ea887cf6afa82

Contents?: true

Size: 1.73 KB

Versions: 21

Compression:

Stored size: 1.73 KB

Contents

# frozen_string_literal: true

require 'eac_cli/core_ext'
require 'ehbrs/videos/unsupported/check_set'
require 'ehbrs/videos/unsupported/search'
require 'ehbrs/videos/unsupported/profiles'

module Ehbrs
  module Tools
    class Runner
      class Videos
        class Unsupported
          PROFILES = %w[aoc philco samsung].freeze

          runner_with :help do
            desc 'Procura e converte vídeos não suportados pelas TVs de EHB/RS.'
            bool_opt '-f', '--fix', 'Converte vídeos para o formato apropriado.'
            arg_opt '-p', '--profiles', "Seleciona os perfis (#{PROFILES.join(', ')})."
            pos_arg 'paths', repeat: true
          end

          def run
            infov 'Profiles', profiles.join(', ')
            infov 'Paths', paths
            paths.each do |d|
              ::Ehbrs::Videos::Unsupported::Search.new(d, file_options)
            end
          end

          private

          def file_check_set_uncached
            ::Ehbrs::Videos::Unsupported::CheckSet.build(profiles, :file)
          end

          def track_check_set_uncached
            ::Ehbrs::Videos::Unsupported::CheckSet.build(profiles, :track)
          end

          def paths
            parsed.paths
          end

          def file_options
            { file_check_set: file_check_set, track_check_set: track_check_set,
              fix: parsed.fix? }
          end

          def profiles_uncached
            parsed.profiles.if_present(PROFILES) { |v| v.split(',').map(&:strip) }
                  .map { |name| profile_class(name).instance }
          end

          def profile_class(profile_name)
            ::Ehbrs::Videos::Unsupported::Profiles.const_get(profile_name.camelize)
          end
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
ehbrs-tools-0.37.0 lib/ehbrs/tools/runner/videos/unsupported.rb
ehbrs-tools-0.36.0 lib/ehbrs/tools/runner/videos/unsupported.rb
ehbrs-tools-0.35.1 lib/ehbrs/tools/runner/videos/unsupported.rb
ehbrs-tools-0.35.0 lib/ehbrs/tools/runner/videos/unsupported.rb
ehbrs-tools-0.34.0 lib/ehbrs/tools/runner/videos/unsupported.rb
ehbrs-tools-0.33.0 lib/ehbrs/tools/runner/videos/unsupported.rb
ehbrs-tools-0.32.0 lib/ehbrs/tools/runner/videos/unsupported.rb
ehbrs-tools-0.31.1 lib/ehbrs/tools/runner/videos/unsupported.rb
ehbrs-tools-0.31.0 lib/ehbrs/tools/runner/videos/unsupported.rb
ehbrs-tools-0.30.0 lib/ehbrs/tools/runner/videos/unsupported.rb
ehbrs-tools-0.29.0 lib/ehbrs/tools/runner/videos/unsupported.rb
ehbrs-tools-0.28.3 lib/ehbrs/tools/runner/videos/unsupported.rb
ehbrs-tools-0.28.2 lib/ehbrs/tools/runner/videos/unsupported.rb
ehbrs-tools-0.28.1 lib/ehbrs/tools/runner/videos/unsupported.rb
ehbrs-tools-0.28.0 lib/ehbrs/tools/runner/videos/unsupported.rb
ehbrs-tools-0.27.0 lib/ehbrs/tools/runner/videos/unsupported.rb
ehbrs-tools-0.26.0 lib/ehbrs/tools/runner/videos/unsupported.rb
ehbrs-tools-0.25.1 lib/ehbrs/tools/runner/videos/unsupported.rb
ehbrs-tools-0.25.0 lib/ehbrs/tools/runner/videos/unsupported.rb
ehbrs-tools-0.24.0 lib/ehbrs/tools/runner/videos/unsupported.rb