From 8bff11531749424cabc5fa7150b1f90759fc9978 Mon Sep 17 00:00:00 2001
From: Kubat <mael.martin31@gmail.com>
Date: Tue, 29 Dec 2020 16:24:09 +0100
Subject: [PATCH] LKT: Add a way to explicit types for queries where the type
 can be inferred

---
 src/main/lkt.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/src/main/lkt.c b/src/main/lkt.c
index f5ab077b..2ebe7a81 100644
--- a/src/main/lkt.c
+++ b/src/main/lkt.c
@@ -177,15 +177,38 @@ if (STR_MATCH(lg, args->argv[0])) {                         \
         if (STR_MATCH("author", args->argv[0])) {
             *type = LKT_QUERY_TYPE_AUTHOR;
             __concat_strings(regex, regex_len, args->argv + 1, args->argc - 1);
+            return 0;
         }
 
         /* Type ?== playlist */
         else if (STR_MATCH("plt", args->argv[0]) || STR_MATCH("playlist", args->argv[0])) {
             *type = LKT_QUERY_TYPE_PLAYLIST;
             __concat_strings(regex, regex_len, args->argv + 1, args->argc - 1);
+            return 0;
+        }
+
+        /* Explicit type for lang, category and type */
+
+        /* Type ?== category */
+        else if (STR_MATCH("cat", args->argv[0]) || STR_MATCH("category", args->argv[0])) {
+            *type = LKT_QUERY_TYPE_CAT;
+            safe_snprintf(regex, regex_len, "%s", args->argv[0]);
+            return 0;
         }
 
-        return 0;
+        /* Type ?== lang */
+        else if (STR_MATCH("lang", args->argv[0]) || STR_MATCH("language", args->argv[0])) {
+            *type = LKT_QUERY_TYPE_LANG;
+            safe_snprintf(regex, regex_len, "%s", args->argv[0]);
+            return 0;
+        }
+
+        /* Type ?== type */
+        if (STR_MATCH("type", args->argv[0])) {
+            *type = LKT_QUERY_TYPE_TYPE;
+            safe_snprintf(regex, regex_len, "%s", args->argv[0]);
+            return 0;
+        }
     }
 
     /* If 'query' is specified, skip it */
-- 
GitLab