Bronston has asked for the wisdom of the Perl Monks concerning the following question:

Before I type out a lengthy question is anyone here familiar with Logitech Media Server/Squeezebox/Squeezes Server/Slim devices or whatever they are calling it this week (or which directory you happen to be looking at)?
  • Comment on Logitech Media Server/Squeezebox/Squeeze Server/Slim devices help

Replies are listed 'Best First'.
Re: Logitech Media Server/Squeezebox/Squeeze Server/Slim devices help
by hdb (Monsignor) on Nov 20, 2013 at 20:22 UTC

    Let me respond to your non-Perl topic with some advertisement (a.k.a. Spam): Yes, I am familiar with squeezeboxes, but I have long ago retired them in favor of a Sonos system. You have to look at it...

      Hi hdb,

      I'm pretty sure that the announced lengthy question may be about Perl because the Logitech Media Server Software is written in Perl.

      To answer the initial poster: Probably you should ask a shorter question to get a feeling about the direction of your problem.

      Best regards
      McA

        Yes it's all perl(well maybe a dash of shell scripting). I'm trying to modify a logitech media server(LMS) plugin, brutefirdrc to create a menu in both the LMS web ui and an ios app called ipeng to control said plugin. Currently the plugin only has a menu on a squeezebox and my project does not use a squeezebox. Creating these menus isn't an really an issue. The problem is the plugin is heavily reliant on the player(squeezebox) for much of the data it needs to function. None of this data needs to come from the player that's just the way the original programmer saw fit I guess. So I need someone that's pretty familiar with LMS to help me figure out how to either spoof a client in the plugin or some other way to use the functions in brutefirdrc that don't work without a squeezebox.

        Apologies to Bronston: it seems that at I have proven not to be an expert in the matter....

Re: Logitech Media Server/Squeezebox/Squeeze Server/Slim devices help
by CountZero (Bishop) on Nov 21, 2013 at 07:27 UTC
    Yes, I have three of these and love'm.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

    My blog: Imperial Deltronics
      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
        I'm sorry I have no idea how to make this work.

        Perhaps if I found some documentation on the API, I might give it a try, but for now I am happy with the functions these devices (and the available plug-ins) offer me.

        CountZero

        A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

        My blog: Imperial Deltronics