[Slim-Checkins] r33858 - in /7.7/trunk/server: Changelog7.html Slim/Buttons/XMLBrowser.pm Slim/Control/XMLBrowser.pm Slim/Menu/TrackInfo.pm

[email protected] Wed, 22 Feb 2012 16:00:43 -0000
Newsgroups gmane.music.equipment.slimdevices.cvs
Message-ID <[email protected]>
Author: ayoung
Date: Wed Feb 22 08:00:43 2012
New Revision: 33858

URL: http://svn.slimdevices.com/slim?rev=33858&view=rev
Log:
Unnecessary items in context menu for current-playlist tracks 

Take 2: use place-holder items in feed result that are not included in actual menus because subsequent XMLBrowser navigation invocations may not include the same context parameters as the original menu call.

‪1.‬ No "Remove from playlist" if only item in playlist
‪2.‬ No "Play Next" if only item in playlist or current (playing) item or next item
‪3.‬ No "Play" if current item and playing.

When playing a radio station this removes 3 unnecessary items from the top of the CM. It also removes some unnecessary items in other circumstances. 

Modified:
    7.7/trunk/server/Changelog7.html
    7.7/trunk/server/Slim/Buttons/XMLBrowser.pm
    7.7/trunk/server/Slim/Control/XMLBrowser.pm
    7.7/trunk/server/Slim/Menu/TrackInfo.pm

Modified: 7.7/trunk/server/Changelog7.html
URL: http://svn.slimdevices.com/slim/7.7/trunk/server/Changelog7.html?rev=33858&r1=33857&r2=33858&view=diff
==============================================================================
--- 7.7/trunk/server/Changelog7.html (original)
+++ 7.7/trunk/server/Changelog7.html Wed Feb 22 08:00:43 2012
@@ -18,6 +18,7 @@
 		<li><a href="http://bugs.slimdevices.com/show_bug.cgi?id=17841">#17841</a> - directory traversal vulnerability in the web UI code</li>
 		<li><a href="http://bugs.slimdevices.com/show_bug.cgi?id=17852">#17852</a> - Support for new ReadyNAS Duo and NV+ V2 devices</li>
 		<li><a href="http://bugs.slimdevices.com/show_bug.cgi?id=17855">#17855</a> - Only enable single output channel mode if actively synced</li>
+		<li><a href="http://bugs.slimdevices.com/show_bug.cgi?id=17876">#17876</a> - Unnecessary items in context menu for current-playlist tracks</li>
 		<li><a href="http://bugs.slimdevices.com/show_bug.cgi?id=17877">#17877</a> - Resume after underrun broken for synchronized (ip3k) players</li>
 		<li><a href="http://bugs.slimdevices.com/show_bug.cgi?id=17881">#17881</a> - BMF scan corrupts dB replacing title with file name</li>
 		<li><a href="http://bugs.slimdevices.com/show_bug.cgi?id=17882">#17882</a> - Fixed wrong MP4 MIME type for DLNA (audio/m4a was used instead of audio/mp4)</li>

Modified: 7.7/trunk/server/Slim/Buttons/XMLBrowser.pm
URL: http://svn.slimdevices.com/slim/7.7/trunk/server/Slim/Buttons/XMLBrowser.pm?rev=33858&r1=33857&r2=33858&view=diff
==============================================================================
--- 7.7/trunk/server/Slim/Buttons/XMLBrowser.pm (original)
+++ 7.7/trunk/server/Slim/Buttons/XMLBrowser.pm Wed Feb 22 08:00:43 2012
@@ -524,9 +524,9 @@
 			}
 		}
 		
-		# Check for a 'hide' param, if it's 'ip3k' skip the item in this UI
-		# of it is a playcontrol item - don't need those for ip3k
-		if ( ($item->{hide} && $item->{hide} =~ /ip3k/) || $item->{'playcontrol'}) {
+		# Check for an 'ignore' param, a 'hide' == 'ip3k' param (probably obsolete) and skip the item in this UI
+		# or it is a playcontrol item - don't need those for ip3k
+		if ( $item->{ignore} || ($item->{hide} && $item->{hide} =~ /ip3k/) || $item->{'playcontrol'}) {
 			splice @{ $opml->{items} }, $index, 1;
 			next;
 		}

Modified: 7.7/trunk/server/Slim/Control/XMLBrowser.pm
URL: http://svn.slimdevices.com/slim/7.7/trunk/server/Slim/Control/XMLBrowser.pm?rev=33858&r1=33857&r2=33858&view=diff
==============================================================================
--- 7.7/trunk/server/Slim/Control/XMLBrowser.pm (original)
+++ 7.7/trunk/server/Slim/Control/XMLBrowser.pm Wed Feb 22 08:00:43 2012
@@ -998,6 +998,12 @@
 				my $baseId = scalar @crumbIndex ? join('.', @crumbIndex, '') : '';
 				for my $item ( @$items[$start..$end] ) {
 					$itemIndex++;
+					
+					if ($item->{ignore}) {
+						# Skip this item
+						$totalCount--;
+						next;
+					}
 					
 					my $id = $baseId . $itemIndex;
 					

Modified: 7.7/trunk/server/Slim/Menu/TrackInfo.pm
URL: http://svn.slimdevices.com/slim/7.7/trunk/server/Slim/Menu/TrackInfo.pm?rev=33858&r1=33857&r2=33858&view=diff
==============================================================================
--- 7.7/trunk/server/Slim/Menu/TrackInfo.pm (original)
+++ 7.7/trunk/server/Slim/Menu/TrackInfo.pm Wed Feb 22 08:00:43 2012
@@ -52,6 +52,8 @@
 sub name {
 	return 'SONG_INFO';
 }
+
+my $emptyItemList = [{ignore => 1}];
 
 ##
 # Register all the information providers that we provide.
@@ -441,6 +443,10 @@
 	# "Play Song" in current playlist context is 'jump'
 	if ( $tags->{menuContext} eq 'playlist' ) {
 		
+		# do not add item if this is current track and already playing
+		return $emptyItemList if $tags->{playlistIndex} == Slim::Player::Source::playingSongIndex($client)
+					&& $client->isPlaying();
+		
 		$actions = {
 			go => {
 				player => 0,
@@ -519,6 +525,9 @@
 	my $actions;
 	# remove from playlist
 	if ( $cmd eq 'delete' ) {
+		
+		# Do not add this item if only one item in playlist
+		return $emptyItemList if Slim::Player::Playlist::count($client) < 2;
 
 		$actions = {
 			go => {
@@ -534,8 +543,14 @@
 
 	# play next in the playlist context
 	} elsif ( $cmd eq 'playlistnext' ) {
+		
+		# Do not add this item if only one item in playlist
+		return $emptyItemList if Slim::Player::Playlist::count($client) < 2;
 
 		my $moveTo = Slim::Player::Source::playingSongIndex($client) || 0;
+		
+		# do not add item if this is current track or already the next track
+		return $emptyItemList if $tags->{playlistIndex} == $moveTo || $tags->{playlistIndex} == $moveTo+1;
 		
 		if ( $tags->{playlistIndex} > $moveTo ) {
 			$moveTo = $moveTo + 1;

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