Replies: 1 comment
-
|
I think this would be a great enhancement. If this feature lands in MPD, I will definitively support it in myMPD. It will be also useful if the search result can also ouput stickers additionally to the song metadata. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Currently filter expressions can include many different tags, but cannot include stickers as far as I can tell. (Unless that's the purpose of being able to put stickers on filter expressions, but if so then the documentation wasn't clear enough for me to understand how/why to do that).
What I'd like is to be able to write a filter expression like
(sticker:playCount == 0), where a filter tag that starts withsticker:would be used as a way to query the sticker database. I'd also love for>and<, and maybe>=and<=too, to be valid in filter expressions, so that I could write(sticker:rating > 5). (The logic would be that if the filter expression's value is not quoted, and it parses to a number (or maybe an integer) without parsing errors, then the sticker value is also interpreted to be a number. Because for most use cases involving ratings or play counts, the sticker "2" should be counted as less than the sticker "10", but the string "2" is alphabetically greater than the string "10").I'd also like to be able to write a filter expression like
(sticker:rating == ''), which would match a song if it had noratingsticker.Would anyone else be interested in such a thing? Should I open an issue with a feature request?
Use case
I want to be able to query the MPD database for queries like "All songs that I have not yet rated, and which have a playCount of less than 10". I.e.,
((sticker:rating == '') AND (sticker:playCount < 10)). My intent is to then write a small script that would take the results, choose one (or half a dozen, or twenty) at random, and add it/them to the queue.There are many use cases that this could enable, too. For example, "queue up all songs with a rating of at least 8 but with a play count of less than 10" to listen to songs I used to love, but which I haven't heard in a while. And so on.
Workarounds
Without being able to filter by sticker values, I can probably still write the script I want... kind of. It would involve doing things like
mpc search '(artistsort starts_with "Yankovic")', grabbing the results, then building an SQLite query likeCREATE TEMPORARY TABLE mpd_results AS VALUES (list of songs that mpc search returned, properly SQL-quoted); SELECT column1 FROM mpd_results WHERE column1 NOT IN (SELECT column1 FROM mpd_results JOIN sticker ON column1 = uri WHERE name = 'rating';.As you can see, that's quite a mouthful of SQL, and my guess is that most users of MPD clients wouldn't have the technical know-how to do something like that. It would be much nicer to be able to express that logic as the filter expression
((artistsort starts_with "Yankovic") AND (sticker:rating == '')).Corner cases
sticker:whateverfilters would automatically return zero results. (Or just be an error).sticker:(exactly that spelling, with a colon at the end), it could become difficult for them to write an MPD filter expression to search for that tag. This seems... extremely unlikely, though.sticker:playCount == 0might be surprised to find it returning no results, because in most clients that addplayCount, the absence of a playCount sticker is what marks a play count of 0. It might be nice to detect that particular expression and return an error message like "Did you meanplayCount == ''?" Or else automatically convert playCount stickers (and only playCount stickers) that are absent into having a value of 0 for comparison purposes. (This should NOT be done to ratings, because if I add arating = 0sticker to a song it means I never want to hear it again, which is entirely different from having noratingsticker, which means I haven't rated it yet and I would definitely like to hear it so that I can give it a rating).Beta Was this translation helpful? Give feedback.
All reactions