Skip to content

Commit

Permalink
#1313 Explicitely call a full wipe & rescan on wizard completion.
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Herger <michael@herger.net>
  • Loading branch information
michaelherger committed Feb 4, 2025
1 parent 4278a23 commit 845e9f2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
4 changes: 1 addition & 3 deletions Slim/Music/Import.pm
Original file line number Diff line number Diff line change
Expand Up @@ -795,14 +795,12 @@ sub initScanQueue {
sub nextScanTask {
return if main::SCANNER || __PACKAGE__->stillScanning;

# first parameter would be either the class, or the request object (if triggered by a subscription)
my $force = $_[1];
my @keys = keys %scanQueue;

my $k = shift @keys;
my $next = delete $scanQueue{$k};

if (!$force && $recentlyScanned{$k}++) {
if ($recentlyScanned{$k}++) {
main::INFOLOG && $log->is_info && $log->info("Skipping scan, as we run it recently: $k");
return;
}
Expand Down
13 changes: 9 additions & 4 deletions Slim/Web/Settings/Server/Wizard.pm
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ sub handler {
main::DEBUGLOG && $log->is_debug() && $log->debug('Setting music folder: ' . Data::Dump::dump($dirs));

$serverPrefs->set($pref, $dirs);
Slim::Control::Request::executeRequest(undef, ['wipecache', 'queue']);
}
else {
main::DEBUGLOG && $log->is_debug() && $log->debug("Setting $pref folder: $paramRef->{$pref}");
Expand Down Expand Up @@ -223,8 +224,7 @@ sub handler {

if (Slim::Utils::PluginDownloader->downloading) {
$finalizeCb = sub {
Slim::Music::Import->doQueueScanTasks(0);
Slim::Music::Import->nextScanTask(1);
_triggerScan();

Slim::Web::HTTP::filltemplatefile($class->page, $paramRef);
$pageSetup->( $client, $paramRef, Slim::Web::HTTP::filltemplatefile($class->page, $paramRef), $httpClient, $response );
Expand All @@ -234,8 +234,7 @@ sub handler {
}
}

Slim::Music::Import->doQueueScanTasks(0);
Slim::Music::Import->nextScanTask(1);
_triggerScan();

if ($client) {
$paramRef->{playericon} = Slim::Web::Settings::Player::Basic->getPlayerIcon($client,$paramRef);
Expand All @@ -245,6 +244,12 @@ sub handler {
return Slim::Web::HTTP::filltemplatefile($class->page, $paramRef);
}

sub _triggerScan {
main::DEBUGLOG && $log->is_debug && $log->debug('Now finally run a full wipe & resacan.');
Slim::Music::Import->doQueueScanTasks(0);
Slim::Music::Import->nextScanTask();
}

sub _checkPluginDownloads {
Slim::Utils::Timers::killTimers(undef, \&_checkPluginDownloads);

Expand Down

0 comments on commit 845e9f2

Please sign in to comment.