MPD
MPD copied to clipboard
Sort and limit results from sticker database
Feature request
I'd like to be able to retrieve a set of stickers ordered in a descending list, preferably with a limit in place:
sticker find {TYPE} {URI} {NAME} sort {SORT_DIRECTION}
and
sticker find {TYPE} {URI} {NAME} sort {SORT_DIRECTION} limit {LIMIT}
For example:
sticker find song "" playCount sort desc limit 100
This would allow retrieval of stickers that are numeric or alphabetic and be able to pull the "top 100 played songs". It would also be possible to set a sticker for "date added" and retrieve a list of "50 most recent additions". This allows for dynamic playlists without needing to add extra databases.
I know we can use:
sticker find {TYPE} {URI} {NAME}
Then sort, but for large collections (10,000+ songs) this means manually sorting thousands of objects and discarding almost all of them when the SQLite database can do that for us quickly and easily
I would vote for a window parameter instead of a limit parameter.
Good idea, if we introduce an optional start
and limit
in addition to sort
then this allows the most amount of flexibility:
sticker find {TYPE} {URI} {NAME} sort {SORT_DIRECTION} start {START} limit {LIMIT}
To get everything:
sticker find {TYPE} {URI} {NAME} sort {SORT_DIRECTION}
For a simple "limit":
sticker find {TYPE} {URI} {NAME} sort {SORT_DIRECTION} limit {LIMIT}
For "pagination":
sticker find {TYPE} {URI} {NAME} sort {SORT_DIRECTION} start {START} limit {LIMIT}
I will try to implement this.
To maintain a consistent syntax I would propose the following:
sticker find {TYPE} {URI} {NAME} [sort {uri|value}] [window {START:END}]
sticker find {TYPE} {URI} {NAME} = {VALUE} [sort {uri|value}] [window {START:END}]
@MaxKellermann: Does the syntax fit for you?
Yes, that's like the existing database find syntax.
As mentioned in #1895