How to refresh the listing of parent directory when hitting Kodi's "back" button
#1
My addon provides a "search" feature and its content is like:
- New Search
- Clear Search History

When clicking "New Search", the keyboard pops up and users can enter queries, e.g., The Matrix, and then see a list of search results in a new "page".

From this search results page, when users click the "back" button in Kodi, I want the content now to include this new search query, for example:
- New Search
- Clear Search History
- The Matrix (<- I want to show the query just being searched)

My python code of generating this search menu is like:
Code:
xbmcplugin.addDirectoryItem('New Search' ...)
xbmcplugin.addDirectoryItem('Clear Search History' ...)
for item in local_search_history_cache:
         xbmcplugin.addDirectoryItem(item ...)
xbmcplugin.endOfDirectory(...)

The problem is that after hitting the "back" button from the search results page, Kodi seems to display the cached listing of the parent directory instead of re-running my addon again. Without running my addon, the query just being searched won't appear like I expected.

How can I modify my code so that the search menu will be "refreshed" with the newly searched query when I hit the back button from the search result page?

A more general question is, what is the behavior of Kodi's back button? Does it simply display cached listing of the parent directory? Can it rerun an addon or refresh/update the listing of the parent directory? Thanks!
Reply
#2
The endOfDirectory takes a cachetodisc bool. Disable caching.
Reply

Logout Mark Read Team Forum Stats Members Help
How to refresh the listing of parent directory when hitting Kodi's "back" button0