From d0e9e3db1ef9b231d0f868a182ab38a15fbe92fc Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Thu, 14 Mar 2013 10:20:31 -0700 Subject: [PATCH] initial support for non-field queries With this change, we can get slightly closer to letting plugins extend the query syntax with queries that don't pertain to a specific field. This will likely need some more tweaking in the future, but it should allow for some very interesting things. --- beets/library.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/beets/library.py b/beets/library.py index 876b0961f..e33c5cbcd 100644 --- a/beets/library.py +++ b/beets/library.py @@ -768,9 +768,14 @@ def construct_query_part(query_part, default_fields, all_keys): if os.sep in pattern and 'path' in all_keys: # This looks like a path. return PathQuery(pattern) - else: - # Match any field. + elif issubclass(query_class, FieldQuery): + # The query type matches a specific field, but none was + # specified. So we use a version of the query that matches + # any field. return AnyFieldQuery(pattern, default_fields, query_class) + else: + # Other query type. + return query_class(pattern) # A boolean field. elif key.lower() == 'comp':