-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
play: add --random option #2350
Conversation
First and foremost, thank you for your work and commitment to this feature, and welcome to beets! I'd like to see this feature implemented very much, but to be honest I don't like it being done this way. I think we should bite the bullet and implement randomness at the query level. This would be useful for many other operations, right out of the box (the latest example being #2352 )! Furthermore, as I mentioned in #2304, I don't find the use of That being said, I perfectly understand that you would not take on such a project, and I am perfectly open to diverging opinions on this. |
Agreed—thank you for following up with this after #2322! Let's explore what it would take to make this part of the query syntax. The tricky thing here is that a query like Instead, what we want is more like our current sort operators. They modify the whole query that they appear in, so |
I agree with the If we are able to make it into a query (I'm willing to help, I just don't have any experience), would we still have access to the --equal-chance and --time options provided by I'm guessing it would involve multiple queries under the proposed |
Yeah. We'd have to come up with good syntax for it. Here are some (probably bad) ideas:
|
I think we do need a mechanism for modifiers like sorting (are there other types of modifiers already?). Sorting requires a
I have no idea how to implement this, I was just looking at |
Right! No, sorting is the only thing currently like this, so the query handling is currently hard-coded to only support sorting. We'd need to refactor things so that sorting, instead of being a special snowflake, is just a specific instance of a more general category. The |
After further thought, it seems like we need to do two things:
The first one seems like it could be a part of beets current sorting with The second one, as far as I can tell, isn't a part of beets yet, although it can be done with Has there been any discussion, as far as you know @sampsyo, of limiting beets' output? |
Good point! Randomizing and truncating could indeed be decoupled. The closest thing here is #750, which we come up with in the context of the web interface. But the basic functionality is the same: limiting the number of results returned from a query. |
@diomekes any interest in continuing this? |
@jtpavlock Yes, but it's beyond my abilities. I did try to figure it out way back when, but just couldn't find out how to do it the right way (making randomness a query instead of just baked into the "play" plugin). |
I completely understand, it's not exactly what you signed up for when you opened this PR 😄 I also appreciate that you've generated a worthwhile discussion to the future implementation of this feature. I'm going to close this since it seems we'd prefer the implementation to be a much bigger and different idea than what you originally intended/were able to work on. If you'd like to continue in the discussion or have any further ideas, I suggest moving to #795. And if you ever want to come back and attempt to tackle this, feel free to open another pull request! |
This adds feature request #795 and part of #2305.
It's the same as #2304, but I closed that one due to updates to the random plugin (and because I didn't branch my master fork to make changes, you live you learn).
As discussed in #2304, #795 and #1948, the best option would be to add a "random" query prefix, but that's too advanced for me (at least for right now) to develop, so I did this instead.