<commit_before>args = require('system').args
async = require('async')
page = require('webpage').create()

if args.length != 6
  console.log("Usage: phantomjs capture-phantom.coffee URL PATH TOTAL WIDTH" + \
              " HEIGHT")
  phantom.exit(1)
else
  url = args[1]
  path = args[2]
  total = parseInt args[3], 10
  width = parseInt args[4], 10
  height = parseInt args[5], 10

  increment = 360/total
  rotations = (i for i in [0...360] by increment)

  image_path = (rotation) ->
    num = ("000" + rotation).slice(-3)
    path.replace('.png', '') + "-#{num}.png"

  # Rotation by calling the 3D Viewer through the DOM
  rotateY = (y) ->
    window.viewer.rotate(0, y, 0)
    window.viewer.update()

  rotator = (i, callback) ->
    rotation = i * increment
    console.log("#{i}/#{total}: Rotate to #{rotation}")
    page.evaluate(rotateY, increment)
    window.setTimeout((->
      page.render(image_path(rotation))
      callback()
    ), 100)

  page.viewportSize = { width: width, height: height }
  page.paperSize = { width: width, height: height }
  page.clipRect = { top: 0, left: 0, width: width, height: height }
  page.onConsoleMessage = (msg) -> console.log("console: #{msg}")
  page.open url, ->
    window.setTimeout((->
      async.eachSeries [0..total], rotator, ->
        phantom.exit()
    ), 500)
<commit_msg>More timeouts for more time to take captures<commit_after>args = require('system').args
async = require('async')
page = require('webpage').create()

if args.length != 6
  console.log("Usage: phantomjs capture-phantom.coffee URL PATH TOTAL WIDTH" + \
              " HEIGHT")
  phantom.exit(1)
else
  url = args[1]
  path = args[2]
  total = parseInt args[3], 10
  width = parseInt args[4], 10
  height = parseInt args[5], 10

  increment = 360/total
  rotations = (i for i in [0...360] by increment)

  image_path = (rotation) ->
    num = ("000" + rotation).slice(-3)
    path.replace(".png", "") + "-#{num}.png"

  # Rotation by calling the 3D Viewer through the DOM
  rotateY = (y) ->
    window.viewer.rotate(0, y, 0)
    window.viewer.update()

  rotator = (i, callback) ->
    rotation = i * increment
    console.log("#{i}/#{total}: Rotate to #{rotation}")
    page.evaluate(rotateY, increment)
    window.setTimeout((->
      page.render(image_path(rotation))
      callback()
    ), 200)

  page.viewportSize = { width: width, height: height }
  page.paperSize = { width: width, height: height }
  page.clipRect = { top: 0, left: 0, width: width, height: height }
  page.onConsoleMessage = (msg) -> console.log("console: #{msg}")
  page.open url, ->
    window.setTimeout((->
      async.eachSeries [0..total], rotator, ->
        phantom.exit()
    ), 1000)

{'fraction_non_alphanumeric': 0.16494082840236687, 'fraction_numerical': 0.026997041420118342, 'mean_word_length': 3.0737951807228914, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '2430768', 'n_tokens_mistral': 969, 'n_tokens_neox': 898, 'n_words': 235}