<commit_before>const photos = Application('photos');
const terminal = Application('terminal');
const albums = photos.albums();

const pad = (val) => String(val).length < 2 ? '0' + val : String(val);
const app = Application.currentApplication()
app.includeStandardAdditions = true;

albums.forEach(album => {
  const name = album.name();
  const items = album.mediaItems();
  const path = Path('./export/' + name);

  items.forEach(item => {
    const filename = item.filename();
    const date = item.date();
    const formattedDate = pad(date.getMonth() + 1) + '/' +
      pad(date.getDate()) + '/' +
      date.getFullYear() + ' ' +
      pad(date.getHours()) + ':' +
      pad(date.getMinutes()) + ':' +
      pad(date.getSeconds());

    console.log(filename + ' => ' + path);
    photos.export([item], {to: path});

    const videoPath = (path + '/' + filename).replace(/(.*)\.[0-9A-Za-z]+$/, '$1.m4v');
    const cmd = 'ls "' + videoPath + '" && ' +
      'SetFile -d "' + formattedDate + '" "' + videoPath + '"';

    try {
      app.doShellScript(cmd);
      console.log('Set creation date for video file');
    } catch (e) {
    }
  });
});<commit_msg>Set both jpg and m4v creation dates<commit_after>const photos = Application('photos');
const terminal = Application('terminal');
const albums = photos.albums();

const pad = (val) => String(val).length < 2 ? '0' + val : String(val);
const app = Application.currentApplication()
app.includeStandardAdditions = true;

albums.forEach(album => {
  const name = album.name();
  const items = album.mediaItems();
  const path = Path('./export/' + name);

  items.forEach(item => {
    const filename = item.filename();
    const date = item.date();
    const formattedDate = pad(date.getMonth() + 1) + '/' +
      pad(date.getDate()) + '/' +
      date.getFullYear() + ' ' +
      pad(date.getHours()) + ':' +
      pad(date.getMinutes()) + ':' +
      pad(date.getSeconds());

    console.log(filename + ' => ' + path);
    photos.export([item], {to: path});

    const fileRegex = /(.*)\.[0-9A-Za-z]+$/;
    const target = (path + '/' + filename);
    [
      target.replace(fileRegex, '$1.m4v'),
      target.replace(fileRegex, '$1.jpg')
    ].forEach((file) => {
      const cmd = 'ls "' + file + '" && ' +
        'SetFile -d "' + formattedDate + '" "' + file + '"';

      try {
        app.doShellScript(cmd);
      } catch (e) {
      }
    });
  });
});
{'fraction_non_alphanumeric': 0.20645428216797684, 'fraction_numerical': 0.006619776582540339, 'mean_word_length': 2.881219903691814, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 12, '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': '3479015', 'n_tokens_mistral': 806, 'n_tokens_neox': 780, 'n_words': 161}