diff --git a/Changelog9.html b/Changelog9.html
index 15932246cb..80060e85b9 100644
--- a/Changelog9.html
+++ b/Changelog9.html
@@ -25,6 +25,7 @@
Version 9.0.2
#1193 - Don't throw error when fulltext search is being used before the end of a scan.
#1288 - Update Carp::Assert to latest to fix compatibility with recent Perl versions.
#1303 - Fix an issue where browsing releases would sometimes create thousands of parameters (and more - thanks @darrel-k!).
+ #1306 - Don't run the scanner before we're done with the setup wizard.
#1307 - Fix scanner progress information in the web UI.
diff --git a/Slim/Web/Settings/Server/Basic.pm b/Slim/Web/Settings/Server/Basic.pm
index 33f856fcfb..2820e4ae76 100644
--- a/Slim/Web/Settings/Server/Basic.pm
+++ b/Slim/Web/Settings/Server/Basic.pm
@@ -32,7 +32,7 @@ sub handler {
my ($class, $client, $paramRef) = @_;
# tell the server not to trigger a rescan immediately, but let it queue up requests
- # this is neede to prevent multiple scans to be triggered by change handlers for paths etc.
+ # this is needed to prevent multiple scans to be triggered by change handlers for paths etc.
Slim::Music::Import->doQueueScanTasks(1);
my $runScan;
diff --git a/Slim/Web/Settings/Server/Wizard.pm b/Slim/Web/Settings/Server/Wizard.pm
index 06ca3c4444..66c5fff927 100644
--- a/Slim/Web/Settings/Server/Wizard.pm
+++ b/Slim/Web/Settings/Server/Wizard.pm
@@ -40,6 +40,12 @@ sub page {
sub handler {
my ($class, $client, $paramRef, $pageSetup, $httpClient, $response) = @_;
+ # tell the server not to trigger a rescan immediately, but let it queue up requests
+ # this is needed to prevent multiple scans to be triggered by change handlers for paths etc.
+ Slim::Music::Import->doQueueScanTasks(1);
+ my $scanOnChange = $serverPrefs->get('dontTriggerScanOnPrefChange');
+ $serverPrefs->set('dontTriggerScanOnPrefChange', 0);
+
$paramRef->{languageoptions} = Slim::Utils::Strings::languageOptions();
# redirect to the Default skin if another skin is set
@@ -99,17 +105,61 @@ sub handler {
# set right-to-left orientation for Hebrew users
$paramRef->{rtl} = 1 if ($paramRef->{prefs}->{language} eq 'HE');
- foreach my $pref (@prefs) {
+ # install plugins if needed
+ if ($paramRef->{saveSettings}) {
+ @pluginsToInstall = ();
+ for my $param (keys %$paramRef) {
+ if ($paramRef->{$param} && $param =~ /^plugin-(.*)$/) {
+ # my $plugin = $1;
+ push @pluginsToInstall, $1;
+ }
+ }
- if ($paramRef->{saveSettings}) {
- @pluginsToInstall = ();
- for my $param (keys %$paramRef) {
- if ($paramRef->{$param} && $param =~ /^plugin-(.*)$/) {
- # my $plugin = $1;
- push @pluginsToInstall, $1;
+ Slim::Utils::ExtensionsManager::getAllPluginRepos({
+ type => 'plugin',
+ cb => sub {
+ my ($pluginData, $error) = @_;
+
+ my (undef, undef, $inactive) = Slim::Utils::ExtensionsManager::getCurrentPlugins();
+
+ my %pluginLookup;
+ foreach (@$pluginData, @$inactive) {
+ $pluginLookup{$_->{name}} = $_;
+ }
+
+ foreach my $plugin (@pluginsToInstall) {
+ Slim::Utils::ExtensionsManager->enablePlugin($plugin);
+ my $pluginDetails = $pluginLookup{$plugin} || {};
+
+ if ($pluginDetails->{url} && $pluginDetails->{sha}) {
+ main::INFOLOG && $log->is_info && $log->info("Downloading plugin: $plugin");
+
+ # 3rd party plugin - needs to be downloaded
+ Slim::Utils::PluginDownloader->install({
+ name => $plugin,
+ url => $pluginDetails->{url},
+ sha => lc($pluginDetails->{sha})
+ });
+
+ }
+ elsif ($pluginDetails->{version}) {
+ # built-in plugin - install
+ main::INFOLOG && $log->is_info && $log->info("Installing plugin: $plugin");
+ Slim::Utils::PluginManager->_needsEnable($plugin);
+ Slim::Utils::PluginManager->load('', $plugin);
+ }
}
- }
+ if (scalar @pluginsToInstall) {
+ Slim::Utils::Timers::killTimers(undef, \&_checkPluginDownloads);
+ Slim::Utils::Timers::setTimer(undef, time() + 1, \&_checkPluginDownloads);
+ }
+ },
+ });
+ }
+
+ foreach my $pref (@prefs) {
+ if ($paramRef->{saveSettings}) {
# if a scan is running and one of the music sources has changed, abort scan
if (
( ($pref eq 'playlistdir' && $paramRef->{$pref} ne $serverPrefs->get($pref))
@@ -120,66 +170,15 @@ sub handler {
Slim::Music::Import->abortScan();
}
- # revert logic: while the pref is "disable", the UI is opt-in
- # if this value is set we actually want to not disable it...
- elsif ($pref eq 'sn_disable_stats') {
- $paramRef->{$pref} = $paramRef->{$pref} ? 0 : 1;
- }
-
if ($pref eq 'mediadirs') {
my $dirs = $serverPrefs->get($pref);
unshift @$dirs, $paramRef->{$pref};
- my $scanOnChange = $serverPrefs->get('dontTriggerScanOnPrefChange');
- $serverPrefs->set('dontTriggerScanOnPrefChange', 0);
$serverPrefs->set($pref, [ Slim::Utils::Misc::uniq(@$dirs) ]);
- $serverPrefs->set('dontTriggerScanOnPrefChange', $scanOnChange) if $scanOnChange;
}
else {
$serverPrefs->set($pref, $paramRef->{$pref});
}
-
- Slim::Utils::ExtensionsManager::getAllPluginRepos({
- type => 'plugin',
- cb => sub {
- my ($pluginData, $error) = @_;
-
- my (undef, undef, $inactive) = Slim::Utils::ExtensionsManager::getCurrentPlugins();
-
- my %pluginLookup;
- foreach (@$pluginData, @$inactive) {
- $pluginLookup{$_->{name}} = $_;
- }
-
- foreach my $plugin (@pluginsToInstall) {
- Slim::Utils::ExtensionsManager->enablePlugin($plugin);
- my $pluginDetails = $pluginLookup{$plugin} || {};
-
- if ($pluginDetails->{url} && $pluginDetails->{sha}) {
- main::INFOLOG && $log->is_info && $log->info("Downloading plugin: $plugin");
-
- # 3rd party plugin - needs to be downloaded
- Slim::Utils::PluginDownloader->install({
- name => $plugin,
- url => $pluginDetails->{url},
- sha => lc($pluginDetails->{sha})
- });
-
- }
- elsif ($pluginDetails->{version}) {
- # built-in plugin - install
- main::INFOLOG && $log->is_info && $log->info("Installing plugin: $plugin");
- Slim::Utils::PluginManager->_needsEnable($plugin);
- Slim::Utils::PluginManager->load('', $plugin);
- }
- }
-
- if (scalar @pluginsToInstall) {
- Slim::Utils::Timers::killTimers(undef, \&_checkPluginDownloads);
- Slim::Utils::Timers::setTimer(undef, time() + 1, \&_checkPluginDownloads);
- }
- },
- });
}
if (main::DEBUGLOG && $log->is_debug) {
@@ -209,6 +208,10 @@ sub handler {
$paramRef->{plugins} = $wzData->{plugins};
$paramRef->{pluginsJSON} = to_json($paramRef->{plugins});
+ $serverPrefs->set('dontTriggerScanOnPrefChange', $scanOnChange) if $scanOnChange;
+ Slim::Music::Import->doQueueScanTasks(0);
+ Slim::Music::Import->nextScanTask();
+
# if the wizard has been run for the first time, redirect to the main we page
if ($paramRef->{firstTimeRunCompleted}) {
$response->code(RC_MOVED_TEMPORARILY);
diff --git a/slimserver.pl b/slimserver.pl
index bd396ddd65..f1bae1ca54 100755
--- a/slimserver.pl
+++ b/slimserver.pl
@@ -1093,7 +1093,7 @@ sub checkDataSource {
$prefs->set('mediadirs', $mediadirs) if $modified;
- return if !Slim::Schema::hasLibrary();
+ return if !Slim::Schema::hasLibrary() || !$prefs->get('wizardDone');
$sqlHelperClass->checkDataSource();