Bug 10053 - Random Mix favorites doesn't work from Controller
: Random Mix favorites doesn't work from Controller
Status: CLOSED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: CLI
: 7.2.1
: PC Other
: P2 normal (vote)
: 7.x
Assigned To: Michael Herger
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-11-18 10:47 UTC by Erland Isaksson
Modified: 2009-07-31 10:32 UTC (History)
3 users (show)

See Also:
Category: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Erland Isaksson 2008-11-18 10:47:09 UTC
If you setup a playlist from the Random Mix plugin or from the Dynamic Playlist plugin as a favorite it isn't possible to play it from the controller. The problem is the events generated internally in SqueezeCenter when you issue the CLI or JSON command like:

favorites playlist load item_id:1

The result of this command is that it initiates the Random Mix playlist and then sends a "playlist clear" command that stops the playlist immediately. Well it isn't actually stopped, but it stops adding tracks and if you goto the Random Mix menu in the web interface is no longer shows the random mix playlist as playing.

The problem is reproducable in both 7.2.1 and the latest 7.3 svn version.

Debug log from Random Mix
=========================
[08-11-18 19:35:53.9300] Slim::Plugin::RandomPlay::Plugin::playRandom (614) Called with type contributor
[08-11-18 19:35:53.9308] Slim::Plugin::RandomPlay::Plugin::playRandom (639) 0 songs remaining, songIndex = 0
[08-11-18 19:35:53.9351] Slim::Plugin::RandomPlay::Plugin::findAndAdd (361) Starting random selection of 1 items for type: contributor
[08-11-18 19:35:53.9424] Slim::Plugin::RandomPlay::Plugin::findAndAdd (483) Find returned 1 items
[08-11-18 19:35:53.9438] Slim::Plugin::RandomPlay::Plugin::findAndAdd (497) Playing contributor: Billy Joel/Ray Charles, 12
[08-11-18 19:35:53.9780] Slim::Plugin::RandomPlay::Plugin::playRandom (798) Playing continuous contributor mode with 4 items
[08-11-18 19:35:53.9811] Slim::Plugin::RandomPlay::Plugin::playRandom (816) New mix started at 1227033353
[08-11-18 19:35:53.9834] Slim::Plugin::RandomPlay::Plugin::commandCallback (1043) Received command playlist clear
[08-11-18 19:35:53.9842] Slim::Plugin::RandomPlay::Plugin::commandCallback (1044) While in mode: contributor, from Squeezeslave 2
[08-11-18 19:35:53.9850] Slim::Plugin::RandomPlay::Plugin::commandCallback (1090) Cyclic mode ending due to playlist: playlist clear command
[08-11-18 19:35:53.9857] Slim::Plugin::RandomPlay::Plugin::playRandom (614) Called with type disable
[08-11-18 19:35:53.9863] Slim::Plugin::RandomPlay::Plugin::playRandom (639) 3 songs remaining, songIndex = 0
[08-11-18 19:35:53.9873] Slim::Plugin::RandomPlay::Plugin::playRandom (783) Cyclic mode ended
========================

Log from "listen" command in CLI interface:
==========================
00%3A00%3A00%3A00%3A00%3A02 playlist clear
00%3A00%3A00%3A00%3A00%3A02 displaynotify showbriefly HASH(0xe7dbe3c)
00%3A00%3A00%3A00%3A00%3A02 menustatus ARRAY(0xe90436c) add 00%3A00%3A00%3A00%3A00%3A02
00%3A00%3A00%3A00%3A00%3A02 playlist play randomplay%3A%2F%2Fcontributor 
00%3A00%3A00%3A00%3A00%3A02 menustatus ARRAY(0xe94bfdc) add 00%3A00%3A00%3A00%3A00%3A02
00%3A00%3A00%3A00%3A00%3A02 playlist jump 0  
00%3A00%3A00%3A00%3A00%3A01 randomplay contributor
00%3A00%3A00%3A00%3A00%3A01 playlist loadtracks contributor.id%3D12 
00%3A00%3A00%3A00%3A00%3A01 menustatus ARRAY(0xe9d46b4) add 00%3A00%3A00%3A00%3A00%3A01
00%3A00%3A00%3A00%3A00%3A01 playlist jump   
00%3A00%3A00%3A00%3A00%3A01 playlist open file%3A%2F%2F%2Fmnt%2Fmp3music_small%2Fexternal%25C3%2585%25C3%2584%25C3%2596%2FMrSinatra%2Fdisagreementdisk3.mp3
00%3A00%3A00%3A00%3A00%3A01 playlist open file%3A%2F%2F%2Fmnt%2Fmp3music_small%2Fexternal%25C3%2585%25C3%2584%25C3%2596%2FMrSinatra%2Fdisagreementdisk3.mp3
00%3A00%3A00%3A00%3A00%3A02 playlist load_done
========================

