<commit_before>window.radiodanPlayer = (function () {
  var supportedServiceTypes = [
    '_mediascape-http._tcp.local',
    '_radiodan-http._tcp.local'
  ];

  return {
    create: function (service) {
      if ( !_.include(supportedServiceTypes, service.serviceType) ) {
        throw new Error('Unsupport service type ', service.serviceType, ' expected ', supportedServiceTypes);
      }

      var uri = service.uri,
          playerId = service.txt.players[0],
          player = Radiodan.create(uri).player.create(playerId);

      return {
        play: function play() {
          return player.play();
        },
        pause: function pause() {
          return player.pause({ value: true });
        },
        nextTrack: function nextTrack() {
          return player.next();
        },
        previousTrack: function previousTrack() {
          return player.previous();
        },
        setVolume: function setVolume(vol) {
          return player.volume({ value: vol });
        },
        clearPlaylist: function clearPlaylist() {
          return player.clear();
        },
        addToPlaylist: function addToPlaylist(path) {
          return player.add({ playlist: [ path ]});
        },
        removeFromPlaylist: function removeFromPlaylist(position) {
          return player.remove({ position: position });
        },
        status: function status() {
          return player.status().then(function (s) { return s.response; });
        }
      }
    }
  };
})();
<commit_msg>Expose event listener interface in player adapter<commit_after>window.radiodanPlayer = (function () {
  var supportedServiceTypes = [
    '_mediascape-http._tcp.local',
    '_radiodan-http._tcp.local'
  ];

  return {
    create: function (service) {
      if ( !_.include(supportedServiceTypes, service.serviceType) ) {
        throw new Error('Unsupport service type ', service.serviceType, ' expected ', supportedServiceTypes);
      }

      var uri = service.uri,
          playerId = service.txt.players[0],
          player = Radiodan.create(uri).player.create(playerId);

      return {
        play: function play() {
          return player.play();
        },
        pause: function pause() {
          return player.pause({ value: true });
        },
        nextTrack: function nextTrack() {
          return player.next();
        },
        previousTrack: function previousTrack() {
          return player.previous();
        },
        setVolume: function setVolume(vol) {
          return player.volume({ value: vol });
        },
        clearPlaylist: function clearPlaylist() {
          return player.clear();
        },
        addToPlaylist: function addToPlaylist(path) {
          return player.add({ playlist: [ path ]});
        },
        removeFromPlaylist: function removeFromPlaylist(position) {
          return player.remove({ position: position });
        },
        status: function status() {
          return player.status().then(function (s) { return s.response; });
        },
        on: function (name, callback) {
          return player.on(name, callback);
        }
      }
    }
  };
})();

{'fraction_non_alphanumeric': 0.12472160356347439, 'fraction_numerical': 0.0006363347120585428, 'mean_word_length': 2.1408591408591406, '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': '4712641', 'n_tokens_mistral': 831, 'n_tokens_neox': 824, 'n_words': 183}