<commit_before>/*jslint indent: 2, maxlen: 80, continue: true, node: true, regexp: true*/
"use strict";

var http = require('http'),
  fs = require('fs'),
  util = require('util'),
  EasySax = require('easysax'),
  async = require("async"),
  XmlEntities = require("html-entities").XmlEntities;

function parseMetaDataXML(xml) {
  var result = [];
  var saxParser = new EasySax();
  var nodeValue;
  var currentItem = {};
  var currentAttr = {};

  var mapping = {
    "dc:title": "title",
    "dc:creator": "artist",
    "upnp:album": "album",
    "upnp:albumArtURI": "albumArtURI",
    "res": "uri",
    "r:resMD": "metaData"
  };

  var mapping_attr = {
    "id":"id",
  }

  saxParser.on('textNode', function (str, uq) {
    nodeValue = uq(str);
  });

  saxParser.on('startNode', function(elem, attr){
    if(elem == "container"){
      var attributes = attr();
      for(var key in attributes){
        if(!mapping_attr[key])  continue;
        currentAttr[mapping_attr[key]]=attributes[key]||"";
      };
    }
  });

  saxParser.on('endNode', function (elem, unEntities, tagstart, getStringNode) {
    if (elem=="container" || elem =="item") {
      result.push(currentItem);
      currentItem = {};
      currentAttr = {};
    }

    if (!mapping[elem]) return;
    currentItem[mapping[elem]] = nodeValue||"";
    for(var key in currentAttr){
      if(currentAttr.hasOwnProperty(key)){
        currentItem["attr"] = currentAttr;
        break;
      }
    }
  });
  saxParser.parse(xml);
  return result;
}


function Player(roomName, descriptorUrl, uuid, discovery) {
  var _this = this;
  var positionInfoTimeout;
  var sids = {};
  // for prototype access
  this.discovery = discovery;
  this.address = descriptorUrl.replace(/http:\/\/([\d\.]+).*/, "$1");
  this.roomName = roomName;
  this.zoneType = 0;
  this.uuid = uuid;
  this.state = {
    currentTrack: {
      artist: "",
      title: "",
      album: "",<commit_msg>Player name removal of XML entities<commit_after>/*jslint indent: 2, maxlen: 80, continue: true, node: true, regexp: true*/
"use strict";

var http = require('http'),
  fs = require('fs'),
  util = require('util'),
  EasySax = require('easysax'),
  async = require("async"),
  XmlEntities = require("html-entities").XmlEntities;

function parseMetaDataXML(xml) {
  var result = [];
  var saxParser = new EasySax();
  var nodeValue;
  var currentItem = {};
  var currentAttr = {};

  var mapping = {
    "dc:title": "title",
    "dc:creator": "artist",
    "upnp:album": "album",
    "upnp:albumArtURI": "albumArtURI",
    "res": "uri",
    "r:resMD": "metaData"
  };

  var mapping_attr = {
    "id":"id",
  }

  saxParser.on('textNode', function (str, uq) {
    nodeValue = uq(str);
  });

  saxParser.on('startNode', function(elem, attr){
    if(elem == "container"){
      var attributes = attr();
      for(var key in attributes){
        if(!mapping_attr[key])  continue;
        currentAttr[mapping_attr[key]]=attributes[key]||"";
      };
    }
  });

  saxParser.on('endNode', function (elem, unEntities, tagstart, getStringNode) {
    if (elem=="container" || elem =="item") {
      result.push(currentItem);
      currentItem = {};
      currentAttr = {};
    }

    if (!mapping[elem]) return;
    currentItem[mapping[elem]] = nodeValue||"";
    for(var key in currentAttr){
      if(currentAttr.hasOwnProperty(key)){
        currentItem["attr"] = currentAttr;
        break;
      }
    }
  });
  saxParser.parse(xml);
  return result;
}


function Player(roomName, descriptorUrl, uuid, discovery) {
  var _this = this;
  var positionInfoTimeout;
  var sids = {};
  var xmlEntities = new XmlEntities();
  // for prototype access
  this.discovery = discovery;
  this.address = descriptorUrl.replace(/http:\/\/([\d\.]+).*/, "$1");
  this.roomName = xmlEntities.decode(roomName);
  this.zoneType = 0;
  this.uuid = uuid;
  this.state = {
    currentTrack: {
      artist: "",
      title: "",
      album: "",
{'fraction_non_alphanumeric': 0.17572692793931732, 'fraction_numerical': 0.0025284450063211127, 'mean_word_length': 3.190677966101695, 'pattern_counts': {'":': 14, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '2916336', 'n_tokens_mistral': 1340, 'n_tokens_neox': 1325, 'n_words': 285}