Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 4 of 4
  1. #1
    Senior Member
    Join Date
    May 2008
    Location
    Canada
    Posts
    6,703

    Defeat Destructive Touch-To-Play

    I was having a look at adding an option to handle that in the Group Players plugin but I'm a bit confused by some aspects of the feature.

    I think I got the idea: when using a duet controller/jive-base, it's annoying to have a playlist being wiped out when pressing by accident the center button on the controller on an individual track.

    But then why only applying that logic when the controlled device is a SqueezePlay-type devices (Radio/Touch/Squeezelite). If I control my Boom/Duet why is the option to change the action in the settings disabled? By default, it's the server's built-in preference that cannot be changed by user (or I did not find where) which seems to be "defeat only if playing and current item not a radio stream".

    I'm probably missing something.

    Looking at the code in XMLBrowser
    Code:
    sub _defeatDestructiveTouchToPlay {
    	my ($request, $client) = @_;
    	my $pref;
    
    	if ($client && (my $agent = $client->controllerUA)) {
    		if ($agent =~ /squeezeplay/i && $agent !~ /jivelite/i) {
    			my ($version, $revision) = ($agent =~ m%/(\d+(?:\.\d+)?)[.\d]*-r(\d+)%);
    
    			return 0 if $version < 7.6;
    			return 0 if $version eq '7.6' && $revision < 9337;
    		}
    	}
    
    	$pref = $request->getParam('defeatDestructiveTouchToPlay');
    	$pref = $prefs->client($client)->get('defeatDestructiveTouchToPlay') if $client && !defined $pref;
    	$pref = $prefs->get('defeatDestructiveTouchToPlay') if !defined $pref;
    
    	# Values:
    	# 0 => no defeat
    	# 1 => always defeat
    	# 2 => defeat if playlist length > 1
    	# 3 => defeat only if playing and current-playlist-length > 1
    	# 4 => defeat only if playing and current item not a radio stream
    
    	return 0 if !$pref;
    	return 1 if $pref == 1 || !$client;
    	return ($client->isPlaying() && $client->playingSong()->duration() && !$client->playingSong()->isPlaylist()) if $pref == 4;
    	my $l = Slim::Player::Playlist::count($client);
    	return 0 if $l < 2;
    	return 0 if $pref == 3 && (!$client->isPlaying() || $l < 2);
    
    	return 1;
    }
    What seems to me is that if the UserAgent that browses is an "old" UI, we don't defeat (I assume the "old" brower cannot display a popup menu - make sense), but then why do we have in the 'basic settings'
    Code:
    	if ($paramRef->{'saveSettings'}) {
    
    		for my $pref (@prefs) {
    
    			my $i = 0;
    			my @array;
    
    			while (defined $paramRef->{'pref_'.$pref.$i}) {
    
    				if ($paramRef->{'pref_'.$pref.$i} ne "-1") {push @array, $paramRef->{'pref_'.$pref.$i};}
    				$i++;
    			}
    
    			$prefs->client($client)->set($pref, \@array);
    		}
    
    		if ($client->isPlayer && $client->isa('Slim::Player::SqueezePlay') && defined $paramRef->{'defeatDestructiveTouchToPlay'}) {
    			$prefs->client($client)->set('defeatDestructiveTouchToPlay', $paramRef->{'defeatDestructiveTouchToPlay'});
    		}
    	}
    
    	$paramRef->{'prefs'}->{'pref_playername'} ||= $client->name;
    
    	for my $pref (@prefs) {
    		$paramRef->{'prefs'}->{'pref_'.$pref} = [ @{ $prefs->client($client)->get($pref) }, "-1" ];
    	}
    
    	$paramRef->{'titleFormatOptions'}  = hashOfPrefs('titleFormat');
    
    	if ($client && !$client->display->isa('Slim::Display::NoDisplay')) {
    		$paramRef->{'playingDisplayOptions'} = getPlayingDisplayModes($client);
    		$paramRef->{'visualModeOptions'}     = getVisualModes($client);
    		$paramRef->{'saveropts'}             = Slim::Buttons::Common::validSavers($client);
    	}
    
    	$paramRef->{'playerinfo'} = Slim::Menu::SystemInfo::infoCurrentPlayer( $client );
    	$paramRef->{'playerinfo'} = $paramRef->{'playerinfo'}->{web}->{items};
    	$paramRef->{'macaddress'} = $client->macaddress;
    
    	$paramRef->{'playericon'} = $class->getPlayerIcon($client,$paramRef);
    
    	if ($client->isPlayer && $client->isa('Slim::Player::SqueezePlay')) {
    		$paramRef->{'defeatDestructiveTouchToPlay'} = $prefs->client($client)->get('defeatDestructiveTouchToPlay');
    		$paramRef->{'defeatDestructiveTouchToPlay'} = $prefs->get('defeatDestructiveTouchToPlay') unless defined $paramRef->{'defeatDestructiveTouchToPlay'};
    	}
    Which indicates (per observed behavior) that the DDTTP optionality is only presented to the user if the *player* (not the UA of the browser) is a SqueezePlay. I've tried to disable the test in the Basic.pm to have the option appear when controlling (e.g.) a Boom and it works as expected, I now can decide the behavior and result is as expected when using a Controller (unchanged when using the Boom's UI)



    Michael, feel free to move that to developer if your prefer
    Last edited by philippe_44; 2020-12-25 at 19:38.
    LMS 8.1.x on Odroid-C4 - SqueezeAMP!, 5xRadio, 5xBoom, 2xDuet, 1xTouch, 1xSB3. Sonos PLAY:3, PLAY:5, Marantz NR1603, Foobar2000, ShairPortW, 2xChromecast Audio, Chromecast v1 and v2, Squeezelite on Pi, Yamaha WX-010, AppleTV 4, Airport Express, GGMM E5, RivaArena 1 & 3

  2. #2
    Senior Member
    Join Date
    May 2008
    Location
    Canada
    Posts
    6,703
    Did I scare everybody with that question?
    LMS 8.1.x on Odroid-C4 - SqueezeAMP!, 5xRadio, 5xBoom, 2xDuet, 1xTouch, 1xSB3. Sonos PLAY:3, PLAY:5, Marantz NR1603, Foobar2000, ShairPortW, 2xChromecast Audio, Chromecast v1 and v2, Squeezelite on Pi, Yamaha WX-010, AppleTV 4, Airport Express, GGMM E5, RivaArena 1 & 3

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

    Defeat Destructive Touch-To-Play

    > Did I scare everybody with that question?

    I didn't like that feature when it was introduced. Thus I never paid any
    attention to it.

    But if that setting indeed is per player, and limited to Squeezeplay
    players, rather than controller, then it's stupid.

    The topic might not have gotten too much attention as not too many
    people are controlling non SP players using SP?

    --

    Michael

  4. #4
    Senior Member
    Join Date
    May 2008
    Location
    Canada
    Posts
    6,703

    Defeat Destructive Touch-To-Play

    Quote Originally Posted by mherger View Post
    &gt; Did I scare everybody with that question?

    I didn't like that feature when it was introduced. Thus I never paid any
    attention to it.

    But if that setting indeed is per player, and limited to Squeezeplay
    players, rather than controller, then it's stupid.

    The topic might not have gotten too much attention as not too many
    people are controlling non SP players using SP?

    --

    Michael
    That what I really think the code tells: The options is only visible applies if the *player* is a squeezeplay, but defeating or not depends on what is the controller, so what's the connection?

    You're probably right re controlling non-SP using SP, it just caught my attention as somebody hit that issue with the "Group" plugin. I started to add code to let players declare if they could support DDTTP and then I realized that I was doing did not make any sense, hence the question. Now, if we remove the /squeezeplay/ test in player's settings, it means I have nothing to do in "Group" (nice) . Less explicit model test in the LMS core sounds like a good direction.

    iPeng, the most popular controller, does its own thing independently.
    Last edited by philippe_44; 2020-12-27 at 02:21.
    LMS 8.1.x on Odroid-C4 - SqueezeAMP!, 5xRadio, 5xBoom, 2xDuet, 1xTouch, 1xSB3. Sonos PLAY:3, PLAY:5, Marantz NR1603, Foobar2000, ShairPortW, 2xChromecast Audio, Chromecast v1 and v2, Squeezelite on Pi, Yamaha WX-010, AppleTV 4, Airport Express, GGMM E5, RivaArena 1 & 3

Posting Permissions

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