<commit_before>var _      = require('lodash');
var fs     = require('fs');
var path   = require('path');
var glob   = require('glob');

exports.build = function(metadata, opts) {

  function fileInfo(data, file) {
    return {
      date: data.exif.date || data.fileDate,
      path: file,
      name: path.basename(file),
      video: data.mediaType === 'video',
      size: opts.thumbSize,
      urls: urls(file, data)
    }
  }

  function urls(file, data) {
    var ret;
    if (data.mediaType === 'video') {
      ret = {
        thumb:     path.join('media', 'thumbs', ext(file, 'jpg')),
        poster:    path.join('media', 'large',  ext(file, 'jpg')),
        video:     path.join('media', 'large',  ext(file, 'mp4')),
        download:  path.join('media', 'large',  ext(file, 'mp4'))
      };
      if (opts.originalVideos) {
        ret.download = path.join('media', 'original', file);
      }
    } else {
      ret = {
        thumb:     path.join('media', 'thumbs', file),
        large:     path.join('media', 'large', file),
        download:  path.join('media', 'large', file)
      }
      if (opts.originalPhotos) {
        ret.download = path.join('media', 'original', file);
      }
    }
    return ret;
  }

  function download(file) {
    path.join('media', 'original', file)
  }<commit_msg>Refactor view model URLs<commit_after>var _      = require('lodash');
var fs     = require('fs');
var path   = require('path');
var glob   = require('glob');

exports.build = function(metadata, opts) {

  function fileInfo(data, file) {
    return {
      date: data.exif.date || data.fileDate,
      path: file,
      name: path.basename(file),
      video: data.mediaType === 'video',
      size: opts.thumbSize,
      urls: urls(file, data)
    }
  }

  function urls(file, data) {
    if (data.mediaType === 'video') {
      var urls = videoUrls(file);
      urls.download = opts.originalVideos ? urls.original : urls.video;
      return urls;
    } else {
      var urls = photoUrls(file);
      urls.download = opts.originalPhotos ? urls.original : urls.large;
      return urls;
    }
  }

  function videoUrls(file) {
    return {
      thumb:     path.join('media', 'thumbs', ext(file, 'jpg')),
      poster:    path.join('media', 'large',  ext(file, 'jpg')),
      video:     path.join('media', 'large',  ext(file, 'mp4')),
      original:  path.join('media', 'original', file)
    };
  }

  function photoUrls(file) {
    return {
      thumb:     path.join('media', 'thumbs', file),
      large:     path.join('media', 'large', file),
      original:  path.join('media', 'original', file)
    };
  }
{'fraction_non_alphanumeric': 0.1725057121096725, 'fraction_numerical': 0.0011424219345011425, 'mean_word_length': 2.4794701986754966, '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': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1155142', 'n_tokens_mistral': 886, 'n_tokens_neox': 872, 'n_words': 193}