mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-09-03 03:38:52 +00:00
added option to set/change the number og nzbs imported per loop
updated pic with info
This commit is contained in:
+11
-19
@@ -63,26 +63,18 @@ $_DB_HOST = getenv('DB_HOST');
|
||||
$_DB_PASSWORD = escapeshellarg(getenv('DB_PASSWORD'));
|
||||
$_DB_NAME = getenv('DB_NAME');
|
||||
|
||||
|
||||
function getFileCount($path) {
|
||||
$size = 0;
|
||||
$ignore = array('.','..','cgi-bin','.DS_STORE');
|
||||
$include = array('.nzb','.NZB');
|
||||
$files = scandir($path);
|
||||
foreach($files as $t) {
|
||||
if(in_array($t, $ignore)) continue;
|
||||
if (is_dir(rtrim($path, '/') . '/' . $t)) {
|
||||
$size += getFileCount(rtrim($path, '/') . '/' . $t);
|
||||
} else {
|
||||
foreach($include as $needle){
|
||||
if(strpos($t,$needle)!==false) {
|
||||
$size++;
|
||||
continue;
|
||||
}
|
||||
}//if(in_array($t,$include)) $size++;
|
||||
function getFileCount($directory) {
|
||||
$include = array('*.nzb','*.NZB');
|
||||
$filecount=0;
|
||||
foreach (glob($directory . "*",GLOB_ONLYDIR) as $subDir){
|
||||
$filecount += getFileCount($subDir . "/");
|
||||
}
|
||||
foreach($include as $fileEnd){
|
||||
if (glob($directory . $fileEnd) != false) {
|
||||
$filecount += count(glob($directory . $fileEnd));
|
||||
}
|
||||
}
|
||||
return $size;
|
||||
return $filecount;
|
||||
}
|
||||
|
||||
$_nzbs_to_import_begin=getFileCount('/home/jonnyboy/nzbs/test/');
|
||||
@@ -235,7 +227,7 @@ while($i>0)
|
||||
shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.0 'echo \"\033[1;31m\" && cd $NNPATH && $_php update_predb.php true && date && echo \"$_string\"' 2>&1 1> /dev/null");
|
||||
$time2 = TIME();
|
||||
} else {
|
||||
shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.0 'echo \"\033[1;31m\\n\n\nThis pane runs update_predb.php and cycles every {$array['PREDB_TIMER']} seconds.\"'");
|
||||
shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.0 'echo \"\033[1;31m\\n\n\nThis pane runs update_predb.php and cycles every {$array['PREDB_TIMER']}/60 seconds.\"'");
|
||||
}
|
||||
|
||||
//run $_php update_parsing.php in 1.1 every 1 hour
|
||||
|
||||
@@ -24,7 +24,14 @@ $ps->maxThreads = 20;
|
||||
$ps->threadTimeLimit = 0;
|
||||
$selected = $subdir_count-1;
|
||||
|
||||
echo "Starting threaded import process\n";
|
||||
$varnames = shell_exec("cat ../edit_these.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'");
|
||||
$vardata = shell_exec('cat ../edit_these.sh | grep ^export | cut -d \" -f2 | awk "{print $1;}"');
|
||||
$varnames = explode("\n", $varnames);
|
||||
$vardata = explode("\n", $vardata);
|
||||
$array = array_combine($varnames, $vardata);
|
||||
unset($array['']);
|
||||
|
||||
echo "Starting threaded import process, {$array['NZBCOUNT']} per thread\n";
|
||||
|
||||
while ($ps->RunControlCode())
|
||||
{
|
||||
|
||||
+9
-1
@@ -131,7 +131,15 @@ if (!isset($groups) || count($groups) == 0) {
|
||||
echo ("imported " . $nzbFile . $strTerminator);
|
||||
flush();
|
||||
}
|
||||
if ($nzbCount == 100) {
|
||||
|
||||
$varnames = shell_exec("cat ../edit_these.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'");
|
||||
$vardata = shell_exec('cat ../edit_these.sh | grep ^export | cut -d \" -f2 | awk "{print $1;}"');
|
||||
$varnames = explode("\n", $varnames);
|
||||
$vardata = explode("\n", $vardata);
|
||||
$array = array_combine($varnames, $vardata);
|
||||
unset($array['']);
|
||||
|
||||
if ($nzbCount == $array['NZBCOUNT']) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,7 +189,16 @@ if ($using_cli || $page->isPostBack() )
|
||||
$retval.= "imported ".$nzbFile.$strTerminator;
|
||||
}
|
||||
}
|
||||
if ($nzbCount == 10)
|
||||
|
||||
|
||||
$varnames = shell_exec("cat ../edit_these.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'");
|
||||
$vardata = shell_exec('cat ../edit_these.sh | grep ^export | cut -d \" -f2 | awk "{print $1;}"');
|
||||
$varnames = explode("\n", $varnames);
|
||||
$vardata = explode("\n", $vardata);
|
||||
$array = array_combine($varnames, $vardata);
|
||||
unset($array['']);
|
||||
|
||||
if ($nzbCount == $array['NZBCOUNT'])
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -59,6 +59,9 @@ export NZBS="/path/to/nzbs"
|
||||
#and 10 nzbs will be imported from each subfolder per loop.
|
||||
export NZBMULTI="false"
|
||||
|
||||
#How many nzbs to import per loop, if using NZBMULTI="true" the per folder
|
||||
export NZBCOUNT="10"
|
||||
|
||||
#Choose to run the threaded or non-threaded newznab scripts true/false
|
||||
#such as update_binaries.php or update_binaries_threaded.php
|
||||
export THREADS="true"
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 149 KiB After Width: | Height: | Size: 169 KiB |
Reference in New Issue
Block a user