Skip to content

Commit 7f93ee4

Browse files
oliv3rclaude
andcommitted
Fixed: Run search inline to prevent Kodi race condition
Container.Update triggers a separate plugin instance that races with endOfDirectory. Slow API responses cause Kodi to render the stale search-history page instead of the actual results. Run the search directly in the keyboard branch so results are rendered in the same plugin instance. Known issue: empty needle is passed through, so refreshing search results triggers the keyboard pop-up instead of re-running the query. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
1 parent 0c4178c commit 7f93ee4

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

resources/lib/actions/searchaction.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import re
33
from typing import Optional, List
44

5-
import xbmc
65
import xbmcplugin
76

87
from resources.lib import contenttype
@@ -68,22 +67,14 @@ def execute(self):
6867

6968
self.__settings.set_setting("search", history[0:10], self.__channel)
7069

71-
# Make sure we actually load a new URL so a refresh won't pop up a loading screen.
72-
needle = HtmlEntityHelper.url_encode(needle)
73-
xbmcplugin.endOfDirectory(self.handle, True, cacheToDisc=True)
74-
url = self.parameter_parser.create_action_url(self.__channel, action.SEARCH, needle=needle)
75-
xbmc.executebuiltin(f"Container.Update({url})")
70+
# Bug: empty needle is passed through, so a refresh triggers
71+
# the keyboard pop-up instead of re-running the query.
72+
media_items = self.__channel.search_site(needle=needle)
73+
folder_action = FolderAction(self.parameter_parser, self.__channel, items=media_items)
74+
folder_action.execute()
7675

7776
else:
7877
media_items = self.__channel.search_site(needle=self.__needle)
79-
# re_needle = re.escape(self.__needle)
80-
# Logger.debug(f"Highlighting {self.__needle} `{re_needle}` in results.")
81-
# highlighter = re.compile(f"({re_needle})", re.IGNORECASE)
82-
#
83-
# for item in media_items:
84-
# item.name = highlighter.sub(r"[COLOR gold]\1[/COLOR]", item.name)
85-
# if item.description:
86-
# item.description = highlighter.sub(r"[COLOR gold]\1[/COLOR]", item.description)
8778
folder_action = FolderAction(self.parameter_parser, self.__channel, items=media_items)
8879
folder_action.execute()
8980

0 commit comments

Comments
 (0)