PDA

View Full Version : CLI info extension, Command.pm patch



andreas
2003-12-11, 09:10
Hello gurus...

Someone was requesting more information from the CLI, so I thought
it was a good idea to burn some of me free time to contribute a little!

With this patch you can fetch total genres/artists/albums & songs with:
info total genres
info total artists
info total albums
info total songs

Sure, you could move them all down a step and name them ie totalGenres,
but there might be more totals to add later... better safe than sorry?

I'm only vaguely familiar with perl, and this is more or less my first
real hack, so please be kind... ;)

Comments/improvements/anything is most appreciated!

Here we go...
--- /usr/local/slimserver/Slim/Control/Command.pm 2003-12-10 10:01:25.000000000 +0100
+++ ./Command.pm 2003-12-11 16:29:05.000000000 +0100
@@ -158,6 +158,21 @@
$p2 = Slim::Utils::Prefs::get($p1);
} elsif ($p0 eq "rescan") {
Slim::Music::MusicFolderScan::startScan();
+ } elsif ($p0 eq "info") {
+ #$::d_command && msg("Entering info...\n");
+ if (!defined($p1)) {
+ } elsif ($p1 eq "total") {
+ #$::d_command && msg("Entering total...\n");
+ if ($p2 eq "genres") {
+ $p3 = Slim::Music::Info::genreCount([],[],[],[]);
+ } elsif ($p2 eq "artists") {
+ $p3 = Slim::Music::Info::artistCount([],[],[],[]);
+ } elsif ($p2 eq "albums") {
+ $p3 = Slim::Music::Info::albumCount([],[],[],[]);
+ } elsif ($p2 eq "songs") {
+ $p3 = Slim::Music::Info::songCount([],[],[],[]);
+ }
+ }
} elsif ($p0 eq "debug") {
if ($p1 =~ /^d_/) {
my $debugsymbol = "::" . $p1;

dean
2003-12-11, 09:25
I like it!

Will apply.

-dean

On Dec 11, 2003, at 8:10 AM, andreas wrote:

> Hello gurus...
>
> Someone was requesting more information from the CLI, so I thought
> it was a good idea to burn some of me free time to contribute a little!
>
> With this patch you can fetch total genres/artists/albums & songs with:
> info total genres
> info total artists
> info total albums
> info total songs
>
> Sure, you could move them all down a step and name them ie totalGenres,
> but there might be more totals to add later... better safe than sorry?
>
> I'm only vaguely familiar with perl, and this is more or less my first
> real hack, so please be kind... ;)
>
> Comments/improvements/anything is most appreciated!
>
> Here we go...
> --- /usr/local/slimserver/Slim/Control/Command.pm 2003-12-10
> 10:01:25.000000000 +0100
> +++ ./Command.pm 2003-12-11 16:29:05.000000000 +0100
> @@ -158,6 +158,21 @@
> $p2 = Slim::Utils::Prefs::get($p1);
> } elsif ($p0 eq "rescan") {
> Slim::Music::MusicFolderScan::startScan();
> + } elsif ($p0 eq "info") {
> + #$::d_command && msg("Entering info...\n");
> + if (!defined($p1)) {
> + } elsif ($p1 eq "total") {
> + #$::d_command && msg("Entering total...\n");
> + if ($p2 eq "genres") {
> + $p3 =
> Slim::Music::Info::genreCount([],[],[],[]);
> + } elsif ($p2 eq "artists") {
> + $p3 =
> Slim::Music::Info::artistCount([],[],[],[]);
> + } elsif ($p2 eq "albums") {
> + $p3 =
> Slim::Music::Info::albumCount([],[],[],[]);
> + } elsif ($p2 eq "songs") {
> + $p3 =
> Slim::Music::Info::songCount([],[],[],[]);
> + }
> + }
> } elsif ($p0 eq "debug") {
> if ($p1 =~ /^d_/) {
> my $debugsymbol = "::" . $p1;
>
>