<commit_before>require "shellwords"
require "rubygems"
require "json"

module Streaker
  class Exif
    attr_reader :file
    
    def initialize(file, *attributes)
      @file = file
      @requested = attributes.map { |a| "-#{a}" }
    end
    
    def [](key)
      attributes[key]
    end
    
    def attributes
      @attributes ||= JSON.parse(`#{command}`).first
    end
    
    def command
      command = "#{exiftool} -j"
      command << " #{@requested.join(" ")}" unless @requested.empty?
      command << " #{file.shellescape}"
    end
    
    def exiftool
      @exiftool ||= `which exiftool`.strip
    end
  end
end
<commit_msg>Use -json instead of -j in Streaker::Exif to reduce ambiguity; add Streaker::Exif.exiftool config option<commit_after>require "shellwords"
require "rubygems"
require "json"

module Streaker
  class Exif
    attr_reader :file
    
    def initialize(file, *attributes)
      @file = file
      @requested = attributes.map { |a| "-#{a}" }
    end
    
    def [](key)
      attributes[key]
    end
    
    def attributes
      @attributes ||= JSON.parse(`#{command}`).first
    end
    
    def command
      command = "#{exiftool} -json"
      command << " #{@requested.join(" ")}" unless @requested.empty?
      command << " #{file.shellescape}"
    end
    
    def exiftool
      self.class.exiftool || `which exiftool`.strip
    end
    
    class << self
      attr_accessor :exiftool
    end
  end
end

{'fraction_non_alphanumeric': 0.12603305785123967, 'fraction_numerical': 0.0, 'mean_word_length': 2.363425925925926, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7109063', 'n_tokens_mistral': 476, 'n_tokens_neox': 476, 'n_words': 120}