Skip to content

Instantly share code, notes, and snippets.

@nerdinand
Last active August 29, 2015 14:01
Show Gist options
  • Save nerdinand/dcd0b3da194fe2ff2bcb to your computer and use it in GitHub Desktop.
Save nerdinand/dcd0b3da194fe2ff2bcb to your computer and use it in GitHub Desktop.
Ruby one-liner for calculating the total activity of each of the tracks from an Auphonic production description file
require "json"; p JSON.parse(File.read("ZCH042.json", external_encoding: "iso-8859-1", internal_encoding: "utf-8"))["statistics"]["tracks"].map{|t| [t["identifier"], t["activity"].nil? ? nil : t["activity"].map{|kv| kv[1] - kv[0]}.inject(:+)/60 ]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment