<commit_before>
var url = process.argv[2] || 'http://radio.nugs.net:8002';
var icecast = require('./');

if (process.stdout.isTTY) {
  console.error('fatal: you must pipe this script to mpg123');
  process.exit(1);
}

var req = new icecast.Client(url, function (res) {
  console.error(res.headers);
  res.on('metadata', onMetadata);
  res.pipe(process.stdout);
});

function onMetadata (metadata) {
  metadata = icecast.parse(metadata);
  console.error('METADATA EVENT:');
  console.error(metadata);
}

req.end();<commit_msg>simplify t.js even further by using `icecast.get()`<commit_after>
var url = process.argv[2] || 'http://radio.nugs.net:8002';
var icecast = require('./');

if (process.stdout.isTTY) {
  console.error('fatal: you must pipe this script to mpg123');
  process.exit(1);
}

icecast.get(url, function (res) {
  console.error(res);
  console.error(res.headers);
  res.on('metadata', onMetadata);
  res.pipe(process.stdout);
});

function onMetadata (metadata) {
  metadata = icecast.parse(metadata);
  console.error('METADATA EVENT:');
  console.error(metadata);
}
{'fraction_non_alphanumeric': 0.17853839037927843, 'fraction_numerical': 0.016651248843663275, 'mean_word_length': 4.880434782608695, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6209153', 'n_tokens_mistral': 387, 'n_tokens_neox': 372, 'n_words': 78}