<commit_before>
class Shja::Html
  attr_reader :movies
  attr_reader :target_dir

  def initialize(movies: movies, target_dir: target_dir)
    @movies = movies
    @target_dir = target_dir
  end

  def generate_movies_js
    open(File.join(target_dir, "movies.js"), 'w') do |io|
      io.write('var movies = ' + JSON.generate(_movies_js_list) + ';')
    end
  end

  def generate_detail_js(movie)
    metadata = movie.pictures_metadata
    open(File.join(movie.photoset_dir_path, 'index.js'), 'w') do |io|
      io.write("calbackImageFilename(" + JSON.pretty_generate(metadata) + ");")
    end
  end<commit_msg>Check pictures when generate index.js<commit_after>
class Shja::Html
  attr_reader :movies
  attr_reader :target_dir

  def initialize(movies: movies, target_dir: target_dir)
    @movies = movies
    @target_dir = target_dir
  end

  def generate_movies_js
    open(File.join(target_dir, "movies.js"), 'w') do |io|
      io.write('var movies = ' + JSON.generate(_movies_js_list) + ';')
    end
  end

  def generate_detail_js(movie)
    return unless movie.has_pictures?
    metadata = movie.pictures_metadata
    open(File.join(movie.photoset_dir_path, 'index.js'), 'w') do |io|
      io.write("calbackImageFilename(" + JSON.pretty_generate(metadata) + ");")
    end
  end
{'fraction_non_alphanumeric': 0.12383177570093458, 'fraction_numerical': 0.0, 'mean_word_length': 4.01953125, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5064026', 'n_tokens_mistral': 463, 'n_tokens_neox': 445, 'n_words': 90}