My current hurdle is the $client variable I see everywhere. I've created menus for brutefirdrc in the web ui and ipeng already and am trying to add functionality to them. When my version of the plugin gets to
sub setMode { my $class = shift; my $client = shift; my $method = shift; # Handle requests to exit this mode/plugin by going back to where +the user was before they came # here. If you don't this, pressing LEFT will just put you straig +ht back to where you already # are! (try commenting out the following if statement) if ($method eq 'pop') { # Pop the current mode off the mode stack and restore the prev +ious one Slim::Buttons::Common::popMode($client); return; } if (isBlindTest($client)) { Slim::Buttons::Common::pushMode($client, $modeBlindTest); } else { pushMainMenuMode($client); } }
It breaks. When I use the normal menu already in the plugin the setmode function has this in it's variables.
$class = Plugins::BrutefirDrc::Plugin
$client = Slim::Player::SoftSqueeze=ARRAY(0xdaad6f8)
$method = push
When I run through the chain of functions from my menu all those variables are blank. I've tried to duplicate the chain of events in the plugin in my menu as close as possible to the original menu but I guess I've missed something. I believe this chunk of code is what I am missing but I don't know how to duplicate it for my menus.
my $valueref = $client->modeParam('valueRef'); if ($$valueref eq 'PLUGIN_BRUTEFIR_DRC_CHANGE_FILTER') { my $baseDir = getFilterDir(); my $currentDir = getCurrentFilterDir($client); $currentDir =~ s/$baseDir//; my @dirs = File::Spec->splitdir($currentDir); $currentDir = $baseDir; # push all directories on the path to current selected fil +ters dir as mode to make left pop them each out foreach my $dir (@dirs) { if ($dir) { Slim::Buttons::Common::pushMode($client, $modeFilt +erSelection, { folder => $currentDir }); $currentDir = File::Spec->catdir($currentDir, $dir +); } } Slim::Buttons::Common::pushModeLeft($client, $modeFilterSe +lection, { folder => getCurrentFilterDir($client) }); }
That's from the brutefirdrcMainMenu function. I'm pretty sure the Slim::Buttons stuff is where it falls apart because I have no idea what that really does or how to duplicate it. This is the menu entry I made that's supposed to do all that.
sub filterMenu { my ($client, $callback, $args) = @_; my $baseDir = getFilterDir(); my $currentDir = getCurrentFilterDir($client); $currentDir =~ s/$baseDir//; my @dirs = File::Spec->splitdir($currentDir); $currentDir = $baseDir; my $folder = $currentDir; my @filters; my %filters = getFiltersList($folder); my @choices = sort keys %filters; my @choicev = map $filters{$_}, @choices; my $filter = $filters{getCurrentFilter($client)} eq getCurrentFilt +erPath($client) ? getCurrentFilter($client) : ''; opendir DIR, $currentDir or die "cannot open dir $currentDir: $!"; my @file= readdir DIR; closedir DIR; my $items; $items = [{ { name => 'Select a Filter', url => \&filterMenu, },{ name => $filter, url => \&filterMenu, } }]; for my $file (@file) { push @$items, { name => $file, url => sub { my ($client, $cb, $params) = @_; }, nextWindow => 'refresh', }; } $callback->({ items => $items }); }
Any ideas how to make this work. Thanks,
Bronston

In reply to Re^2: Logitech Media Server/Squeezebox/Squeeze Server/Slim devices help by Bronston
in thread Logitech Media Server/Squeezebox/Squeeze Server/Slim devices help by Bronston

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.