[Slim-Checkins] r10070 - in /trunk/server: Changelog6.html Slim/Music/Import.pm scanner.pl

dsully at svn.slimdevices.com dsully at svn.slimdevices.com
Wed Sep 27 17:27:32 PDT 2006


Author: dsully
Date: Wed Sep 27 17:27:30 2006
New Revision: 10070

URL: http://svn.slimdevices.com?rev=10070&view=rev
Log:
Bug: 4116
Description: Set the isScanning flag from the main process. Reduce the number of seconds for the timer check.

Modified:
    trunk/server/Changelog6.html
    trunk/server/Slim/Music/Import.pm
    trunk/server/scanner.pl

Modified: trunk/server/Changelog6.html
URL: http://svn.slimdevices.com/trunk/server/Changelog6.html?rev=10070&r1=10069&r2=10070&view=diff
==============================================================================
--- trunk/server/Changelog6.html (original)
+++ trunk/server/Changelog6.html Wed Sep 27 17:27:30 2006
@@ -6,6 +6,7 @@
 		<li><a href="http://bugs.slimdevices.com/show_bug.cgi?id=3318">#3318</a> - MusicMagic: Songs with national chars get duplicated</li>
 		<li><a href="http://bugs.slimdevices.com/show_bug.cgi?id=4071">#4071</a> - Band Names in mp3 Tags don't always work</li>
 		<li><a href="http://bugs.slimdevices.com/show_bug.cgi?id=4077">#4077</a> - CUE files YEAR and GENRE not always working</li>
+		<li><a href="http://bugs.slimdevices.com/show_bug.cgi?id=4116">#4116</a> - &quot;Rescan done&quot; sent prematurely (before rescan is done!)</li>
 		<li><a href="http://bugs.slimdevices.com/show_bug.cgi?id=4140">#4140</a> - Problem with the scanner parsing cue sheets in6.5b3</li>
 		<li><a href="http://bugs.slimdevices.com/show_bug.cgi?id=4142">#4142</a> - ExBrowse3 does not work with Safari</li>
 		<li><a href="http://bugs.slimdevices.com/show_bug.cgi?id=4149">#4149</a> - Display buffering feedback on Now Playing screen even after IR</li>

Modified: trunk/server/Slim/Music/Import.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Music/Import.pm?rev=10070&r1=10069&r2=10070&view=diff
==============================================================================
--- trunk/server/Slim/Music/Import.pm (original)
+++ trunk/server/Slim/Music/Import.pm Wed Sep 27 17:27:30 2006
@@ -148,8 +148,11 @@
 		Proc::Background->new($command, @scanArgs)
 	);
 
+	# Update a DB flag, so the server knows we're scanning.
+	$class->setIsScanning(1);
+
 	# Set a timer to check on the scanning process.
-	Slim::Utils::Timers::setTimer(0, (Time::HiRes::time() + 30), \&checkScanningStatus);
+	Slim::Utils::Timers::setTimer(0, (Time::HiRes::time() + 5), \&checkScanningStatus);
 
 	return 1;
 }
@@ -169,7 +172,7 @@
 	# Run again if we're still scanning.
 	if ($class->stillScanning) {
 
-		Slim::Utils::Timers::setTimer(0, (Time::HiRes::time() + 60), \&checkScanningStatus);
+		Slim::Utils::Timers::setTimer(0, (Time::HiRes::time() + 5), \&checkScanningStatus);
 
 	} else {
 
@@ -215,6 +218,32 @@
 		$last->value($value);
 		$last->update;
 	}) };
+}
+
+=head2 setIsScanning( )
+
+Set a flag in the DB to true or false if the scanner is running.
+
+=cut
+
+sub setIsScanning {
+	my $class = shift;
+	my $value = shift;
+
+	eval { Slim::Schema->txn_do(sub {
+
+		my $isScanning = Slim::Schema->rs('MetaInformation')->find_or_create({
+			'name' => 'isScanning'
+		});
+
+		$isScanning->value($value);
+		$isScanning->update;
+	}) };
+
+	if ($@) {
+
+		errorMsg("Scanner: Failed to update isScanning: [$@]\n");
+	}
 }
 
 =head2 runScan( )

Modified: trunk/server/scanner.pl
URL: http://svn.slimdevices.com/trunk/server/scanner.pl?rev=10070&r1=10069&r2=10070&view=diff
==============================================================================
--- trunk/server/scanner.pl (original)
+++ trunk/server/scanner.pl Wed Sep 27 17:27:30 2006
@@ -129,15 +129,15 @@
 
 	$::d_server && msg("SlimServer done init...\n");
 
+	# Take the db out of autocommit mode - this makes for a much faster scan.
+	Slim::Schema->storage->dbh->{'AutoCommit'} = 0;
+
 	# Flag the database as being scanned.
-	setIsScanning(1);
+	Slim::Music::Import->setIsScanning(1);
 
 	if ($cleanup) {
 		Slim::Music::Import->cleanupDatabase(1);
 	}
-
-	# Take the db out of autocommit mode - this makes for a much faster scan.
-	Slim::Schema->storage->dbh->{'AutoCommit'} = 0;
 
 	if ($wipe) {
 
@@ -237,25 +237,6 @@
 
 	$::d_server && msg("SlimServer Info init...\n");
 	Slim::Music::Info::init();
-}
-
-sub setIsScanning {
-	my $value = shift;
-
-	eval { Slim::Schema->txn_do(sub {
-
-		my $isScanning = Slim::Schema->rs('MetaInformation')->find_or_create({
-			'name' => 'isScanning'
-		});
-
-		$isScanning->value($value);
-		$isScanning->update;
-	}) };
-
-	if ($@) {
-
-		errorMsg("Scanner: Failed to update isScanning: [$@]\n");
-	}
 }
 
 sub usage {
@@ -313,12 +294,12 @@
 
 sub cleanup {
 
-	$::d_server && msg("SlimServer cleaning up.\n");
+	$::d_server && msg("SlimServer scanner cleaning up.\n");
 
 	# Make sure to flush anything in the database to disk.
 	if ($INC{'Slim/Schema.pm'}) {
 
-		setIsScanning(0);
+		Slim::Music::Import->setIsScanning(0);
 
 		Slim::Schema->forceCommit;
 		Slim::Schema->disconnect;



More information about the checkins mailing list