Limit # Items in Playlist

Hey Community!

I’m setting up a small self-hosted music service thingy, where beets is running in the background carrying out tasks for the Mopidy/MPD based playback service.

I wanted to make a little automated “Daily Playlists” service of sorts, where a portion of my collection would be added into automated playlists based on some smart-ish queries I’d come up with. The playlists would be created via the Smart Playlists plugin and queries developed as time passes.

But to start off, I haven’t been able to found a way to limit the number of items in the generated playlists, and opening up a random playlist with thousands of items seems to easily crash the music service.

Is there a clear way to achieve a limit on the playlists items count? Or maybe a good work-around?

Thank you for any input!

1 Like

Hi! Unfortunately there’s not such a feature in the plugin. I also don’t have any great ideas for a workaround… maybe a post-processing script could do something like head -n100 on the m3u file to truncate it?

FWIW, the “right way” to do this would be for beets to support limiting in queries, which hopefully we’ll do someday…

Hey @adrian!

Thanks for getting back on the topic!

re: post-processing - Yes, this is what I was also thinking as a backup option / work-around.

But good to know there’s been a related initiative that touches the issues! And seems someone even mentioned the possibility of better Smart Playlist exactly as I had planned!
But I guess since it’s been opened since 2014 there’s no reason to hold my breath ^__^.

Anyways, thanks for now! I’ll see what I come up with!

+1 for @TottiT for putting this into words. I have also on many occasions found myself needing to limit the results of a query. I think the way to go is a special query element like limit:100 or similar so that it can work both for the core application and for all plugins.

@TottiT - have you checked if there is any open suggestion for this already?

Hey @jakabadambalazs!
Thanks for chipping in! Like @adrian mentioned in his post, there’s an issue open on a more general topic regarding “pagination support” that would, as far as I’m concerned, add the option to limit queries as well. Bad news - the feature has been “on demand” since 2014 so hard to say when, if ever, it will be implemented :P. But the more people join with similar needs, the more chances we have!

:rofl: Never lose faith! Who knows? This might be the good year.
I did not pick up on the pagination part. Do you mean like displaying a long list of items split up into screens that don’t scroll away but wait for user input? Something like more on a linux terminal?

I did not pick up on the pagination part. Do you mean like displaying a long list of items split up into screens that don’t scroll away but wait for user input? Something like more on a linux terminal?

I also don’t know exactly what pagination means, but after skimming through the thread a little, I have the FEELING that it somehow means splitting the query results into some sort of indexed lists that can be further processed during queries to allow for, say, limiting the results, only giving out last items in the queries, and so on. But again, this is only my feeling and someone with more knowledge might be able to shed some more light into this!