added option to set/change the number og nzbs imported per loop

updated pic with info
This commit is contained in:
jonnyboy
2013-01-25 19:17:35 +01:00
parent 82c41fb6e6
commit 36099ebeb3
6 changed files with 41 additions and 22 deletions
+11 -19
View File
@@ -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
+8 -1
View File
@@ -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
View File
@@ -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;
}
}
+10 -1
View File
@@ -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;
}
+3
View File
@@ -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