Home of the Squeezebox™ & Transporter® network music players.
Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15
  1. #11
    Junior Member
    Join Date
    Jun 2017
    Posts
    7
    Thanks.
    Quote Originally Posted by mherger View Post
    you'll have to register a track info menu item
    I have modified the test code to include a call to Slim::Menu::TrackInfo::registerInfoProvider, which adds a menu item to the context menu reached by pressing and holding on a track in a playlist.
    The context menu reached by pressing and holding on an album in a menu page remains the same.
    Do you know whether it is possible to add a menu item to the context menu reached by pressing and holding on an album in a menu page?

  2. #12
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    19,779

    Plug-in menu item

    > Do you know whether it is possible to add a menu item to the context
    > menu reached by pressing and holding on an album in a menu page?

    You won't believe it, but it's as simple as using AlbumInfo instead of
    TrackInfo :-)

    Slim::Menu::AlbumInfo->registerInfoProvider

    And if you go to checkout Slim/Menu, you'll see that there are more
    menus you can hook in to.

    --

    Michael

  3. #13
    Junior Member
    Join Date
    Jun 2017
    Posts
    7
    Quote Originally Posted by mherger View Post
    Slim::Menu::AlbumInfo->registerInfoProvider
    Quote Originally Posted by aux View Post
    The context menu reached by pressing and holding on an album in a menu page remains the same.
    I observe the same behaviour with a call to Slim::Menu::AlbumInfo::registerInfoProvider in place.

    Does an element need to be added to the menu item hash to cause the function specified in the 'func' element to be called?

  4. #14
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    19,779

    Plug-in menu item

    >> Slim::Menu::AlbumInfo->registerInfoProvider
    > aux wrote:
    >> The context menu reached by pressing and holding on an album in a menu
    >> page remains the same.

    > I observe the same behaviour with a call to
    > Slim::Menu::AlbumInfo::registerInfoProvider in place.


    Of course it remains the same as long as you don't tell it to display
    differently. The menu handler you register should tell the function
    building the menu that it wants a context menu.

    > Does an element need to be added to the menu item hash to cause the
    > function specified in the 'func' element to be called?


    'passthrough' would have the list of additional parameters sent to that
    function.
    --

    Michael

  5. #15
    Junior Member
    Join Date
    Jun 2017
    Posts
    7
    Quote Originally Posted by mherger View Post
    Of course it remains the same as long as you don't tell it to display
    differently. The menu handler you register should tell the function
    building the menu that it wants a context menu.
    Code:
    package Plugins::ATestPlugin::Plugin;
    use base qw(Slim::Plugin::OPMLBased);
    sub initPlugin {
       $class = shift;
       Slim::Menu::AlbumInfo->registerInfoProvider(
          'atestplugin.album' => (
             after => 'middle',
             func => \&albumInfoMenu
          )
       );
       $class->SUPER::initPlugin(
          menu => 'extras',
          tag => 'atestplugin',
          feed => {
             name => 'A Test Plugin',
             items => [
                {
                   name => 'Albums',
                   items => [
                      {
                         type => 'playlist',
                         name => 'Album 1',
                         url => \&albumItems,
                         passthrough => []
                      },
                      {
                         type => 'playlist',
                         name => 'Album 2'
                      }
                   ]
                }
             ]
          }
       );
    }
    sub albumInfoMenu {
       Slim::Utils::Log->logBacktrace;
       ( $client, $url, $album, $remoteMeta, $tags, $filter ) = @_;
       return {
          type => 'text',
          name => 'Test text'
       };
    }
    sub albumItems {
       my ( $client,$callback,$parameter,$passthrough ) = @_;
       my $nextWindow = 'parent';
       $callback->(
          [
             {
                type => 'audio',
                name => 'Track'
             },
             {
                name => 'Add Album to My Albums',
                url => \&addAlbumToMyAlbums,
                passthrough => [],
                nextWindow => $nextWindow
             }
          ]
       );
    }
    sub addAlbumToMyAlbums {
       my ( $client,$callback,$parameter,$passthrough ) = @_;
       # code to add album to My Albums
       $callback->();
    }
    sub getDisplayName { 'A Test Plugin' }
    1;
    When 'Album 1' is tapped and held, how may &albumInfoMenu be made to be called and told to display as a context menu?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •