Skip to content

Instantly share code, notes, and snippets.

@velizarn
Created February 15, 2025 12:52
Show Gist options
  • Save velizarn/d0862df1056b89ca8d5ff01833353ea6 to your computer and use it in GitHub Desktop.
Save velizarn/d0862df1056b89ca8d5ff01833353ea6 to your computer and use it in GitHub Desktop.
DROffline log parser
'use strict';
const fs = require('fs'), readline = require('readline');
const drValues = [];
const input = process.argv[2];
const logPath = `./${input}`;
const average = array => array.reduce((a, b) => a + b) / array.length;
console.log(logPath);
const rd = readline.createInterface({
input: fs.createReadStream(logPath),
// output: process.stdout,
console: false
});
rd.on('line', function(line) {
if (line.includes('| .flac |')) {
const dr = line.split('|').slice(-2, -1)[0].trim();
drValues.push(parseInt(dr));
}
});
rd.on('close', function() {
console.log('album', Math.round(average(drValues)));
console.log('min', Math.min(...drValues));
console.log('max', Math.max(...drValues));
console.log(drValues.join(', '));
});
File Name | Format | SR | Word Length | Max. TPL | LUFSi | DR (PMF) |
01 Rapid Fire | .flac | 44.1k | 16 | +1.83 | -8.11 | 7 |
02 Metal Gods | .flac | 44.1k | 16 | +1.44 | -9.15 | 8 |
03 Breaking The Law | .flac | 44.1k | 16 | +1.53 | -8.52 | 7 |
04 Grinder | .flac | 44.1k | 16 | +1.80 | -8.24 | 7 |
05 United | .flac | 44.1k | 16 | +0.77 | -10.05 | 9 |
06 You Don't Have To Be Old To Be Wise | .flac | 44.1k | 16 | +1.32 | -8.41 | 8 |
07 Living After Midnight | .flac | 44.1k | 16 | +1.47 | -9.14 | 8 |
08 The Rage | .flac | 44.1k | 16 | +1.49 | -8.99 | 7 |
09 Steeler | .flac | 44.1k | 16 | +1.67 | -8.83 | 7 |
10 Red, White & Blue | .flac | 44.1k | 16 | +0.42 | -10.81 | 9 |
11 Grinder [Live] | .flac | 44.1k | 16 | +0.74 | -10.08 | 10 |
Number of EP/Album Files: 11
Official EP/Album DR: 8
$ node.exe ./parser.js British-Steel_JP_SICP-6143_log.txt
./British-Steel_JP_SICP-6143_log.txt
album 8
min 7
max 10
7, 8, 7, 7, 9, 8, 8, 7, 7, 9, 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment