mherger wrote:
> >But you should be able to filter for AAA. Save that as a library. Then
>
> you can edit the generated SQL. That should be much easier than to come
>
> up with all of it yourself
How do you think I came up with the SQL in the first place? ;) I
didn't/don't know SQL. I can compare and assemble stuff...
So I finally managed to get the correct entries in those 4 menus (with
the correct overall title count for this library view). The difference
(which I still can't spot or understand) is in how the virtual library
was registered. Instead of *foreach* etc. (see previous code snippet) I
registered the library like this:
Code:
--------------------
package Plugins::MyCustomMenus::Plugin;
use strict;
use base qw(Slim::Plugin::Base);
use Slim::Menu::BrowseLibrary;
use Slim::Music::Import;
use Slim::Utils::Log;
sub initPlugin {
my $class = shift;
Slim::Music::VirtualLibraries->registerLibrary(
{
id => 'AAA',
name => 'All AAA Tracks',
sql => qq{
INSERT OR IGNORE INTO library_track (library, track)
SELECT '%s', tracks.id
FROM tracks
LEFT JOIN comments comments ON comments.track =
tracks.id
WHERE
(comments.value LIKE '%% AAA%%'
OR
comments.value LIKE 'AAA%%') AND
tracks.audio = 1
GROUP by tracks.id
},
}
);
Slim::Music::VirtualLibraries->rebuild('AAA');
my @menus = ( {
name => 'AAA_ARTISTS',
icon => 'html/images/artists.png',
feed => \&Slim::Menu::BrowseLibrary::_artists,
id => 'AAA_TracksByArtist',
weight => 25,
virtualID => 'AAA',
},{
name => 'AAA_ALBUMS',
icon => 'html/images/albums.png',
feed => \&Slim::Menu::BrowseLibrary::_albums,
id => 'AAA_TracksByAlbum',
weight => 25,
virtualID => 'AAA',
},{
name => 'AAA_GENRES',
icon => 'html/images/genres.png',
feed => \&Slim::Menu::BrowseLibrary::_genres,
id => 'AAA_TracksByGenres',
weight => 25,
virtualID => 'AAA',
},{
name => 'AAA_YEARS',
icon => 'html/images/years.png',
feed => \&Slim::Menu::BrowseLibrary::_years,
id => 'AAA_TracksByYears',
weight => 25,
virtualID => 'AAA',
} );
foreach (@menus) {
Slim::Menu::BrowseLibrary->registerNode({
type => 'link',
name => $_->{name},
params => { library_id =>
Slim::Music::VirtualLibraries->getRealId($_->{virtualID}) },
feed => $_->{feed},
icon => $_->{icon},
jiveIcon => $_->{icon},
homeMenuText => $_->{name},
condition =>
\&Slim::Menu::BrowseLibrary::isEnabledNode,
id => $_->{id},
weight => $_->{weight},
cache => 0,
});
}
$class->SUPER::initPlugin(@_);
}
1;
--------------------
Do you know why this particular part didn't work in the first code
snippet?
One oddity: in the artists menu for this virtual ibrary, some artists
have - in addition to the correct albums - empty albums listed (when you
click on them, it says empty). That happens also if I create such a
library with the advanced search UI. Any idea how to get rid of those?
------------------------------------------------------------------------
afriend's Profile: http://forums.slimdevices.com/member.php?userid=39306
View this thread: http://forums.slimdevices.com/showthread.php?t=109334
_______________________________________________
discuss mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/discuss