mherger wrote: 
> exploring new ground here

I would like to group select menus from *various* virtual libraries into
*one* single top level menu folder (as explained in 'post 1'
(https://forums.slimdevices.com/showthread.php?109334-Virtual-Libraries-help-beginner-please&p=918401&viewfull=1#post918401)).
It seems to be a *Perl coding* challenge and therefore I hope as an
experienced coder you can spot my problem right away and maybe push me
in the right direction.

It feels like I have 2 Perl code examples I need to bring together.

On the one hand the code to -group- menus belonging to *one* virtual
library (here: 'AAA') into a -single- folder:


Code:
--------------------
                Slim::Menu::BrowseLibrary->registerNode({
  type         => 'link',
  name         => 'MENUGROUP',
                        *params       => { library_id => 
Slim::Music::VirtualLibraries->getRealId('AAA') },*
  feed         => sub {
        my ($client, $cb, $args, $pt) = @_;
        my @items = ();
  
        *push @items*,{
                type => 'link',
                name => string('AAA_SEL_ALBUMS'),
                url => \&Slim::Menu::BrowseLibrary::_albums,
                icon => 'html/images/albums.png',
                        *passthrough* => [{ 
                                *library_id* => $pt->{'*library_id*'},
                                searchTags => [
                                        '*library_id*:'.$pt->{'*library_id*'}
                                ],
                        }],
        };
  
        push @items,{
                type => 'link',
                name => string(AAA_SEL_ARTISTS'),
                url => \&Slim::Menu::BrowseLibrary::_artists,
                icon => 'html/images/artists.png',
                passthrough => [{ 
                        library_id => $pt->{'library_id'},
                        searchTags => [
                                'library_id:'.$pt->{'library_id'}
                        ],
                }],
        };
                                $cb->({
                                        items => \@items,
                                        });
  },
  icon => 'html/images/musicfolder.png',
  jiveIcon => 'html/images/musicfolder.png',
  id           => 'MyTopLevelMenu',
  weight       => 600,
  cache        => 1,
  });
--------------------


But since the *library_id* is defined -before- the *push @items*, all
menus in this folder have to be from the virtual library defined in the
beginning (params).

And on the other hand I can create menus from *various* virtual
libraries (alas, -top level menus only-) using this code:

Code:
--------------------
        *my @menus* = ( {
                name => 'AAA_ARTISTS',
                icon => 'html/images/artists.png',
                feed => \&Slim::Menu::BrowseLibrary::_artists,
                id   => 'AAA_TracksByArtist',
                weight => 25,
  virtualID => 'AAA',
        },{
                name => 'BBB_ALBUMS',
                icon => 'html/images/albums.png',
                feed => \&Slim::Menu::BrowseLibrary::_albums,
                id   => 'BBB_TracksByAlbum',
                weight => 25,
  virtualID => 'BBB',
        } );
  
        *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        => 1,
                });
        }
  
--------------------


So if you know how I can bring these two together to have -one top level
menu folder- containing menus from *various* virtual libraries, please
let me know. I'm really trying but I don't think I'll get there on my
own. 
Thank you -very- much.


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