<commit_before>﻿import React from 'react';
import moment from 'moment';
import _ from 'lodash';
import PureRenderMixin from 'react-addons-pure-render-mixin';
import {
    IconButton
}
from 'material-ui';


import PlayerStore from '../store';
import PlayerActions from '../actions';

export
default React.createClass({

    mixins: [PureRenderMixin],

    getInitialState() {
        return {
            fullscreen: PlayerStore.getState().fullscreen,
            uiShown: PlayerStore.getState().uiShown || PlayerStore.getState().playlistOpen,

            scrobbling: false,
            playing: PlayerStore.getState().playing,
            position: PlayerStore.getState().position,
            buffering: PlayerStore.getState().buffering,
            time: PlayerStore.getState().time,
            length: PlayerStore.getState().length,

            currentTime: PlayerStore.getState().currentTime,
            totalTime: PlayerStore.getState().totalTime
        }
    },
    componentWillMount() {
        PlayerStore.listen(this.update);
    },
    componentDidMount() {
        window.addEventListener('mousemove', this.handleGlobalMouseMove);
        window.addEventListener('mouseup', this.handleGlobalMouseUp);
    },
    componentWillUnmount() {
        window.removeEventListener('mousemove', this.handleGlobalMouseMove);
        window.removeEventListener('mouseup', this.handleGlobalMouseUp);
        PlayerStore.unlisten(this.update);
    },
    update() {
        if (this.isMounted()) {
            this.setState({
                fullscreen: PlayerStore.getState().fullscreen,
                uiShown: PlayerStore.getState().uiShown || PlayerStore.getState().playlistOpen,

                playing: PlayerStore.getState().playing,
                position: PlayerStore.getState().position,
                buffering: PlayerStore.getState().buffering,
                seekable: PlayerStore.getState().seekable,
                time: PlayerStore.getState().time,
                length: PlayerStore.getState().length,

                currentTime: PlayerStore.getState().currentTime,
                totalTime: PlayerStore.getState().totalTime
            });
        }
    },
    delayScrobbleGUI() {
        _.delay(() => {
            this.setState({
                keepScrobbleGUI: false
            })
        }, 1000)
    },
    handlePausePlay() {
        if (!this.state.buffering)
            this.state.playing ? PlayerActions.pause() : PlayerActions.play();
    },
    handleFullscreen() {
        PlayerActions.toggleFullscreen(!this.state.fullscreen);
    },
    handleScrobblerHover(event) {

        var newState = {};<commit_msg>play pause no matter what<commit_after>﻿import React from 'react';
import moment from 'moment';
import _ from 'lodash';
import PureRenderMixin from 'react-addons-pure-render-mixin';
import {
    IconButton
}
from 'material-ui';


import PlayerStore from '../store';
import PlayerActions from '../actions';

export
default React.createClass({

    mixins: [PureRenderMixin],

    getInitialState() {
        return {
            fullscreen: PlayerStore.getState().fullscreen,
            uiShown: PlayerStore.getState().uiShown || PlayerStore.getState().playlistOpen,

            scrobbling: false,
            playing: PlayerStore.getState().playing,
            position: PlayerStore.getState().position,
            buffering: PlayerStore.getState().buffering,
            time: PlayerStore.getState().time,
            length: PlayerStore.getState().length,

            currentTime: PlayerStore.getState().currentTime,
            totalTime: PlayerStore.getState().totalTime
        }
    },
    componentWillMount() {
        PlayerStore.listen(this.update);
    },
    componentDidMount() {
        window.addEventListener('mousemove', this.handleGlobalMouseMove);
        window.addEventListener('mouseup', this.handleGlobalMouseUp);
    },
    componentWillUnmount() {
        window.removeEventListener('mousemove', this.handleGlobalMouseMove);
        window.removeEventListener('mouseup', this.handleGlobalMouseUp);
        PlayerStore.unlisten(this.update);
    },
    update() {
        if (this.isMounted()) {
            this.setState({
                fullscreen: PlayerStore.getState().fullscreen,
                uiShown: PlayerStore.getState().uiShown || PlayerStore.getState().playlistOpen,

                playing: PlayerStore.getState().playing,
                position: PlayerStore.getState().position,
                buffering: PlayerStore.getState().buffering,
                seekable: PlayerStore.getState().seekable,
                time: PlayerStore.getState().time,
                length: PlayerStore.getState().length,

                currentTime: PlayerStore.getState().currentTime,
                totalTime: PlayerStore.getState().totalTime
            });
        }
    },
    delayScrobbleGUI() {
        _.delay(() => {
            this.setState({
                keepScrobbleGUI: false
            })
        }, 1000)
    },
    handlePausePlay() {
        this.state.playing ? PlayerActions.pause() : PlayerActions.play();
    },
    handleFullscreen() {
        PlayerActions.toggleFullscreen(!this.state.fullscreen);
    },
    handleScrobblerHover(event) {

        var newState = {};
{'fraction_non_alphanumeric': 0.11774711774711774, 'fraction_numerical': 0.001512001512001512, 'mean_word_length': 2.394483643361129, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1784570', 'n_tokens_mistral': 1414, 'n_tokens_neox': 1359, 'n_words': 222}