sticker based smart-playlist ignores maxentries
Closed this issue · 7 comments
myMPD version: 18.2.0
After creating a sticker based smart playlist like this:
{"type":"sticker","sticker":"playCount","value":"1","op":"eq","maxentries":0,"sort":"shuffle","sortdesc":false}
The playlist is only being populated with exactly 20,000 songs despite the total of songs than match the criteria being more than 20,000. This happens regardless if a set maxentries to "0" or "30000"
Note: I have increased the value of the setting "max_playlist_length" in mpd.conf to cover for the expected size of playlists.
I can see this relevant lines in the log:
DEBUG webserver Sending 1588 bytes to 6
DEBUG mpdworker "stickerdb": Entering idle mode
DEBUG mpdworker "stickerdb": Found 29777 stickers for playCount
DEBUG mympdapi "default": Partition event
DEBUG mympdapi "default": Leaving mpd idle mode
DEBUG mympdapi "default": Checking for idle events
INFO mympdapi "default": MPD idle event "stored_playlist"
DEBUG mympdapi "default": Trigger event: mpd_stored_playlist (2)
DEBUG mympdapi "!all!": Push websocket notify to queue: "{"jsonrpc":"2.0","method":"update_stored_playlist","params":{}}"
DEBUG mympdapi "default": Entering mpd idle mode
DEBUG webserver Queue "web_server_queue": 0 entries
DEBUG webserver "!all!": Sending notify to conn_id "3": {"jsonrpc":"2.0","method":"update_stored_playlist","params":{}}
INFO webserver HTTP request (6): POST /api/default
DEBUG webserver "default": API request (6): {"jsonrpc":"2.0","id":610337277,"method":"MYMPD_API_PLAYLIST_LIST","params":{"offset":0,"limit":1000,"searchstr":"","type":0,"sort":"Name","sortdesc":false,"fi
elds":["Type","Name","Last-Modified"]}}
INFO webserver "default": API request (6): MYMPD_API_PLAYLIST_LIST
DEBUG mympdapi Queue event
DEBUG mympdapi Queue "mympd_api_queue": 0 entries
DEBUG mympdapi "default": Queue event
DEBUG mympdapi "default": Leaving mpd idle mode
DEBUG mympdapi "default": Handle API request "MYMPD_API_PLAYLIST_LIST"
DEBUG mympdapi "default": MYMPD API request (6)(610337277) MYMPD_API_PLAYLIST_LIST: {"jsonrpc":"2.0","id":610337277,"method":"MYMPD_API_PLAYLIST_LIST","params":{"offset":0,"limit":1000,"searchstr":"","t
ype":0,"sort":"Name","sortdesc":false,"fields":["Type","Name","Last-Modified"]}}
INFO mpdworker Updated smart playlist "test" with 20000 songs
INFO mpdworker "default": Shuffling playlist test
Seems to be a bug. I do not know why only exact 20.000 entries are populated, but the iteration loop ends to early. How many songs do you expect?
The exactly number that match are exactly this:
DEBUG mpdworker "stickerdb": Found 29777 stickers for playCount
Should be fixed in devel. Please test.
Sorry, It doesn't work.
I noticed that the problem is also present when the playlist is search based. So maybe all types of smart-playlist are affected. Should I change the issue title?
I also noticed that the max number of songs that the playlist is populated is variable and depends on the number of songs that match the criteria. so for example if the total songs that match is between 10.000 and 20.000 the playlist is populated with only 10.000 but if the total that match is between 20.000 to 30.000 the playlist gets 20.000
EDIT:
I was able to get the correct number of entries if i change the sort method to something different than "shuffle"
Which mpd version?
I was able to get the correct number of entries if i change the sort method to something different than "shuffle"
This was a second bug, fixed with above commit. Please test again.
Yes !!, as far as I can tell, it is now working as expected.
Thank you very much.