<commit_before>var sonos = sonos || {};

sonos.stateName = function (state) {
  if (state === 'PAUSED_PLAYBACK') {
    return 'Pause:';
  }
  if (state === 'PLAYING') {
    return 'Spiller av:';
  }
  if (state === 'STOPPED') {
    return 'Stoppet';
  }
  return '';
};

sonos.view = function (vnode) {
  if (Object.keys(vnode.attrs.data).length === 0) {
    return m('p', 'Waiting for data');
  }
  var current = [];
  var state = vnode.attrs.data;
  state.state = sonos.stateName(state.state);
  if (Object.keys(state.current).length > 0) {
    current = [
      m('h1', jrvs.truncate(state.current.title, 28)),
      m('p.fade', 'av'),
      m('h2', jrvs.truncate(state.current.artist, 20)),
      m('p.fade',
        m('small', state.current.position + ' / ' + state.current.duration)
       )
    ];<commit_msg>Do not show artist prefix when empty<commit_after>var sonos = sonos || {};

sonos.stateName = function (state) {
  if (state === 'PAUSED_PLAYBACK') {
    return 'Pause:';
  }
  if (state === 'PLAYING') {
    return 'Spiller av:';
  }
  if (state === 'STOPPED') {
    return 'Stoppet';
  }
  return '';
};

sonos.view = function (vnode) {
  if (Object.keys(vnode.attrs.data).length === 0) {
    return m('p', 'Waiting for data');
  }
  var current = [];
  var state = vnode.attrs.data;
  state.state = sonos.stateName(state.state);
  if (Object.keys(state.current).length > 0) {
    current = [
      m('h1', jrvs.truncate(state.current.title, 28)),
      m('p.fade', state.current.artist.length > 0 ? 'av' : ''),
      m('h2', jrvs.truncate(state.current.artist, 20)),
      m('p.fade',
        m('small', state.current.position + ' / ' + state.current.duration)
       )
    ];
{'fraction_non_alphanumeric': 0.19834710743801653, 'fraction_numerical': 0.010035419126328217, 'mean_word_length': 2.8876146788990824, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '7465679', 'n_tokens_mistral': 646, 'n_tokens_neox': 624, 'n_words': 122}