mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 17:28:55 +00:00
49 lines
2.1 KiB
PHP
49 lines
2.1 KiB
PHP
<?php
|
|
require_once(dirname(__FILE__) . "/../../bin/config.php");
|
|
require_once(dirname(__FILE__) . "/../IRCScraper.php");
|
|
require_once 'settings.php';
|
|
|
|
if (!is_file('/var/www/newznab/misc/update_scripts/nix_scripts/tmux/lib/IRCScraper/settings.php')) {
|
|
exit('Copy settings_example.php to settings.php and change the settings.' . PHP_EOL);
|
|
}
|
|
|
|
if (!isset($argv[1])) {
|
|
exit(
|
|
'Argument 1: cz|efnet ; Scrape efnet or corrupt/zenet.' . PHP_EOL .
|
|
' ; Both zenet and corrupt pre the same, so pick one or the other in settings.php' . PHP_EOL .
|
|
' ; You can run efnet at the same time as corrupt or zenet.' . PHP_EOL .
|
|
'Argument 2: (optional) false|true ; True runs in silent mode (no text output)' . PHP_EOL .
|
|
'Argument 3: (optional) false|true ; True turns on debug (shows sent/received messages from the socket)' . PHP_EOL .
|
|
'ex:' . PHP_EOL .
|
|
'php ' . $argv[0] . ' efnet ; Scrapes efnet with text output.' . PHP_EOL .
|
|
'php ' . $argv[0] . ' cz true > /dev/null 2>&1 ; (unix) Scrapes corrupt/zenet with no text output, in the background (you can close your terminal window).' . PHP_EOL .
|
|
'php ' . $argv[0] . ' efnet true ; Scrapes efnet with no text output, keeps lock on terminal (closing terminal kills the scraping).' . PHP_EOL .
|
|
'php ' . $argv[0] . ' cz true true ; Scrapes corrupt/zenet with text output and debug output.' . PHP_EOL
|
|
);
|
|
}
|
|
|
|
if (!in_array($argv[1], array('efnet', 'cz'))) {
|
|
exit('Error, must be efnet or cz, you typed: ' . $argv[1] . PHP_EOL);
|
|
}
|
|
|
|
if (SCRAPE_IRC_EFNET_NICKNAME == '' || SCRAPE_IRC_CORRUPT_NICKNAME == '' || SCRAPE_IRC_ZENET_NICKNAME == '') {
|
|
exit("ERROR! You must put a username in settings.php" . PHP_EOL);
|
|
}
|
|
|
|
if ($argv[1] === 'cz') {
|
|
if (SCRAPE_IRC_C_Z_BOOL === true) {
|
|
$argv[1] = 'corrupt';
|
|
} else {
|
|
$argv[1] = 'zenet';
|
|
}
|
|
}
|
|
|
|
$silent = ((isset($argv[2]) && $argv[2] === 'true') ? true : false);
|
|
$debug = ((isset($argv[3]) && $argv[3] === 'true') ? true : false);
|
|
|
|
// Net_SmartIRC started here, or else globals are not properly set.
|
|
new IRCScraper(
|
|
$argv[1],
|
|
$silent,
|
|
$debug
|
|
); |