diff --git a/.gitignore b/.gitignore index 41e56e5ec..255751113 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ fix.sh +defaults.sh diff --git a/README.md b/README.md index d8dec960f..aa4e2623c 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,8 @@ * Edit the paths, timers, username, what to run and then accept. ```bash - nano edit_these.sh + cp config.sh defaults.sh + nano config.sh ``` * Edit some permissions and a file, run this as root. If, when you run ./start.sh you see 0 nzb's and you are sure there are more than 0 left to import, verify the path to the nzb's in .tmux_user.conf in the conf folder and is created at first run. diff --git a/bin/monitor.php b/bin/monitor.php index 6d367b82c..eff4afc8c 100644 --- a/bin/monitor.php +++ b/bin/monitor.php @@ -11,16 +11,16 @@ $qry="SELECT COUNT( releases.categoryID ) AS cnt, parentID FROM releases RIGHT J //needs to be processed query $proc="SELECT ( SELECT COUNT( groupID ) AS cnt from releases where consoleinfoID IS NULL and categoryID BETWEEN 1000 AND 1999 ) AS console, ( SELECT COUNT( groupID ) AS cnt from releases where imdbID IS NULL and categoryID BETWEEN 2000 AND 2999 ) AS movies, ( SELECT COUNT( groupID ) AS cnt from releases where musicinfoID IS NULL and categoryID BETWEEN 3000 AND 3999 ) AS audio, ( SELECT COUNT( groupID ) AS cnt from releases r left join category c on c.ID = r.categoryID where (categoryID BETWEEN 4000 AND 4999 and ((r.passwordstatus between -6 and -1) or (r.haspreview = -1 and c.disablepreview = 0)))) AS pc, ( SELECT COUNT( groupID ) AS cnt from releases where rageID = -1 and categoryID BETWEEN 5000 AND 5999 ) AS tv, ( SELECT COUNT( groupID ) AS cnt from releases where bookinfoID IS NULL and categoryID = 7020 ) AS book, ( SELECT COUNT( groupID ) AS cnt from releases r left join category c on c.ID = r.categoryID where (r.passwordstatus between -6 and -1) or (r.haspreview = -1 and c.disablepreview = 0)) AS work, ( SELECT COUNT( groupID ) AS cnt from releases) AS releases, ( SELECT COUNT( groupID ) AS cnt FROM releases r WHERE r.releasenfoID = 0) AS nforemains, ( SELECT COUNT( groupID ) AS cnt FROM releases WHERE releasenfoID not in (0, -1)) AS nfo, ( SELECT table_rows AS cnt FROM information_schema.TABLES where table_name = 'parts' AND TABLE_SCHEMA = '".DB_NAME."' ) AS parts, ( SELECT concat(round((data_length+index_length)/(1024*1024*1024),2),'GB') AS cnt FROM information_schema.tables where table_name = 'parts' AND TABLE_SCHEMA = '".DB_NAME."' ) AS partsize;"; -//get variables from edit_these.sh -$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;}"'); +//get variables from defaults.sh +$varnames = shell_exec("cat ../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); +$vardata = shell_exec('cat ../defaults.sh | grep ^export | cut -d \" -f2 | awk "{print $1;}"'); $varnames = explode("\n", $varnames); $vardata = explode("\n", $vardata); $array = array_combine($varnames, $vardata); unset($array['']); //environment -$backfill_increment = "UPDATE groups set backfill_target=backfill_target+1 where active=1 and backfill_target<{$array['MAXDAYS']};"; +$_backfill_increment = "UPDATE groups set backfill_target=backfill_target+1 where active=1 and backfill_target<{$array['MAXDAYS']};"; $_DB_NAME = getenv('DB_NAME'); $_DB_USER = getenv('DB_USER'); $_DB_HOST = getenv('DB_HOST'); @@ -28,6 +28,7 @@ $_DB_PASSWORD = escapeshellarg(getenv('DB_PASSWORD'));$_current_path = dirname(_ $_mysql = getenv('MYSQL'); $_php = getenv('PHP'); $_tmux = getenv('TMUXCMD'); +$_count_releases = 0; //got microtime function microtime_float() @@ -38,6 +39,11 @@ function microtime_float() $_sleep_string = "\033[1;31msleeping\033[0m "; +function get_color() +{ + return (mt_rand(1,230)); +} + $time = TIME(); $time2 = TIME(); $time3 = TIME(); @@ -48,6 +54,7 @@ $time7 = TIME(); $time8 = TIME(); $time9 = TIME(); $time10 = TIME(); +$time11 = TIME(); //init start values $work_start = 0; @@ -60,8 +67,8 @@ while($i>0) $time_loop_start = microtime_float(); //chack variables again during loop - $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 = shell_exec("cat ../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); + $vardata = shell_exec('cat ../defaults.sh | grep ^export | cut -d \" -f2 | awk "{print $1;}"'); $varnames = explode("\n", $varnames); $vardata = explode("\n", $vardata); $array = array_combine($varnames, $vardata); @@ -174,88 +181,102 @@ while($i>0) //run update_predb.php in 1.0 ever 15 minutes if ((TIME() - $time2) >= $array['PREDB_TIMER'] ) { - shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.0 'echo \"\033[1;31m\" && cd $NNPATH && $_php update_predb.php true && date' 2>&1 1> /dev/null"); + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.0 'echo \"\033[38;5;\"$color\"m\" && cd $NNPATH && $_php update_predb.php true && echo \" \033[1;0;33m\" && date' 2>&1 1> /dev/null"); $time2 = TIME(); } //run $_php update_parsing.php in 1.1 every 1 hour if (((TIME() - $time3) >= $array['PARSING_TIMER'] ) && ($array['PARSING'] == "true" )) { - shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.1 'echo \"\033[1;32m\" && cd $TESTING && $_php update_parsing.php && date' 2>&1 1> /dev/null"); + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.1 'echo \"\033[38;5;\"$color\"m\" && cd $TESTING && $_php update_parsing.php && echo \" \033[1;0;33m\" && date' 2>&1 1> /dev/null"); $time3 = TIME(); } //run $_php removespecial.php and $_php update_cleanup.php in 1.2 ever 1 hour if (((TIME() - $time7) >= $array['CLEANUP_TIMER'] ) && ($array['CLEANUP'] == "true" )) { - shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.2 'echo \"\033[1;33m\" && cd $TESTING && $_php removespecial.php && $_php update_cleanup.php && date' 2>&1 1> /dev/null"); + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.2 'echo \"\033[38;5;\"$color\"m\" && cd $TESTING && $_php removespecial.php && $_php update_cleanup.php && echo \" \033[1;0;33m\" && date' 2>&1 1> /dev/null"); $time7 = TIME(); } //run update_tvschedule.php and $_php update_theaters.php in 1.3 every 12 hours and first loop if (((TIME() - $time4) >= $array['TVRAGE_TIMER']) || ($i == 1 )) { - shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.3 'echo \"\033[1;34m\" && cd $NNPATH && $_php update_tvschedule.php && $_php update_theaters.php && date' 2>&1 1> /dev/null"); + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.3 'echo \"\033[38;5;\"$color\"m\" && cd $NNPATH && $_php update_tvschedule.php && $_php update_theaters.php && echo \" \033[1;0;33m\" && date' 2>&1 1> /dev/null"); $time4 = TIME(); } - //run optimize_innodb.php in pane 1.4 every 2 hours - if ((TIME() - $time5 >= $array['INNODB_SMALL'] ) && ( $array['INNODB']== "true" ) && ( $array['OPTIMIZE'] == "true" )) { - shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.4 'echo \"\033[1;36m\" && cd bin && $_php optimize_innodb.php && date' 2>&1 1> /dev/null"); - $time5 = TIME(); - } - - //run optimize_myisam.php in pane 1.5 every 2 hours - if ((TIME() - $time6 >= $array['MYISAM_LARGE'] ) && ( $array['OPTIMIZE'] == "true" )) { - shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.5 'echo \"\033[1;37m\" && cd bin && $_php optimize_myisam.php true && date' 2>&1 1> /dev/null"); + //run optimize in pane 1.4 + if (( TIME() - $time6 >= $array['MYISAM_LARGE'] ) && ( $array['OPTIMIZE'] == "true" )) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.4 'echo \"\033[38;5;\"$color\"m\" && cd bin && $_php optimize_myisam.php true && echo \" \033[1;0;33m\" && date' 2>&1 1> /dev/null"); $time6 = TIME(); - } - - //run optimize_innodb.php in pane 1.6 every 24 hours - if ((TIME() - $time8 >= $array['INNODB_LARGE'] ) && ($array['INNODB'] == "true") && ( $array['OPTIMIZE'] == "true" )) { - shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.6 'echo \"\033[1;37m\" && cd bin && $_php optimize_myisam.php true && $_php optimize_innodb.php true && date' 2>&1 1> /dev/null"); + } elseif (( TIME() - $time8 >= $array['INNODB_LARGE'] ) && ($array['INNODB'] == "true") && ( $array['OPTIMIZE'] == "true" )) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.4 'echo \"\033[38;5;\"$color\"m\" && cd bin && $_php optimize_myisam.php true && $_php optimize_innodb.php true && echo \" \033[1;0;33m\" && date' 2>&1 1> /dev/null"); $time8 = TIME(); + } elseif (( TIME() - $time5 >= $array['INNODB_SMALL'] ) && ( $array['INNODB']== "true" ) && ( $array['OPTIMIZE'] == "true" )) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.4 'echo \"\033[38;5;\"$color\"m\" && cd bin && $_php optimize_innodb.php && echo \" \033[1;0;33m\" && date' 2>&1 1> /dev/null"); + $time5 = TIME(); + } elseif (( TIME() - $time11 >= $array['MYISAM_SMALL'] ) && ( $array['OPTIMIZE'] == "true" )) { + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.4 'echo \"\033[38;5;\"$color\"m\" && cd bin && $_php optimize_myisam.php && echo \" \033[1;0;33m\" && date' 2>&1 1> /dev/null"); + $time11 = TIME(); } - //run optimize_innodb.php in pane 1.7 every 1 hour + //run optimize_innodb.php in pane 1.5 every 1 hour if ((TIME() - $time9 >= $array['SPHINX_TIMER'] ) && ( $array['SPHINX'] == "true")) { - shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.7 'echo \"\033[1;37m\" && cd bin && $_php sphinx.php && date' 2>&1 1> /dev/null"); + $color=get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:1.5 'echo \"\033[38;5;\"$color\"m\" && cd bin && $_php sphinx.php && echo \" \033[1;0;33m\" && date' 2>&1 1> /dev/null"); $time9 = TIME(); } - // runs nzbcount.php in pane 0.1 continuous loop - shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.1 'echo \"\033[0;32m\" && cd bin && $_php nzbcount.php' 2>&1 1> /dev/null"); + // runs nzbcount.php in pane 0.1 + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.1 'echo \"\033[38;5;\"$color\"m\" && cd bin && $_php nzbcount.php' 2>&1 1> /dev/null"); //runs postprocess_nfo.php in pane 0.2 once if needed then exits if (( $nfo_remaining_now > 0 ) && ( $array['POST_TO_RUN'] != 0 )) { - shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.2 'echo \"\033[0;32m\" && cd bin && $_php postprocess_nfo.php && date' 2>&1 1> /dev/null"); + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.2 'echo \"\033[38;5;\"$color\"m\" && cd bin && $_php postprocess_nfo.php && echo \" \033[1;0;33m\" && date' 2>&1 1> /dev/null"); } //runs processGames.php in pane 0.3 once if needed then exits if (( $console_releases_proc > 0 ) && ( $array['POST_TO_RUN'] != 0 )) { - shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.3 'echo \"\033[1;35m\" && cd bin && $_php processGames.php && date' 2>&1 1> /dev/null"); + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.3 'echo \"\033[38;5;\"$color\"m\" && cd bin && $_php processGames.php && echo \" \033[1;0;33m\" && date' 2>&1 1> /dev/null"); } //runs processMovies.php in pane 0.4 once if needed then exits if (( $movie_releases_proc > 0 ) && ( $array['POST_TO_RUN'] != 0 )) { - shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.4 'echo \"\033[1;37m\" && cd bin && $_php processMovies.php && date' 2>&1 1> /dev/null"); + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.4 'echo \"\033[38;5;\"$color\"\" && cd bin && $_php processMovies.php && echo \" \033[1;0;33m\" && date' 2>&1 1> /dev/null"); } //runs processMusic.php in pane 0.5 once if needed then exits if (( $music_releases_proc > 0 ) && ( $array['POST_TO_RUN'] != 0 )) { - shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.5 'echo \"\033[1;31m\" && cd bin && $_php processMusic.php && date' 2>&1 1> /dev/null"); + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.5 'echo \"\033[38;5;\"$color\"m\" && cd bin && $_php processMusic.php && echo \" \033[1;0;33m\" && date' 2>&1 1> /dev/null"); } //runs processTv.php in pane 0.6 once if needed then exits if (( $tvrage_releases_proc > 0 ) && ( $array['POST_TO_RUN'] != 0 )) { - shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.6 'echo \"\033[1;32m\" && cd bin && $_php processTv.php && date' 2>&1 1> /dev/null"); + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.6 'echo \"\033[38;5;\"$color\"m\" && cd bin && $_php processTv.php && echo \" \033[1;0;33m\" && date' 2>&1 1> /dev/null"); } //runs processBooks.php in pane 0.7 once if needed then exits if (( $book_releases_proc > 0 ) && ( $array['POST_TO_RUN'] != 0 )) { - shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.7 'echo \"\033[0;34m\" && cd bin && $_php processBooks.php && date' 2>&1 1> /dev/null"); + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.7 'echo \"\033[38;5;\"$color\"m\" && cd bin && $_php processBooks.php && echo \" \033[1;0;33m\" && date' 2>&1 1> /dev/null"); } //runs processOthers.php in pane 0.8 once if needed then exits if ( $array['POST_TO_RUN'] != 0 ) { - shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.8 'echo \"\033[1;33m\" && cd bin && $_php processOthers.php && date' 2>&1 1> /dev/null"); + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.8 'echo \"\033[38;5;\"$color\"m\" && cd bin && $_php processOthers.php && echo \" \033[1;0;33m\" && date' 2>&1 1> /dev/null"); } //set command for running update_binaries @@ -281,28 +302,28 @@ while($i>0) //runs update_binaries in 0.9 once if needed and exits if (( $array['BINARIES'] == "true" ) && (( $total_work_now < $array['MAX_RELEASES'] ) || ( $array['MAX_RELEASES'] == 0 ))) { - shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.9 'echo \"\033[1;34m\" && cd $NNPATH && $_php $_update_cmd && date && echo \"$_sleep_string {$array['BINARIES_SLEEP']} seconds...\" && sleep {$array['BINARIES_SLEEP']}' 2>&1 1> /dev/null"); + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.9 'echo \"\033[38;5;\"$color\"m\" && cd $NNPATH && $_php $_update_cmd && echo \" \033[1;0;33m\" && date && echo \"$_sleep_string {$array['BINARIES_SLEEP']} seconds...\" && sleep {$array['BINARIES_SLEEP']}' 2>&1 1> /dev/null"); } //runs backfill in 0.10 once if needed and exits if (( $array['BACKFILL'] == "true" ) && (( $total_work_now < $array['BACKFILL_MAX_RELEASES'] ) || ( $array['BACKFILL_MAX_RELEASES'] == 0 ))) { - shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.10 'echo \"\033[1;35m\" && cd $NNPATH && $_php $_backfill_cmd && \ - $_mysql --defaults-extra-file=$_current_path/../conf/my.cnf -u$_DB_USER -h $_DB_HOST $_DB_NAME -e \"${backfill_increment}\" && \ - date && echo \"$_sleep_string {$array['BACKFILL_SLEEP']} seconds...\" && sleep {$array['BACKFILL_SLEEP']}' 2>&1 1> /dev/null"); + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.10 'echo \"\033[38;5;\"$color\"m\" && cd $NNPATH && $_php $_backfill_cmd && \ + $_mysql --defaults-extra-file=$_current_path/../conf/my.cnf -u$_DB_USER -h $_DB_HOST $_DB_NAME -e \"$_backfill_increment\" && \ + echo \" \033[1;0;33m\" && date && echo \"$_sleep_string {$array['BACKFILL_SLEEP']} seconds...\" && sleep {$array['BACKFILL_SLEEP']}' 2>&1 1> /dev/null"); } //runs nzb-import in 0.11 once if needed and exits if (( $array['IMPORT'] == "true" ) && (( $total_work_now < $array['IMPORT_MAX_RELEASES'] ) || ( $array['IMPORT_MAX_RELEASES'] == 0 ))) { - shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.11 'echo \"\033[1;36m\" && cd bin && $nzb_cmd && echo \" \" && date && echo \"$_sleep_string {$array['IMPORT_SLEEP']} seconds...\" && sleep {$array['IMPORT_SLEEP']}' 2>&1 1> /dev/null"); + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.11 'echo \"\033[38;5;\"$color\"m\" && cd bin && $nzb_cmd && echo \" \" && echo \" \033[1;0;33m\" && date && echo \"$_sleep_string {$array['IMPORT_SLEEP']} seconds...\" && sleep {$array['IMPORT_SLEEP']}' 2>&1 1> /dev/null"); } //runs update_release and optimize_myisam.php in 0.12 once if needed and exits if ( $array['RELEASES'] == "true" ) { - if ((( $array['OPTIMIZE'] == "true" ) && ( ($i % 5) == 0 ))) { - shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.12 'echo \"\033[1;37m\" && cd $_current_path && $_php update_releases.php && cd $_current_path && $_php optimize_myisam.php && date && echo \"$_sleep_string {$array['RELEASES_SLEEP']} seconds...\" && sleep {$array['RELEASES_SLEEP']}' 2>&1 1> /dev/null"); - } else { - shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.12 'echo \"\033[1;37m\" && cd $_current_path && $_php update_releases.php && cd $_current_path && date && echo \"$_sleep_string {$array['RELEASES_SLEEP']} seconds...\" && sleep {$array['RELEASES_SLEEP']}' 2>&1 1> /dev/null"); - } + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:0.12 'echo \"\033[38;5;\"$color\"m\" && cd $_current_path && $_php update_releases.php && cd $_current_path && echo \" \033[1;0;33m\" && date && echo \"$_sleep_string {$array['RELEASES_SLEEP']} seconds...\" && sleep {$array['RELEASES_SLEEP']}' 2>&1 1> /dev/null"); } //start posproceesing in window 2 @@ -312,7 +333,8 @@ while($i>0) $h=$g-1; $f=$g*100; if (( $array['POST_TO_RUN'] >= $g ) && ( $work_remaining_now > $f )) { - shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:2.$h 'echo \"\033[0;33m\" && cd bin && $_php processAlternate$g.php && date' 2>&1 1> /dev/null"); + $color = get_color(); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:2.$h 'echo \"\033[38;5;\"$color\"m\" && cd bin && $_php processAlternate$g.php && echo \" \033[1;0;33m\" && date' 2>&1 1> /dev/null"); } } } else { @@ -321,7 +343,8 @@ while($i>0) $h=$g-1; $f=$g*100; if (( $array['POST_TO_RUN'] >= $g ) && ( $work_remaining_now > $f )) { - shell_exec("$_tmux respawnp -k -t {$array['TMUX_SESSION']}:2.$h 'echo \"\033[0;33m\" && cd bin && $_php processAlternate$g.php && date' 2>&1 1> /dev/null"); + $color = get_color(); + shell_exec("$_tmux respawnp -k -t {$array['TMUX_SESSION']}:2.$h 'echo \"\033[38;5;\"$color\"m\" && cd bin && $_php processAlternate$g.php && echo \" \033[1;0;33m\" && date' 2>&1 1> /dev/null"); } } $time10 = TIME(); diff --git a/bin/nzb-import-sub.php b/bin/nzb-import-sub.php index b13ff4a5a..0b5676f82 100644 --- a/bin/nzb-import-sub.php +++ b/bin/nzb-import-sub.php @@ -24,8 +24,8 @@ $ps->maxThreads = 20; $ps->threadTimeLimit = 0; $selected = $subdir_count - 1; -$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 = shell_exec("cat ../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); +$vardata = shell_exec('cat ../defaults.sh | grep ^export | cut -d \" -f2 | awk "{print $1;}"'); $varnames = explode("\n", $varnames); $vardata = explode("\n", $vardata); $array = array_combine($varnames, $vardata); diff --git a/bin/nzb-import.php b/bin/nzb-import.php index 215710bb1..7760ca790 100644 --- a/bin/nzb-import.php +++ b/bin/nzb-import.php @@ -132,8 +132,8 @@ if (!isset($groups) || count($groups) == 0) { flush(); } - $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 = shell_exec("cat ../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); + $vardata = shell_exec('cat ../defaults.sh | grep ^export | cut -d \" -f2 | awk "{print $1;}"'); $varnames = explode("\n", $varnames); $vardata = explode("\n", $vardata); $array = array_combine($varnames, $vardata); diff --git a/bin/nzb-importonenzb.php b/bin/nzb-importonenzb.php index b64502b0c..8d1359dec 100644 --- a/bin/nzb-importonenzb.php +++ b/bin/nzb-importonenzb.php @@ -191,8 +191,8 @@ if ($using_cli || $page->isPostBack() ) } - $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 = shell_exec("cat ../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); + $vardata = shell_exec('cat ../defaults.sh | grep ^export | cut -d \" -f2 | awk "{print $1;}"'); $varnames = explode("\n", $varnames); $vardata = explode("\n", $vardata); $array = array_combine($varnames, $vardata); diff --git a/bin/nzbcount.php b/bin/nzbcount.php index 5269c190f..7d0295783 100644 --- a/bin/nzbcount.php +++ b/bin/nzbcount.php @@ -3,60 +3,66 @@ $subdir_count_now = 0; $filecount=0; +//get variables from defaults.sh +$varnames = shell_exec("cat ../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'"); +$vardata = shell_exec('cat ../defaults.sh | grep ^export | cut -d \" -f2 | awk "{print $1;}"'); +$varnames = explode("\n", $varnames); +$vardata = explode("\n", $vardata); +$array = array_combine($varnames, $vardata); +unset($array['']); + $i=0; while ($i==0) { - $subdir_count = 0; - - $path = getenv('NZBS'); - $subdirs = array_filter(glob($path.'/*', GLOB_ONLYDIR|GLOB_NOSORT)); - foreach($subdirs AS $subdir){ - $subdir_count++; - } - if ( $subdir_count_now == 0 ) { - $subdir_count_now=$subdir_count; - } - if ($subdir_count_now != $subdir_count ) { - system('clear'); - printf("\n\n\033[1;41;33mYou change folder contents."); - break; - } - - if($subdir_count != 0){ - foreach($subdirs AS $subdir){ - $filecount0[] = count(glob($subdir.'/*.nzb')); - } - $subdir_count_loop = 0; - $totalproc=0; - $toprocess=0; system('clear'); printf("\n\033[1;33m"); $mask = "%20s %10.10s %10s \n"; printf($mask, "Folder Name", "In Folder", "Imported"); printf($mask, "===============", "==========", "==========\033[0m"); + + $subdir_count = 0; + $path = $array['NZBS']; + $subdirs = array_filter(glob($path.'/*', GLOB_ONLYDIR|GLOB_NOSORT)); foreach($subdirs AS $subdir){ - $folder=basename("$subdir"); - $filecount = count(glob($subdir.'/*.nzb')); - $processed=$filecount0[$subdir_count_loop]-$filecount; - printf("\033[0m"); - if ( $filecount > 0) - printf($mask, "{$folder}","$filecount","$processed"); - $totalproc=$totalproc+$processed; - $toprocess=$toprocess+$filecount; - $subdir_count_loop++; + $subdir_count++; } - echo ("\033[1;33m"); - printf($mask, "Total","$toprocess","$totalproc"); - } else { - $filecount0 = count(glob($path.'/*.nzb')); - if ( $filecount == 0 ) { $filecount = $filecount0; } - $processed=$filecount-$filecount0; - $folder=basename("$path"); - system('clear'); - printf("\n\033[1;33m"); - $mask = "%20s %10.10s %10s \n"; - printf($mask, "Folder Name", "In Folder", "Imported"); - printf($mask, "===============", "==========", "==========\033[0m"); - printf($mask, "$folder","$filecount0","$processed"); - } - sleep(90); + + if ( $subdir_count_now == 0 ) { + $subdir_count_now=$subdir_count; + } + + if ($subdir_count_now != $subdir_count ) { + system('clear'); + printf("\n\n\033[1;41;33mYou change folder contents."); + break; + } + + if($subdir_count != 0){ + foreach($subdirs AS $subdir){ + $filecount0[] = count(glob($subdir.'/*.nzb')); + } + $subdir_count_loop = 0; + $totalproc=0; + $toprocess=0; + foreach($subdirs AS $subdir){ + $folder=basename("$subdir"); + $filecount = count(glob($subdir.'/*.nzb')); + $processed=$filecount0[$subdir_count_loop]-$filecount; + printf("\033[0m"); + if ( $filecount > 0) + printf($mask, "{$folder}","$filecount","$processed"); + $totalproc=$totalproc+$processed; + $toprocess=$toprocess+$filecount; + $subdir_count_loop++; + } + echo ("\033[1;33m"); + printf($mask, "Total","$toprocess","$totalproc"); + } else { + $filecount0 = count(glob($path.'/*.nzb')); + if ( $filecount == 0 ) { $filecount = $filecount0; } + $processed=$filecount-$filecount0; + $folder=basename("$path"); + printf($mask, "$folder","$filecount0","$processed"); + } + sleep(90); } + diff --git a/conf/tmux.conf b/conf/tmux.conf index 686ec235d..7e82deda4 100644 --- a/conf/tmux.conf +++ b/conf/tmux.conf @@ -8,6 +8,9 @@ bind-key C-a last-window # Allows for faster key repetition set -s escape-time 0 +#set 256 color display +set -g default-terminal "screen-256color" + # Set status bar set -g status-bg black set -g status-fg white diff --git a/edit_these.sh b/config.sh similarity index 94% rename from edit_these.sh rename to config.sh index 169db15f2..0978d608b 100644 --- a/edit_these.sh +++ b/config.sh @@ -1,6 +1,9 @@ #!/usr/bin/env bash DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +#Copy this file to defaults.sh +#DO NOT EDIT THIS FILE + #########################EDIT THESE######################### ############################################################ @@ -39,11 +42,11 @@ export MONITOR_UPDATE="30" ############################################################ #Choose to run update_binaries true/false -export BINARIES="true" +export BINARIES="false" #Choose to run the threaded or non-threaded newznab binaries scripts true/false #update_binaries.php or update_binaries_threaded.php -export BINARIES_THREADS="true" +export BINARIES_THREADS="false" #Set, in seconds - how long the update_binaries should sleep between runs, 0 may cause errors #top right pane @@ -56,11 +59,11 @@ export MAX_RELEASES="0" ############################################################ #Choose to run backfill script true/false -export BACKFILL="true" +export BACKFILL="false" #Choose to run the threaded or non-threaded newznab backfill scripts true/false #backfill.php or backfill_threaded.php -export BACKFILL_THREADS="true" +export BACKFILL_THREADS="false" #Set, in seconds - how long the backfill should sleep between runs, 0 may cause errors #in pane below update_binaries @@ -83,14 +86,14 @@ export MAXDAYS="210" export NZBS="/path/to/nzbs" #Choose to run import nzb script true/false -export IMPORT="true" +export IMPORT="false" #If, you have all of your nzbs in one folder select false #If, you have all of you nzbs split into separate in with the root at $NZBS then select true #and 10 nzbs will be imported from each subfolder per loop. #Importing this way, allows all postprocessing scripts to run, such as book, music, movies #Instead of doing all 1 tye at once, spread the load -export NZB_THREADS="true" +export NZB_THREADS="false" #How many nzbs to import per loop, if using NZB_THREADS=true the per folder export NZBCOUNT="10" @@ -106,7 +109,7 @@ export IMPORT_MAX_RELEASES="0" ############################################################ #Create releases, this is really only necessary to turn off when you only want to postprocess -export RELEASES="true" +export RELEASES="false" #Set, in seconds - how long the update_release should sleep between runs, 0 may cause errors #bottom right @@ -119,20 +122,23 @@ export RELEASES_SLEEP="40" #optimize_myisam on small tables runs after every 5th loop of update_releases export OPTIMIZE="false" -#How often to run optimize_myisam on large tables seconds +#How often to run optimize_myisam on small tables seconds, default is 10 min +export MYISAM_SMALL="600" + +#How often to run optimize_myisam on large tables seconds, default is 1 hr export MYISAM_LARGE="3600" -#How often to run optimize_innodb on small tables in seconds +#How often to run optimize_innodb on small tables in seconds, default is 2 hr export INNODB_SMALL="7200" -#How often to run optimize_innodb on large tables in seconds, default is 48 hours +#How often to run optimize_innodb on large tables in seconds, default is 48 hrs export INNODB_LARGE="172800" ############################################################ #Choose your database engine, comment the one true/false #you should have already converted your database to InnoDB engine, if you select true here -export INNODB="true" +export INNODB="false" ############################################################ @@ -196,7 +202,7 @@ export USE_IFTOP="false" #This is done on the terminal computer, not the newznab++ server #download fonts from https://github.com/jonnyboy/powerline-fonts #I recommend Consolas if you are using putty in Win7 -export POWERLINE="true" +export POWERLINE="false" ############################################################ diff --git a/images/newznab-tmux.png b/images/newznab-tmux.png index 3ef07adf7..da39c2369 100644 Binary files a/images/newznab-tmux.png and b/images/newznab-tmux.png differ diff --git a/powerline/powerline/segments/vcs_branch_NN.sh b/powerline/powerline/segments/vcs_branch_NN.sh new file mode 100644 index 000000000..d767b2f3f --- /dev/null +++ b/powerline/powerline/segments/vcs_branch_NN.sh @@ -0,0 +1,90 @@ +# Prints current branch in a VCS directory if it could be detected. + +# Source lib to get the function get_tmux_pwd +source "${TMUX_POWERLINE_DIR_LIB}/tmux_adapter.sh" + +branch_symbol="тна" +git_colour="5" +svn_colour="220" +hg_colour="45" + + +run_segment() { + tmux_path=$(get_tmux_cwd) + cd "/var/www/newznab" + branch="" + if [ -n "${git_branch=$(__parse_git_branch)}" ]; then + branch="$git_branch" + elif [ -n "${svn_branch=$(__parse_svn_branch)}" ]; then + branch="$svn_branch" + elif [ -n "${hg_branch=$(__parse_hg_branch)}" ]; then + branch="$hg_branch" + fi + + if [ -n "$branch" ]; then + echo "${branch}" + fi + return 0 +} + + +# Show git banch. +__parse_git_branch() { + type git >/dev/null 2>&1 + if [ "$?" -ne 0 ]; then + return + fi + + #git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \[\1\]/' + + # Quit if this is not a Git repo. + branch=$(git symbolic-ref HEAD 2> /dev/null) + if [[ -z $branch ]] ; then + # attempt to get short-sha-name + branch=":$(git rev-parse --short HEAD 2> /dev/null)" + fi + if [ "$?" -ne 0 ]; then + # this must not be a git repo + return + fi + + # Clean off unnecessary information. + branch=${branch##*/} + + echo -n "#[fg=colour${git_colour}]${branch_symbol} #[fg=colour${TMUX_POWERLINE_CUR_SEGMENT_FG}]${branch}" +} + +# Show SVN branch. +__parse_svn_branch() { + type svn >/dev/null 2>&1 + if [ "$?" -ne 0 ]; then + return + fi + + local svn_info=$(svn info 2>/dev/null) + if [ -z "${svn_info}" ]; then + return + fi + + + local svn_root=$(echo "${svn_info}" | sed -ne 's#^Repository Root: ##p') + local svn_url=$(echo "${svn_info}" | sed -ne 's#^URL: ##p') + + local branch=$(echo "${svn_url}" | egrep -o '[^/]+$') + echo "#[fg=colour${svn_colour}]${branch_symbol} #[fg=colour${TMUX_POWERLINE_CUR_SEGMENT_FG}]${branch}" +} + +__parse_hg_branch() { + type hg >/dev/null 2>&1 + if [ "$?" -ne 0 ]; then + return + fi + + summary=$(hg summary) + if [ "$?" -ne 0 ]; then + return + fi + + local branch=$(echo "$summary" | grep 'branch:' | cut -d ' ' -f2) + echo "#[fg=colour${hg_colour}]${branch_symbol} #[fg=colour${TMUX_POWERLINE_CUR_SEGMENT_FG}]${branch}" +} diff --git a/powerline/powerline/segments/vcs_revision.sh b/powerline/powerline/segments/vcs_revision.sh index 0ff0f7445..5da6a59bb 100644 --- a/powerline/powerline/segments/vcs_revision.sh +++ b/powerline/powerline/segments/vcs_revision.sh @@ -6,7 +6,7 @@ source "${TMUX_POWERLINE_DIR_LIB}/tmux_adapter.sh" run_segment() { tmux_path=$(get_tmux_cwd) - cd "$tmux_path" + cd "/var/www/newznab/" stats="" if [[ -n "${svn_stats=$(__parse_svn_stats)}" ]]; then diff --git a/powerline/powerline/themes/default.start.sh b/powerline/powerline/themes/default.start.sh index 2091dd1fb..332c721e0 100644 --- a/powerline/powerline/themes/default.start.sh +++ b/powerline/powerline/themes/default.start.sh @@ -23,17 +23,22 @@ TMUX_POWERLINE_DEFAULT_RIGHTSIDE_SEPARATOR=${TMUX_POWERLINE_DEFAULT_RIGHTSIDE_SE if [ -z $TMUX_POWERLINE_LEFT_STATUS_SEGMENTS ]; then TMUX_POWERLINE_LEFT_STATUS_SEGMENTS=( - "tmux_session_info 148 234" \ - "hostname 33 148" \ - #"ifstat 30 25" \ + "tmux_session_info 14 234" \ + "hostname 13 128" \ + "ifstat 12 255" \ #"ifstat_sys 30 255" \ #"lan_ip 24 255 ${TMUX_POWERLINE_SEPARATOR_RIGHT_THIN}" \ #"wan_ip 24 255" \ + "vcs_branch_NN 6 235" \ + "vcs_revision 229 0" \ + "vcs_compare_NN 60 255" \ "vcs_branch 28 235" \ "vcs_compare 60 255" \ + #"vcs_compare_NN 60 255" \ #"vcs_staged 64 255" \ #"vcs_modified 9 255" \ - "vcs_others 245 0" \ + #"vcs_revision 245 0" \ + #"vcs_others 245 0" \ ) fi diff --git a/powerline/tmux.conf b/powerline/tmux.conf index 2fd972780..233714ce5 100644 --- a/powerline/tmux.conf +++ b/powerline/tmux.conf @@ -6,6 +6,7 @@ bind-key C-a last-window set -s escape-time 0 set -g set-remain-on-exit on +set -g default-terminal "screen-256color" ## Powerline Statusbar ## set-option -g status on diff --git a/scripts/prepare.sh b/scripts/prepare.sh index 6bdd15250..7d54f1960 100755 --- a/scripts/prepare.sh +++ b/scripts/prepare.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -#this file can be used to save a put a time editing and reediting your edit_these.sh +#this file can be used to save a put a time editing and reediting your defaults.sh #this file must be renamed to fix.sh, or else it will be overwritten with the next git pull #then edit, add, remove anything see necessary @@ -10,17 +10,17 @@ #now you have edited the file to update, updated and put you changes back. -if grep -q '/path/to/nzbs' "../edit_these.sh" ; then - sed -i -e 's/export NZBS=.*$/\export NZBS="\/home\/jonnyboy\/nzbs\/batch"/' ../edit_these.sh - sed -i -e 's/export OPTIMISE=.*$/export OPTIMISE="true"/' ../edit_these.sh - sed -i -e 's/export AGREED=.*$/export AGREED="yes"/' ../edit_these.sh - sed -i -e 's/export INNODB=.*$/export INNODB="false"/' ../edit_these.sh - sed -i -e 's/SLEEP=.*$/SLEEP="1"/' ../edit_these.sh - sed -i -e 's/export SHOW_WHY=.*$/export SHOW_WHY="false"/' ../edit_these.sh - sed -i -e 's/export PARSING=.*$/export PARSING="true"/' ../edit_these.sh +if grep -q '/path/to/nzbs' "../defaults.sh" ; then + sed -i -e 's/export NZBS=.*$/\export NZBS="\/home\/jonnyboy\/nzbs\/batch"/' ../defaults.sh + sed -i -e 's/export OPTIMISE=.*$/export OPTIMISE="true"/' ../defaults.sh + sed -i -e 's/export AGREED=.*$/export AGREED="yes"/' ../defaults.sh + sed -i -e 's/export INNODB=.*$/export INNODB="false"/' ../defaults.sh + sed -i -e 's/SLEEP=.*$/SLEEP="1"/' ../defaults.sh + sed -i -e 's/export SHOW_WHY=.*$/export SHOW_WHY="false"/' ../defaults.sh + sed -i -e 's/export PARSING=.*$/export PARSING="true"/' ../defaults.sh sed -i -e 's/export PASSWORD=.*$/export PASSWORD="password"/' update_svn.sh - sed -i -e 's/RELEASES_SLEEP=.*$/RELEASES_SLEEP="20"/' ../edit_these.sh + sed -i -e 's/RELEASES_SLEEP=.*$/RELEASES_SLEEP="20"/' ../defaults.sh else - rm ../edit_these.sh + rm ../defaults.sh sed -i -e 's/export PASSWORD=.*$/export PASSWORD="password"/' update_svn.sh fi diff --git a/scripts/revert.sh b/scripts/revert.sh index fea6d027f..a9f2e4285 100755 --- a/scripts/revert.sh +++ b/scripts/revert.sh @@ -9,7 +9,7 @@ do done DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" -source ../edit_these.sh +source ../defaults.sh diff --git a/scripts/set_perms.sh b/scripts/set_perms.sh index 5af830585..f89257f34 100755 --- a/scripts/set_perms.sh +++ b/scripts/set_perms.sh @@ -9,52 +9,14 @@ do done DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" -source ../edit_these.sh +source ../defaults.sh clear if [[ $AGREED == "no" ]]; then - echo "Please edit the edit_these.sh file" + echo "Please edit the defaults.sh file" exit fi -echo -e "\033[38;5;148mEditing $NEWZPATH/www/lib/postprocess.php" -if [ ! -f $NEWZPATH/www/lib/postprocess.php.orig ]; then - cp $NEWZPATH/www/lib/postprocess.php $NEWZPATH/www/lib/postprocess.php.orig -fi -if ! grep -q '//$this->processAdditional();' "$NEWZPATH/www/lib/postprocess.php" ; then - $SED -i -e 's/$this->processAdditional();/\/\/$this->processAdditional();/' $NEWZPATH/www/lib/postprocess.php -fi -if ! grep -q '//$this->processNfos();' "$NEWZPATH/www/lib/postprocess.php" ; then - $SED -i -e 's/$this->processNfos();/\/\/$this->processNfos();/' $NEWZPATH/www/lib/postprocess.php -fi -if ! grep -q '//$this->processUnwanted();' "$NEWZPATH/www/lib/postprocess.php" ; then - $SED -i -e 's/$this->processUnwanted();/\/\/$this->processUnwanted();/' $NEWZPATH/www/lib/postprocess.php -fi -if ! grep -q '//$this->processMovies();' "$NEWZPATH/www/lib/postprocess.php" ; then - $SED -i -e 's/$this->processMovies();/\/\/$this->processMovies();/' $NEWZPATH/www/lib/postprocess.php -fi -if ! grep -q '//$this->processMusic();' "$NEWZPATH/www/lib/postprocess.php" ; then - $SED -i -e 's/$this->processMusic();/\/\/$this->processMusic();/' $NEWZPATH/www/lib/postprocess.php -fi -if ! grep -q '//$this->processBooks();' "$NEWZPATH/www/lib/postprocess.php" ; then - $SED -i -e 's/$this->processBooks();/\/\/$this->processBooks();/' $NEWZPATH/www/lib/postprocess.php -fi -if ! grep -q '//$this->processGames();' "$NEWZPATH/www/lib/postprocess.php" ; then - $SED -i -e 's/$this->processGames();/\/\/$this->processGames();/' $NEWZPATH/www/lib/postprocess.php -fi -if ! grep -q '//$this->processTv();' "$NEWZPATH/www/lib/postprocess.php" ; then - $SED -i -e 's/$this->processTv();/\/\/$this->processTv();/' $NEWZPATH/www/lib/postprocess.php -fi -if ! grep -q '//$this->processMusicFromMediaInfo();' "$NEWZPATH/www/lib/postprocess.php" ; then - $SED -i -e 's/$this->processMusicFromMediaInfo();/\/\/$this->processMusicFromMediaInfo();/' $NEWZPATH/www/lib/postprocess.php -fi -if ! grep -q '//$this->processOtherMiscCategory();' "$NEWZPATH/www/lib/postprocess.php" ; then - $SED -i -e 's/$this->processOtherMiscCategory();/\/\/$this->processOtherMiscCategory();/' $NEWZPATH/www/lib/postprocess.php -fi -if ! grep -q '//$this->processUnknownCategory();' "$NEWZPATH/www/lib/postprocess.php" ; then - $SED -i -e 's/$this->processUnknownCategory();/\/\/$this->processUnknownCategory();/' $NEWZPATH/www/lib/postprocess.php -fi - echo "Fixing permisions, this can take some time if you have a large set of releases" chmod 777 $NEWZPATH/www/lib/smarty/templates_c chmod -R 777 $NEWZPATH/www/covers diff --git a/start.sh b/start.sh index 7b0db70d8..689080da2 100755 --- a/start.sh +++ b/start.sh @@ -9,15 +9,58 @@ do done DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" -source edit_these.sh +if [ ! -f defaults.sh ]; then + clear + echo "Please copy config.sh to defaults.sh" + exit +fi + +source defaults.sh eval $( $SED -n "/^define/ { s/.*('\([^']*\)', '*\([^']*\)'*);/export \1=\"\2\"/; p }" "$NEWZPATH"/www/config.php ) if [[ $AGREED == "no" ]]; then - echo "Please edit the edit_these.sh file" + echo "Please edit the defaults.sh file" exit fi +if [ ! -f $NEWZPATH/www/lib/postprocess.php.orig ]; then + cp $NEWZPATH/www/lib/postprocess.php $NEWZPATH/www/lib/postprocess.php.orig +fi +if ! grep -q '//$this->processAdditional();' "$NEWZPATH/www/lib/postprocess.php" ; then + $SED -i -e 's/$this->processAdditional();/\/\/$this->processAdditional();/' $NEWZPATH/www/lib/postprocess.php +fi +if ! grep -q '//$this->processNfos();' "$NEWZPATH/www/lib/postprocess.php" ; then + $SED -i -e 's/$this->processNfos();/\/\/$this->processNfos();/' $NEWZPATH/www/lib/postprocess.php +fi +if ! grep -q '//$this->processUnwanted();' "$NEWZPATH/www/lib/postprocess.php" ; then + $SED -i -e 's/$this->processUnwanted();/\/\/$this->processUnwanted();/' $NEWZPATH/www/lib/postprocess.php +fi +if ! grep -q '//$this->processMovies();' "$NEWZPATH/www/lib/postprocess.php" ; then + $SED -i -e 's/$this->processMovies();/\/\/$this->processMovies();/' $NEWZPATH/www/lib/postprocess.php +fi +if ! grep -q '//$this->processMusic();' "$NEWZPATH/www/lib/postprocess.php" ; then + $SED -i -e 's/$this->processMusic();/\/\/$this->processMusic();/' $NEWZPATH/www/lib/postprocess.php +fi +if ! grep -q '//$this->processBooks();' "$NEWZPATH/www/lib/postprocess.php" ; then + $SED -i -e 's/$this->processBooks();/\/\/$this->processBooks();/' $NEWZPATH/www/lib/postprocess.php +fi +if ! grep -q '//$this->processGames();' "$NEWZPATH/www/lib/postprocess.php" ; then + $SED -i -e 's/$this->processGames();/\/\/$this->processGames();/' $NEWZPATH/www/lib/postprocess.php +fi +if ! grep -q '//$this->processTv();' "$NEWZPATH/www/lib/postprocess.php" ; then + $SED -i -e 's/$this->processTv();/\/\/$this->processTv();/' $NEWZPATH/www/lib/postprocess.php +fi +if ! grep -q '//$this->processMusicFromMediaInfo();' "$NEWZPATH/www/lib/postprocess.php" ; then + $SED -i -e 's/$this->processMusicFromMediaInfo();/\/\/$this->processMusicFromMediaInfo();/' $NEWZPATH/www/lib/postprocess.php +fi +if ! grep -q '//$this->processOtherMiscCategory();' "$NEWZPATH/www/lib/postprocess.php" ; then + $SED -i -e 's/$this->processOtherMiscCategory();/\/\/$this->processOtherMiscCategory();/' $NEWZPATH/www/lib/postprocess.php +fi +if ! grep -q '//$this->processUnknownCategory();' "$NEWZPATH/www/lib/postprocess.php" ; then + $SED -i -e 's/$this->processUnknownCategory();/\/\/$this->processUnknownCategory();/' $NEWZPATH/www/lib/postprocess.php +fi + #create mysql my.conf #this keeps your password from being displayed in ps, htop and others echo -e '[client]\npassword='$DB_PASSWORD > ./conf/my.cnf @@ -30,6 +73,7 @@ fi #Get the path to tmpunrar TMPUNRAR_QUERY="SELECT value from site where ID = 66;" TMPUNRAR_PATH=`$MYSQL --defaults-extra-file=conf/my.cnf -u$DB_USER -h$DB_HOST $DB_NAME -s -N -e "${TMPUNRAR_QUERY}"` +TMPUNRAR_PATH=$TMPUNRAR_PATH"1" if [[ $RAMDISK == "true" ]]; then umount $TMPUNRAR_PATH &> /dev/null @@ -78,31 +122,32 @@ $TMUXCMD selectp -t 0 $TMUXCMD splitw -h -p 72 'echo "..."' $TMUXCMD splitw -h -p 50 'echo "..."' $TMUXCMD selectp -t 0 -$TMUXCMD splitw -v -p 60 'echo "..."' +$TMUXCMD splitw -v -p 50 'echo "..."' +$TMUXCMD splitw -v -p 40 'echo "..."' + +$TMUXCMD selectp -t 3 $TMUXCMD splitw -v -p 50 'echo "..."' $TMUXCMD selectp -t 3 -$TMUXCMD splitw -v -p 83 'echo "..."' -$TMUXCMD splitw -v -p 80 'echo "..."' -$TMUXCMD splitw -v -p 75 'echo "..."' $TMUXCMD splitw -v -p 67 'echo "..."' $TMUXCMD splitw -v -p 50 'echo "..."' +$TMUXCMD selectp -t 6 +$TMUXCMD splitw -v -p 67 'echo "..."' +$TMUXCMD splitw -v -p 50 'echo "..."' + $TMUXCMD selectp -t 9 $TMUXCMD splitw -v -p 75 'echo "..."' $TMUXCMD splitw -v -p 67 'echo "..."' $TMUXCMD splitw -v -p 50 'echo "..."' + $TMUXCMD new-window -n cleanup 'echo "..."' $TMUXCMD selectp -t 0 -$TMUXCMD splitw -h -p 75 'echo "..."' +$TMUXCMD splitw -v -p 50 'echo "..."' +$TMUXCMD selectp -t 0 +$TMUXCMD splitw -h -p 67 'echo "..."' +$TMUXCMD splitw -h -p 50 'echo "..."' +$TMUXCMD selectp -t 3 $TMUXCMD splitw -h -p 67 'echo "..."' $TMUXCMD splitw -h -p 50 'echo "..."' -$TMUXCMD selectp -t 0 -$TMUXCMD splitw -v -p 50 'echo "..."' -$TMUXCMD selectp -t 2 -$TMUXCMD splitw -v -p 50 'echo "..."' -$TMUXCMD selectp -t 4 -$TMUXCMD splitw -v -p 50 'echo "..."' -$TMUXCMD selectp -t 6 -$TMUXCMD splitw -v -p 50 'echo "..."' $TMUXCMD new-window -n postprocessing 'echo "..."'