-
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
Extend the query date parser with (optional) times #2506
Comments
Development on this feature is now underway: discopatrick@ba324df So far, it has seemed fairly logical to me that date queries including times should use the 'T' separator format, e.g.: However, I can't decide whether using the 'T' separator makes the query more readable or less readable than if we just used a space: With minute precision: With hour precision: The 'T' separator makes it quite clear that what follows is a time value. This is most apparent when using hour precision - it's not immediately clear what the lone On the other hand, using a space separator keeps the format consistent with that which patrick$ ./beet list added:2017-04-13T11:43..2017-04-13T11:43
2017-04-13 11:43:08 - Danny Byrd - Supersized - Shock Out
2017-04-13 11:43:08 - Danny Byrd - Supersized - Weird Science
... Thus, using the space separator in queries would allow someone to pipe the output of patrick$ ./beet list -f '$added'
2017-04-13 11:57:14
... If we wanted to keep our options open, we could have a config option that lets us choose beets' datetime output format: --- # config.yaml
datetime_output_format: %Y-%m-%dT%H:%M:%s Initial testing shows that both formats pass all the existing tests (on Python 2 at least). Any advice or strong opinions on which way to go? |
Neat! One easy way would be to just allow either one. The parser could just match either a "t" (case insensitively) or whitespace. That would allow queries that are easy to type in the console as the same time as more legible queries in other contexts—in the situations you've already listed and, for example, in a hypothetical graphical interface where whitespace isn't used to separate query terms. That's the strategy we use for query negation too: you can use either -foo or ^foo, one of which is less ambiguous and the other of which is easier to type at the command line. |
I had a brief chat with @sampsyo about this on the beets irc channel. I just wanted to formally register myself as beginning this job here.
We can currently query based on date:
The plan is to additionally allow querying on time:
Without having looked at the code yet, I'm wondering whether the following are going to be problematic:
a) the space between date and time,
b) the colon symbols within the time.
If anyone can confirm this off the top of their head, and can advise on an approach, please do. Maybe it will work just fine. Maybe we'll need to change
2008-12-01 12:30:55
to2008-12-01-12-30-55
.Beets can also do shorthand date queries, like:
I would also like to be able to do shorthand time queries, like this:
i.e. list items added on or after 2008-12-01 12:00:00, but before 2008-12-02 19:16:00
I'll shout if I get stuck!
The text was updated successfully, but these errors were encountered: