<commit_before>
import _ from 'lodash';
import SubtitleStore from '../components/SubtitleText/store';
import SubtitleActions from '../components/SubtitleText/actions';
import PlayerActions from '../actions';
import BaseModalActions from '../../Modal/actions';
import engineStore from '../../../stores/engineStore';
import HistoryStore from '../../../stores/historyStore';

import player from './player';
import ls from 'local-storage';
import ModalActions from '../components/Modal/actions';

import {
    ipcRenderer, shell
}
from 'electron';

var sleeper = null;

var getAction = function(event, act) {
    eval(act);
    ipcRenderer.removeListener('context-action', getAction);
};

var actions = {
    cast(type) {
        if (type == 'Browser') {
            _.defer(() => {
                ModalActions.open({
                    type: 'CastingSettings',
                    castType: 'Browser',
                    currentItem: player.wcjs.playlist.currentItem,
                    name: 'Browser'
                });
            });
        } else {
            _.defer(() => {
                ModalActions.open({
                    type: 'CastingScanner',
                    method: { name: type }
                });
            });
        }
    },
    torrentData() {

        player.saveState = {
            idx: player.wcjs.playlist.currentItem,
            position: player.wcjs.position
        };

        player.wcjs.stop();

        HistoryStore.getState().history.replaceState(null, 'torrentDashboard');

    },
    downloadFolder() {
        var engineState = engineStore.getState();
        
        var torrent = engineState.torrents[engineState.infoHash];
        
        if (torrent.files[0].path.indexOf('\\') > -1) {
            
            var extPath = '\\' + torrent.files[0].path.substr(0, torrent.files[0].path.indexOf('\\'));
            
        } else if (torrent.files[0].path.indexOf('/') > -1) {

            var extPath = '/' + torrent.files[0].path.substr(0, torrent.files[0].path.indexOf('/'));

        } else {

            var extPath = '';

        }
        shell.openItem(torrent.path + extPath);
    },
    downloadAll() {
        var engineState = engineStore.getState();
        var torrent = engineState.torrents[engineState.infoHash];
        torrent.files.forEach( (el, ij) => {
            torrent.selectFile(ij);
        });
        PlayerActions.announcement('Downloading All Files');
    },
    downloadForce() {
        var engineState = engineStore.getState();
        engineState.torrents[engineState.infoHash].discover();
        PlayerActions.announcement('Forcing Download');
    },
    speedPulsing() {
        var toggled = !(ls('speedPulsing') == 'enabled');
         if (toggled) {
            PlayerActions.pulse();
        } else {
            PlayerActions.flood();
            if (ls('speedLimit')) {
                ls('speedLimit', 0)
                player.fields.speedLimit.value = 'auto'
            }
        }<commit_msg>Force Download After Selecting "Download All"<commit_after>
import _ from 'lodash';
import SubtitleStore from '../components/SubtitleText/store';
import SubtitleActions from '../components/SubtitleText/actions';
import PlayerActions from '../actions';
import BaseModalActions from '../../Modal/actions';
import engineStore from '../../../stores/engineStore';
import HistoryStore from '../../../stores/historyStore';

import player from './player';
import ls from 'local-storage';
import ModalActions from '../components/Modal/actions';

import {
    ipcRenderer, shell
}
from 'electron';

var sleeper = null;

var getAction = function(event, act) {
    eval(act);
    ipcRenderer.removeListener('context-action', getAction);
};

var actions = {
    cast(type) {
        if (type == 'Browser') {
            _.defer(() => {
                ModalActions.open({
                    type: 'CastingSettings',
                    castType: 'Browser',
                    currentItem: player.wcjs.playlist.currentItem,
                    name: 'Browser'
                });
            });
        } else {
            _.defer(() => {
                ModalActions.open({
                    type: 'CastingScanner',
                    method: { name: type }
                });
            });
        }
    },
    torrentData() {

        player.saveState = {
            idx: player.wcjs.playlist.currentItem,
            position: player.wcjs.position
        };

        player.wcjs.stop();

        HistoryStore.getState().history.replaceState(null, 'torrentDashboard');

    },
    downloadFolder() {
        var engineState = engineStore.getState();
        
        var torrent = engineState.torrents[engineState.infoHash];
        
        if (torrent.files[0].path.indexOf('\\') > -1) {
            
            var extPath = '\\' + torrent.files[0].path.substr(0, torrent.files[0].path.indexOf('\\'));
            
        } else if (torrent.files[0].path.indexOf('/') > -1) {

            var extPath = '/' + torrent.files[0].path.substr(0, torrent.files[0].path.indexOf('/'));

        } else {

            var extPath = '';

        }
        shell.openItem(torrent.path + extPath);
    },
    downloadAll() {
        var engineState = engineStore.getState();
        var torrent = engineState.torrents[engineState.infoHash];
        torrent.files.forEach( (el, ij) => {
            torrent.selectFile(ij);
        });
        engineState.torrents[engineState.infoHash].discover();
        PlayerActions.announcement('Downloading All Files');
    },
    downloadForce() {
        var engineState = engineStore.getState();
        engineState.torrents[engineState.infoHash].discover();
        PlayerActions.announcement('Forcing Download');
    },
    speedPulsing() {
        var toggled = !(ls('speedPulsing') == 'enabled');
         if (toggled) {
            PlayerActions.pulse();
        } else {
            PlayerActions.flood();
            if (ls('speedLimit')) {
                ls('speedLimit', 0)
                player.fields.speedLimit.value = 'auto'
            }
        }
{'fraction_non_alphanumeric': 0.1445664645140141, 'fraction_numerical': 0.0036059662350434356, 'mean_word_length': 1.8864711447492903, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7546949', 'n_tokens_mistral': 1717, 'n_tokens_neox': 1657, 'n_words': 310}