From 35b01b40e74aafb045ced2b71c7f1269f246749c Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Sat, 19 May 2012 22:21:43 +0200 Subject: [PATCH 1/1] in case suddenly more CPUs are available, talk about appropriate configuration (upgrading to new hardware..) --- bin/booh | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/bin/booh b/bin/booh index 6a44ab7..b33a01b 100644 --- a/bin/booh +++ b/bin/booh @@ -97,6 +97,14 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.") % end end +def count_cpus + cpus = 0 + for line in IO.readlines('/proc/cpuinfo') do + line =~ /^processor/ and cpus += 1 + end + return cpus +end + def read_config $config = {} $config_file = File.expand_path('~/.booh-gui-rc') @@ -138,11 +146,7 @@ def read_config system("mkdir ~/.booh") end if $config['mproc'].nil? - cpus = 0 - for line in IO.readlines('/proc/cpuinfo') do - line =~ /^processor/ and cpus += 1 - end - if cpus > 1 + if count_cpus > 1 $config['mproc'] = cpus end end @@ -193,6 +197,18 @@ It is generally available with the 'ImageMagick' software package.")), { :pos_ce end check_config_preferences_dep + + cpus = 0 + for line in IO.readlines('/proc/cpuinfo') do + line =~ /^processor/ and cpus += 1 + end + + if $config['cpus'] && count_cpus > $config['cpus'].to_i + show_popup($main_window, utf8(_("It seems you now have more CPUs available than last time booh was run. +You should probably increase the amount of CPUs configured in Edit/Preferences, +so that web-albums are generated as fast as possible on this computer.")), { :pos_centered => true, :not_transient => true }) + end + $config['cpus'] = cpus end def check_image_editor -- 2.21.3