As you can see from the CLI log it looks like the playlist clear command is initiated first, but if you look in the Random Mix debug log it is actually received in Random Mix after the play command.

We had a similar problem with favorites from the web or player interface 6-12 months ago, I think it was Andy that solved it then.
Comment 1 James Richardson 2008-11-18 11:34:48 UTC
Ben: Would this be a Controller or SC issue?
Comment 2 Ben Klaas 2008-11-18 11:54:53 UTC
doesn't matter which product it's open against, though code will be all on the SC side. 

I'll take a look at fixing, initial target of 7.3.1.
Comment 3 Michael Herger 2008-11-25 23:13:50 UTC
Erland - could you please give a user's view of what you're trying to do. As per the discussion in the forums, playing a Mix as a favorite does work for me. 
Comment 4 Erland Isaksson 2008-11-26 10:25:40 UTC
(In reply to comment #3)
> Erland - could you please give a user's view of what you're trying to do. As
> per the discussion in the forums, playing a Mix as a favorite does work for me. 
> 

This is what I do:
1. I goto "Random Mix" in web interface and then hit the little "hearth" icon beside the "Random Artists" playlist, the result is that "Random Artists" is setup as a favorite.
2. On the Controller (or in iPeng Native Application) i goto Favorites menu and hit play on the new "Random artists" favorite

The result is:
1. It adds a number of random tracks
2. It starts to play
3. It doesn't continue adding new tracks, it just repeats the first 10 tracks over and over again.

Point 3 is the problem and the cause is the "playlist clear" event which is received in Random Mix plugin in the wrong order so the Random Mix playlist is stopped so it no longer adds new tracks.

Are you saying it keeps adding tracks in your setup ?
Comment 5 Michael Herger 2008-11-26 10:52:47 UTC
> Are you saying it keeps adding tracks in your setup ?

Nope. Can confirm the issue.

Been - feel free to grab it back if you feel like it. 
Comment 6 Erland Isaksson 2008-11-26 11:13:35 UTC
In case it helps finding a solution, a similar problem existed earlier when playing a favorite through the web interface:
https://bugs-archive.lyrion.org/show_bug.cgi?id=8652
Comment 7 Michael Herger 2008-12-12 02:56:44 UTC
Andy - looking at the change Erland mentioned, I was wondering whether the following patch would be safe:

Index: /Users/mh/Documents/workspace/7.3/server/Slim/Control/XMLBrowser.pm
===================================================================
--- /Users/mh/Documents/workspace/7.3/server/Slim/Control/XMLBrowser.pm	(revision 24287)
+++ /Users/mh/Documents/workspace/7.3/server/Slim/Control/XMLBrowser.pm	(working copy)
@@ -620,7 +620,6 @@
 						bitrate => $subFeed->{'bitrate'},
 					} );
 				
-					$client->execute([ 'playlist', 'clear' ]) if ($method =~ /play|load/i);
 					$client->execute([ 'playlist', $method, $url ]);
 				}
 			}

 			
It's the same removing of "playlist clear" you did for the web UI, this time in the CLI code.
Comment 8 Andy Grundman 2008-12-12 05:29:55 UTC
Yeah, that should be fine.
Comment 9 Michael Herger 2008-12-12 05:43:52 UTC
change 24289
Comment 10 James Richardson 2008-12-19 06:56:19 UTC
This appears to be addressed in

SqueezeCenter 7.3.1 r24367
Controller 7.3 r3476

Please test that version or higher
Comment 11 James Richardson 2008-12-22 11:36:46 UTC
This bug has been fixed in the 7.3.1 release version of SqueezeCenter!

Please download the new version from http://www.slimdevices.com/su_downloads.html if you haven't already.  

If you are still experiencing this problem, feel free to reopen the bug with your new comments and we'll have another look.
Comment 12 Chris Owens 2009-07-31 10:32:14 UTC
Reduce number of active targets for SC