Bug 2787 - Random plugin stops playing at end of generated list
: Random plugin stops playing at end of generated list
Status: RESOLVED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Plugin
: 6.5b1
: PC Windows XP
: P2 minor (vote)
: ---
Assigned To: Blackketter Dean
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-01-06 07:10 UTC by Ian Heath
Modified: 2006-01-30 22:03 UTC (History)
1 user (show)

See Also:
Category: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Heath 2006-01-06 07:10:29 UTC
Running SlimServer Version: 6.5b1 - 5547 - Windows XP - EN - cp1252

Choosing Random Song Mix with 'show "10" upcoming songs and "" recently played songs' set generates a playlist with 10 entries. Once the end of this playlist is reached, the player stops. It used to keep adding random songs.
Comment 1 KDF 2006-01-06 09:43:57 UTC
can you provide d_plugins log output.  it should show a note from Randomplay at every song transition, adding tracks or an indication of when/why it may stop adding.
Comment 2 Ian Heath 2006-01-06 12:26:26 UTC
(In reply to comment #1)
> can you provide d_plugins log output.  it should show a note from Randomplay at
> every song transition, adding tracks or an indication of when/why it may stop
> adding.
> 

Well, I've just done a complete re-install of the 6th Jan nightly and a new option has magically appeared on the Random Mix settings page ("Add new items when old ones finish") which was, of course, unchecked. Checking it fixes the "bug".

You can put this bug down to user error.
Comment 3 KDF 2006-01-06 13:50:07 UTC
thanks for letting us know :)
cheers.
Comment 4 KDF 2006-01-30 13:10:30 UTC
This is occurring again, likely due to some callback changes.  Jan 30 nightly.  Log section:

2006-01-30 13:07:38.1162 RandomPlay: Play track
2006-01-30 13:07:38.1485 RandomPlay: playRandom called with type track
2006-01-30 13:07:38.3205 RandomPlay: -1 songs remaining, songIndex = 0
2006-01-30 13:07:38.5438 RandomPlay: Starting random selection of 10 items for type: track
2006-01-30 13:07:39.0308 RandomPlay: Find returned 10 items
2006-01-30 13:07:39.0751 RandomPlay: Playing track: side2.mp3, 502
2006-01-30 13:07:40.2938 Adding 9 tracks to end of playlist
2006-01-30 13:07:40.4294 RandomPlay: Playing continuous track mode with 10 items
2006-01-30 13:07:41.1688 RandomPlay: received command playlist loadtracks
2006-01-30 13:07:41.1688 RandomPlay: while in mode: track, from 127.0.0.1
2006-01-30 13:07:41.1702 RandomPlay: cyclic mode ending due to playlist: playlist loadtracks command
2006-01-30 13:07:41.1712 RandomPlay: playRandom called with type disable
2006-01-30 13:07:41.1722 RandomPlay: 9 songs remaining, songIndex = 0
2006-01-30 13:07:41.1733 RandomPlay: cyclic mode ended


my guess is that the async command response is causing the loadtracks to arrive too late, and it is getting trapped.

cc'ing fred for suggestions.  I'll also try to take a look at it tonight.
Comment 5 Fred 2006-01-30 15:22:20 UTC
The problem is I think the module believes some other code did the loadtracks. This modules plays around subscribing, unsubscribing to the notification system to avoid being notified for stuff it did.

Request.pm proposes a solution with the ->source() call. RandomPlay would subscribe once, then test in its notification handling routine if the request source is itself (and return in such a case).

I guess calling source on the returned request object of executeRequest could work. Even though the request has been executed at this point, the notification will only happen once idle() is reached again.

I thought about RandomPlay when changing to async but could not find a good reason why it would not work in principle, but as we see, in practice there are a couple of issues :-)
Comment 6 KDF 2006-01-30 15:49:43 UTC
checking against the source would be fine.  Execution of the loadtracks is what we want; we just want to avoid seeing that and stopping the 'cyclic' mode.  It is either that, or have the callback in RandomPlay swallow the first loadtracks from the same client.  This would clearly involve a new global var for the plugin to set during playRandom and clear from the callback.
Comment 7 Fred 2006-01-30 16:03:24 UTC
source is cleaner I think. Which one you wanna fix, repeat 2 or this one? 
Comment 8 KDF 2006-01-30 16:12:19 UTC
I can probably take care of both, now that I have noticed that the source function already exists. I'm guessing you have lots on your list anyway.
Comment 9 Fred 2006-01-30 16:29:07 UTC
Mostly enhancements on my list, I've been lucky with bugs so far (and admittedly, the "random 2" bug is not a CLI bug. The same happens from the web interface I am sure). 

I'll take care of Random, it is easier for me than to investigate the many wonders of Source.pm and playmode.
Comment 10 Fred 2006-01-30 17:10:40 UTC
Fixed 5973. Can you try it again?

Thanks
Comment 11 KDF 2006-01-30 17:28:25 UTC
will check it out tonight.
Comment 12 KDF 2006-01-30 22:03:13 UTC
works for me.