From 581b7acd434acd5c1164ea0023f2e61d6ce6c746 Mon Sep 17 00:00:00 2001 From: Jann Stute Date: Wed, 27 Nov 2024 21:32:39 +0100 Subject: [PATCH] add more constraint types --- tagstudio/src/core/query_lang/ast.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tagstudio/src/core/query_lang/ast.py b/tagstudio/src/core/query_lang/ast.py index 0f36fa0b..7e071f9b 100644 --- a/tagstudio/src/core/query_lang/ast.py +++ b/tagstudio/src/core/query_lang/ast.py @@ -4,13 +4,20 @@ from typing import Union class ConstraintType(Enum): # TODO add remaining ones Tag = 0 - MediaType = 1 + TagID = 1 + MediaType = 2 + FileType = 3 + Path = 4 @staticmethod def from_string(text: str) -> "ConstraintType": - return {"tag": ConstraintType.Tag, "mediatype": ConstraintType.MediaType}.get( - text.lower(), None - ) + return { + "tag": ConstraintType.Tag, + "tag_id": ConstraintType.TagID, + "mediatype": ConstraintType.MediaType, + "filetype": ConstraintType.FileType, + "path": ConstraintType.Path, + }.get(text.lower(), None) class AST: