<commit_before><?php

/*

This implements a transmission-remote parsing extension which displays status of running torrents

Installation:
 - The following lines must be added to your config.inc.php:
   $settings['extensions']['transmission'] = true;
   $settings['transmission_auth'] = array(
    //'user' => 'jim', # Both of these must exist if you wish to use auth
    //'pass' => '<PASSWORD>!'
   );
   $settings['transmission_host'] = array(
    // 'server' => 'localhost',	# uncomment to set a specific host
    // 'port' => 9091		# uncomment to set a specific port
   );


   // If you want download/upload/ratio/duration stats, make sure the web server user can
   // read this folder, which is in the home directory of hteu ser that transmission is
   // running as
   $settings['transmission_folder'] = '/home/user/.config/transmission/';

*/

/**
 * This file is part of Linfo (c) 2010 <NAME>.
 *
 * Linfo is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Linfo is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Linfo. If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * Keep out hackers...
 */
namespace Linfo\Extension;

use Linfo\Linfo;
use Linfo\Common;
use Linfo\Meta\Errors;
use Linfo\Meta\Timer;
use Linfo\Parsers\CallExt;
use Exception;

/**
 * Get status on transmission torrents.
 */
class Transmission implements Extension
{
    // Store these tucked away here
    private $_CallExt,
        $_res,
        $_torrents = array(),
        $_stats = false,
        $_auth,
        $_host;

    /**
     * localize important stuff.
     * @param Linfo $linfo
     */
    public function __construct(Linfo $linfo)
    {
        $settings = $linfo->getSettings();

        // Classes we need
        $this->_CallExt = new CallExt();
        $this->_CallExt->setSearchPaths(array('/usr/bin', '/usr/local/bin'));

        // Transmission specific settings
        $this->_auth = array_key_exists('transmission_auth', $settings) ? (array) $settings['transmission_auth'] : array();
        $this->_host = array_key_exists('transmission_host', $settings) ? (array) $settings['transmission_host'] : array();

        // Path to home dir folder
        $this->_folder = array_key_exists('transmission_folder', $settings) && is_dir($settings['transmission_folder']) && is_readable($settings['transmission_folder']) ? $settings['transmission_folder'] : false;
    }

    /**
     * Deal with it.
     */
    private function _call()<commit_msg>allow specifying path to transmission-remote in transmission extension<commit_after><?php

/*

This implements a transmission-remote parsing extension which displays status of running torrents

Installation:
 - The following lines must be added to your config.inc.php:
   $settings['extensions']['transmission'] = true;
   $settings['transmission_auth'] = array(
    //'user' => 'jim', # Both of these must exist if you wish to use auth
    //'pass' => '<PASSWORD>!'
   );
   $settings['transmission_host'] = array(
    // 'server' => 'localhost',	# uncomment to set a specific host
    // 'port' => 9091		# uncomment to set a specific port
   );


   // If you want download/upload/ratio/duration stats, make sure the web server user can
   // read this folder, which is in the home directory of hteu ser that transmission is
   // running as
   $settings['transmission_folder'] = '/home/user/.config/transmission/';

   // If you have transmission-remote present somewhere else from /usr/bin or /usr/local/bin, you can specify
   // the bin path like this:
   $settings['transmission_bin_path'] = '/opt/transmission/bin';

*/

/**
 * This file is part of Linfo (c) 2010 <NAME>.
 *
 * Linfo is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Linfo is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Linfo. If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * Keep out hackers...
 */
namespace Linfo\Extension;

use Linfo\Linfo;
use Linfo\Common;
use Linfo\Meta\Errors;
use Linfo\Meta\Timer;
use Linfo\Parsers\CallExt;
use Exception;

/**
 * Get status on transmission torrents.
 */
class Transmission implements Extension
{
    // Store these tucked away here
    private $_CallExt,
        $_res,
        $_torrents = array(),
        $_stats = false,
        $_auth,
        $_host;

    /**
     * localize important stuff.
     * @param Linfo $linfo
     */
    public function __construct(Linfo $linfo)
    {
        $settings = $linfo->getSettings();

        // Classes we need
        $this->_CallExt = new CallExt();

        if (isset($settings['transmission_bin_path'])) {
            $this->_CallExt->setSearchPaths(array($settings['transmission_bin_path']));

        } else {
            $this->_CallExt->setSearchPaths(array('/usr/bin', '/usr/local/bin'));
        }

        // Transmission specific settings
        $this->_auth = array_key_exists('transmission_auth', $settings) ? (array) $settings['transmission_auth'] : array();
        $this->_host = array_key_exists('transmission_host', $settings) ? (array) $settings['transmission_host'] : array();

        // Path to home dir folder
        $this->_folder = array_key_exists('transmission_folder', $settings) && is_dir($settings['transmission_folder']) && is_readable($settings['transmission_folder']) ? $settings['transmission_folder'] : false;
    }

    /**
     * Deal with it.
     */
    private function _call()
{'fraction_non_alphanumeric': 0.12051077414205906, 'fraction_numerical': 0.002873104549082203, 'mean_word_length': 3.1829105473965287, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5269507', 'n_tokens_mistral': 1780, 'n_tokens_neox': 1729, 'n_words': 609}