Sha256: b9f473cd6a4e280884e83ab57c0f11e9321d40a58ce5e71a1f93006bbfe6f335
Contents?: true
Size: 1 KB
Versions: 1
Compression:
Stored size: 1 KB
Contents
# frozen_string_literal: true require_relative 'tag/version' require_relative 'tag/file' require_relative 'tag/flac' require_relative 'tag/mp3' module UnitF module Tag class Error < StandardError; end class MissingCover < Error; end def self.logger @logger ||= Logger.new($stdout) end def self.valid_file?(file_path) ::File.file?(file_path) && file_path.encode.match(/\.(flac|mp3)$/i) rescue ArgumentError => e logger.error("Error processing #{file_path} - #{e.message}") false end def self.process_target(target) if ::File.directory?(target) find_files(target) elsif valid_file?(target) [UnitF::Tag::File.new(target)] else [] end end def self.find_files(root_path) files = [] Find.find(root_path) do |file_path| logger.debug("Considering #{file_path}") next unless valid_file?(file_path) files << UnitF::Tag::File.new(file_path) end files end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
unitf-tag-0.1.4 | lib/unitf/tag.rb |