Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 4 of 4

Thread: DSTM fallback?

  1. #1
    Senior Member
    Join Date
    Mar 2017
    Posts
    3,066

    DSTM fallback?

    I've written MusicIP and Essentia/Musly DSTM mixers. These only work on local tracks, so if the queue has non-local I'd like to fall-through to using LastMix. But I cant seem to get that working. How can a DSTM mixer call another? I have the following function to call through to LastMix:

    Code:
    sub _mixFailed {
        my ($client, $cb) = @_;
        if (exists $INC{'Plugins/LastMix/DontStopTheMusic.pm'}) {
            main::DEBUGLOG && $log->debug("Call through to LastMix");
            Plugins::LastMix::DontStopTheMusic->please($client, $cb);
        } else {
            main::DEBUGLOG && $log->debug("Return empty list");
            $cb->($client, []);
        }
    }
    My DSTM mixer uses the above via:

    Code:
    sub postinitPlugin {
        my $class = shift;
    
        if ( Slim::Utils::PluginManager->isEnabled('Slim::Plugin::DontStopTheMusic::Plugin') ) {
            require Slim::Plugin::DontStopTheMusic::Plugin;
            Slim::Plugin::DontStopTheMusic::Plugin->registerHandler('MIPMIXER_MIX', sub {
                my ($client, $cb) = @_;
    
                ....
    
                        Slim::Networking::SimpleAsyncHTTP->new(
                            sub {
                                my $response = shift;
                                main::DEBUGLOG && $log->debug("Recevied MIP response");
                                my $mix = _handleMipResponse($response->content);
                                my @tracks = _getTracksFromMix(\@$mix, \@$previousTracks, \@seedsToUse, \%seedIdHash, \@seedGenres);
                                if (scalar @tracks > 0) {
                                    $cb->($client, @tracks);
                                } else {
                                    _mixFailed($client, $cb);
                                }
                            },
                            ......
                            }
                        )->get($url);
                    } else {
                        _mixFailed($client, $cb);
                    }
                } else {
                    _mixFailed($client, $cb);
                }
            });
        }
    }
    But LMS complains:

    Code:
    [21-04-06 10:51:53.5072] Slim::Networking::IO::Select::__ANON__ (130) Error: Select task failed calling Slim::Networking::Async::HTTP::_http_read_body: Can't locate object method "master" via package "Plugins::LastMix::DontStopTheMusic" at /home/craig/Downloads/lms/Cache/InstalledPlugins/Plugins/LastMix/DontStopTheMusic.pm line 45.
    Any ideas what's wrong?
    Material debug: 1. Launch via http: //SERVER:9000/material/?debug=json (Use http: //SERVER:9000/material/?debug=json,cometd to also see update messages, e.g. play queue) 2. Open browser's developer tools 3. Open console tab in developer tools 4. REQ/RESP messages sent to/from LMS will be logged here.

  2. #2
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,601

    DSTM fallback?

    > Plugins::LastMix:ontStopTheMusic->please($client, $cb);

    You must call Plugins::LastMix:ontStopTheMusic:lease($client, $cb)
    (colons before "please", rather than the arrow notation). "please()" is
    not a class function.

  3. #3
    Senior Member
    Join Date
    Mar 2017
    Posts
    3,066
    Quote Originally Posted by mherger View Post
    > Plugins::LastMix:ontStopTheMusic->please($client, $cb);

    You must call Plugins::LastMix:ontStopTheMusic:lease($client, $cb)
    (colons before "please", rather than the arrow notation). "please()" is
    not a class function.
    D'Oh!!! That's so obvious! Now I feel stupid (and not for the first time!) Thanks, and sorry for asking and obvious question!
    Material debug: 1. Launch via http: //SERVER:9000/material/?debug=json (Use http: //SERVER:9000/material/?debug=json,cometd to also see update messages, e.g. play queue) 2. Open browser's developer tools 3. Open console tab in developer tools 4. REQ/RESP messages sent to/from LMS will be logged here.

  4. #4
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,601

    DSTM fallback?

    > D'Oh!!! That's so obvious! Now I feel stupid (and not for the first
    > time!) Thanks, and sorry for asking and obvious question!


    No worries!

Posting Permissions

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