<commit_before>"use strict";

import React from "react";

import classNames from "classnames";

import ArtworkImage from "./ArtworkImage.js";
import ContainerActions from "../actions/ContainerActions.js";
import ContainerConstants from "../constants/ContainerConstants.js";
import GroupAttributes from "../components/GroupAttributes.js";
import Icon from "./Icon.js";
import NowPlayingStore from "../stores/NowPlayingStore.js";
import PlayingStatusStore from "../stores/PlayingStatusStore.js";
import TimeFormatter from "./TimeFormatter.js";

function getNowPlayingState() {
  return {
    track: NowPlayingStore.getTrack(),
    buffered: PlayingStatusStore.getBuffered(),
    duration: PlayingStatusStore.getDuration(),
    currentTime: PlayingStatusStore.getTime(),
    error: PlayingStatusStore.getError(),
  };
}

export default class NowPlaying extends React.Component {
  constructor(props) {
    super(props);

    this.state = getNowPlayingState();
    this._onChange = this._onChange.bind(this);
    this._onClickArtwork = this._onClickArtwork.bind(this);
  }

  componentDidMount() {
    NowPlayingStore.addChangeListener(this._onChange);
    PlayingStatusStore.addChangeListener(this._onChange);
  }

  componentWillUnmount() {
    NowPlayingStore.removeChangeListener(this._onChange);
    PlayingStatusStore.removeChangeListener(this._onChange);
  }

  render() {
    var track = this.state.track;
    if (track === null) {
      return <div className="now-playing-track" />;
    }

    var remainingTime = parseInt(this.state.duration) - parseInt(this.state.currentTime);

    var attributes = [];
    var attributesElement = null;

    for (var attribute of ["Artist", "GroupName"]) {
      if (track[attribute]) {
        attributes.push(track[attribute]);
      }
    }

    if (attributes) {
      attributesElement = <GroupAttributes list={attributes} />;<commit_msg>Add Composer attribute to current track.<commit_after>"use strict";

import React from "react";

import classNames from "classnames";

import ArtworkImage from "./ArtworkImage.js";
import ContainerActions from "../actions/ContainerActions.js";
import ContainerConstants from "../constants/ContainerConstants.js";
import GroupAttributes from "../components/GroupAttributes.js";
import Icon from "./Icon.js";
import NowPlayingStore from "../stores/NowPlayingStore.js";
import PlayingStatusStore from "../stores/PlayingStatusStore.js";
import TimeFormatter from "./TimeFormatter.js";

function getNowPlayingState() {
  return {
    track: NowPlayingStore.getTrack(),
    buffered: PlayingStatusStore.getBuffered(),
    duration: PlayingStatusStore.getDuration(),
    currentTime: PlayingStatusStore.getTime(),
    error: PlayingStatusStore.getError(),
  };
}

export default class NowPlaying extends React.Component {
  constructor(props) {
    super(props);

    this.state = getNowPlayingState();
    this._onChange = this._onChange.bind(this);
    this._onClickArtwork = this._onClickArtwork.bind(this);
  }

  componentDidMount() {
    NowPlayingStore.addChangeListener(this._onChange);
    PlayingStatusStore.addChangeListener(this._onChange);
  }

  componentWillUnmount() {
    NowPlayingStore.removeChangeListener(this._onChange);
    PlayingStatusStore.removeChangeListener(this._onChange);
  }

  render() {
    var track = this.state.track;
    if (track === null) {
      return <div className="now-playing-track" />;
    }

    var remainingTime = parseInt(this.state.duration) - parseInt(this.state.currentTime);

    var attributes = [];
    var attributesElement = null;

    for (var attribute of ["Artist", "GroupName", "Composer"]) {
      if (track[attribute]) {
        attributes.push(track[attribute]);
      }
    }

    if (attributes) {
      attributesElement = <GroupAttributes list={attributes} />;
{'fraction_non_alphanumeric': 0.12286689419795221, 'fraction_numerical': 0.0, 'mean_word_length': 4.2770083102493075, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '6641847', 'n_tokens_mistral': 1077, 'n_tokens_neox': 1029, 'n_words': 222}