Skip to content

Commit 64aa4d7

Browse files
committed
add more constraint types
1 parent 0819cdc commit 64aa4d7

File tree

1 file changed

+11
-4
lines changed
  • tagstudio/src/core/query_lang

1 file changed

+11
-4
lines changed

tagstudio/src/core/query_lang/ast.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,20 @@
44

55
class ConstraintType(Enum): # TODO add remaining ones
66
Tag = 0
7-
MediaType = 1
7+
TagID = 1
8+
MediaType = 2
9+
FileType = 3
10+
Path = 4
811

912
@staticmethod
1013
def from_string(text: str) -> "ConstraintType":
11-
return {"tag": ConstraintType.Tag, "mediatype": ConstraintType.MediaType}.get(
12-
text.lower(), None
13-
)
14+
return {
15+
"tag": ConstraintType.Tag,
16+
"tag_id": ConstraintType.TagID,
17+
"mediatype": ConstraintType.MediaType,
18+
"filetype": ConstraintType.FileType,
19+
"path": ConstraintType.Path,
20+
}.get(text.lower(), None)
1421

1522

1623
class AST:

0 commit comments

Comments
 (0)