mherger wrote: 
> > Is there a recommended way to check that my plugin still "owns" the
> > client?
> 
> Keep track of the URL playing. If it has changed when your timer 
> triggers, then don't do anything.
> 

Thanks - that was the route I was going down and I found similar code in
Slim/Plugin/RemoteLibrary/ProtocolHandler.pm

My version in my timer return code is now something like this - and it
works

Code:
--------------------
    sub timerReturn {
        my ( $client, $url ) = @_;
  
        my $station = &matchStation( $url );
  
        my $song = $client->playingSong();
        my $playingURL = "";
        if ( $song && $song->streamUrl ) { $playingURL = $song->streamUrl}
  
        if ($playingURL ne $url){
                # Given stream URL not the same now as we had before implies 
listener has changed station
                main::DEBUGLOG && $log->is_debug && $log->debug("$station - 
timerReturn - stream changed to $playingURL");
                # However, it might be an alternative that leads to the same 
station (redirects) or another in the family so check
                $station = &matchStation( $playingURL );
        } else {
                # If streamUrl not found then something is odd - so report it 
to help determine issue
                if (!$song || !$song->streamUrl || !$song->streamUrl ne ""){
                        # Odd?
                        main::DEBUGLOG && $log->is_debug && 
$log->debug("$station - timerReturn - streamUrl issue $playingURL");
                }
        }
        
        if ($station ne "") {#One of mine so check for isPlaying and action it 
...} else { # not mine - log it }
  
--------------------


Odd thing is that none of the debug lines come out if switching from
streaming to playing local music - so I assume that the core code does a
killTimers in that situation.



Paul Webster
http://dabdig.blogspot.com
------------------------------------------------------------------------
Paul Webster's Profile: http://forums.slimdevices.com/member.php?userid=105
View this thread: http://forums.slimdevices.com/showthread.php?t=106810

_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to