[Slim-Checkins] r11177 - /trunk/server/Plugins/Rescan/Plugin.pm
kdf at svn.slimdevices.com
kdf at svn.slimdevices.com
Thu Jan 11 00:25:27 PST 2007
Author: kdf
Date: Thu Jan 11 00:25:27 2007
New Revision: 11177
URL: http://svn.slimdevices.com?rev=11177&view=rev
Log:
Bug: n/a
Description: give the scan progress a mode of it's own. This way we can shut off the update timer when leaving, and it's easier to enter if needed for anything else
Modified:
trunk/server/Plugins/Rescan/Plugin.pm
Modified: trunk/server/Plugins/Rescan/Plugin.pm
URL: http://svn.slimdevices.com/trunk/server/Plugins/Rescan/Plugin.pm?rev=11177&r1=11176&r2=11177&view=diff
==============================================================================
--- trunk/server/Plugins/Rescan/Plugin.pm (original)
+++ trunk/server/Plugins/Rescan/Plugin.pm Thu Jan 11 00:25:27 2007
@@ -48,11 +48,7 @@
$client->string('PLUGIN_RESCAN_RESCANNING') ]
});
- Slim::Buttons::Common::popMode($client);
-
- Slim::Utils::Timers::setTimer($client, Time::HiRes::time() + 1, \&progressUpdate);
-
- Slim::Buttons::Common::pushMode($client, 'INPUT.List', \%progressParams);
+ Slim::Buttons::Common::pushMode($client, 'scanProgress');
} else {
@@ -71,6 +67,8 @@
'modeUpdateInterval' => 1,
);
+ Slim::Buttons::Common::addMode('scanProgress', undef, \&setProgressMode, \&exitProgressMode);
+
$class->SUPER::initPlugin();
Plugins::Rescan::Settings->new;
@@ -100,17 +98,13 @@
Slim::Utils::Prefs::set("rescan-time", 9 * 60 * 60 );
}
- my %params;
-
if ( Slim::Music::Import->stillScanning ) {
- %params = %progressParams;
-
- Slim::Utils::Timers::setTimer($client, Time::HiRes::time() + 1, \&progressUpdate);
+ Slim::Buttons::Common::pushMode($client, 'scanProgress');
} else {
- %params = (
+ my %params = (
'listRef' => \@browseMenuChoices,
'externRefArgs' => 'CV',
'header' => 'PLUGIN_RESCAN_MUSIC_LIBRARY',
@@ -142,9 +136,33 @@
},
);
- }
-
- Slim::Buttons::Common::pushMode($client, 'INPUT.List', \%params);
+ Slim::Buttons::Common::pushMode($client, 'INPUT.List', \%params);
+ }
+
+
+}
+
+sub setProgressMode {
+ my $client = shift;
+ my $method = shift;
+
+ if ($method eq 'pop') {
+ Slim::Buttons::Common::popMode($client);
+ return;
+ }
+
+ Slim::Utils::Timers::setTimer($client, Time::HiRes::time() + 1, \&progressUpdate);
+
+ Slim::Buttons::Common::pushMode($client, 'INPUT.List', \%progressParams);
+}
+
+sub exitProgressMode {
+ my $client = shift;
+ my $method = shift;
+
+ if ($method eq 'pop') {
+ Slim::Utils::Timers::killTimers($client, \&progressUpdate);
+ }
}
sub progressHeader {
@@ -172,8 +190,10 @@
if ($p && $p->name) {
if ($p->active) {
+
return $client->sliderBar($client->displayWidth(), $p->done/$p->total * 100,0,0);
} else {
+
return $p->total . ' ' . $client->string('ITEMS') . ' ' . ($p->finish - $p->start) .' ' . $client->string('SECONDS');
}
} else {
@@ -229,6 +249,7 @@
'pref' => 'rescan-time',
'callback' => \&settingsExitHandler
);
+
Slim::Buttons::Common::pushModeLeft($client, 'INPUT.Time',\%params);
} elsif ($$valueref eq 'PLUGIN_RESCAN_TIMER_OFF') {
More information about the checkins
mailing list