::#1::
Ok, so I have almost finished creating the virtual libraries I need.
For the "-20 Random Compilation Albums-" (= built-in "20 Random Albums"
for compilations) I could only come up with a workaround.
I've tried creating a virtual library for that but couldn't figure out
the exact SQL query (using albums.id or what not) to get it working,
however many SQL query variations I tried. The only code that worked
gave me 20 random compilation albums with just 1 track in it = 20 random
tracks.
I know it's because it's on the track and not album level but just
couldn't fugure it out.
*And* - *it didn't rebuild the menu when clicking on it* again.


Code:
--------------------
                sql => qq{
                                INSERT OR IGNORE INTO library_track (library, 
track)
                                        SELECT '%s', tracks.id
                                        FROM tracks 
                                        JOIN albums ON tracks.album = albums.id 
                                        WHERE albums.compilation=1
                                        AND tracks.audio = 1
                                        AND not exists(select * from 
genre_track,genres 
                                                where
                                                        
genre_track.track=tracks.id and
                                                        
genre_track.genre=genres.id and
                                                        genres.name in 
('Classical','Soundtracks'))
                        
                                group by albums.id
                                order by random()
                                
                                limit 20
                                },
                rebuildOnSelect => 1
  
--------------------


Anyway, so I tried *this workaround*: I used the virtual library that
gives me all compilation albums and I added *mode => 'randomalbums'* and
*sort => 'random'* to -the code that creates the menu:-


Code:
--------------------
                Slim::Menu::BrowseLibrary->registerNode({
                        type         => 'link',
                        name         => 'COMPILATIONS_RANDOM_20_ALBUMS',
                        params       =>  {library_id => 
Slim::Music::VirtualLibraries->getRealId('COMPIS_with_EXCLUDED_GENRES'),
                                                                mode => 
'randomalbums',
                                                                sort => 
'random'},
                        feed         => \&Slim::Menu::BrowseLibrary::_albums,
                        icon         => 'html/images/albums.png',
                        jiveIcon     => 'html/images/albums.png',
                        homeMenuText => 'COMPILATIONS_RANDOM_20_ALBUMS',
                        condition    => 
\&Slim::Menu::BrowseLibrary::isEnabledNode,
                        id           => 'COMPILATIONS_RANDOM_20_TracksByAlbum',
                        weight       => 90,
                        cache        => 1,
                        });
  
--------------------


I'd be ok with this workaround but it always gives me *50* albums.
Is there a way to insert a limit (*20* albums) into this workaround?

::#2::
But now comes the -really hard- part: with all those menus on the top
level it's getting more and more crowded. And while I can play around
and do some trial and error with SQL, there's no way I can do the same
with perl.
I took a look at the code of some plugins, especially Erland's Custom
Libraries which has a part in it that makes all menus (artists,
albums...) of a virtual library submenus of a top level menu with the
name of the virtual library. But that menu grouping code is so beyond
what I can do. I just couldn't get it to work.

So if you know *how to group menus together the way I described in the
'opening post'
(https://forums.slimdevices.com/showthread.php?109334-Virtual-Libraries-help-beginner-please&p=918401&viewfull=1#post918401)*,
if you have some working code that I can easily adjust to my needs, I
would be very glad to see it here.
>From my many hours of tinkering with virtual libraries, I can say it's
not easy but ultimately rewarding because it allows finer control and
will hopefully still work by the time Erland's plugins will have stopped
working. Thank you very much for your help.


------------------------------------------------------------------------
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

Reply via email to