diff --git a/addon.xml b/addon.xml index cc538469..1fa6102b 100644 --- a/addon.xml +++ b/addon.xml @@ -46,6 +46,16 @@ ListItem.Property(RetrospectCloaked) + + + ListItem.Property(RetrospectSearchFolder) + + + + + ListItem.Property(RetrospectSearchFolder) + + @@ -119,7 +129,7 @@ - true + false all GPL-3.0-or-later en nl de sv no lt lv fi diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index 95e879c8..3ad5df22 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -794,6 +794,16 @@ msgctxt "#30376" msgid "Continue Watching" msgstr "" +msgctxt "#30377" +msgid "Clear Search History" +msgstr "" + +msgctxt "#30378" +msgid "Remove Search Item" +msgstr "" + + + # empty strings from id 30377 to 30400 msgctxt "#30401" diff --git a/resources/lib/actions/addonaction.py b/resources/lib/actions/addonaction.py index 8f102b2a..f0aeafce 100644 --- a/resources/lib/actions/addonaction.py +++ b/resources/lib/actions/addonaction.py @@ -27,6 +27,7 @@ def __init__(self, parameter_parser): self._propertyRetrospectCategory = "RetrospectCategory" self._propertyRetrospectFavorite = "RetrospectFavorite" self._propertyRetrospectAdaptive = "RetrospectAdaptive" + self._propertyRetrospectSearchFolder = "RetrospectSearchFolder" self.parameter_parser = parameter_parser if self.parameter_parser is None: diff --git a/resources/lib/actions/folderaction.py b/resources/lib/actions/folderaction.py index a99c2891..3d6a1720 100644 --- a/resources/lib/actions/folderaction.py +++ b/resources/lib/actions/folderaction.py @@ -246,6 +246,7 @@ def __set_kodi_properties(self, kodi_item, media_item, is_folder, is_favourite): kodi_item.setProperty(self._propertyRetrospect, "true") if media_item.is_search_folder: + kodi_item.setProperty(self._propertyRetrospectSearchFolder, "true") # Search folders don't need more. return diff --git a/resources/lib/menu.py b/resources/lib/menu.py index 8e83d0ca..48c4eea3 100644 --- a/resources/lib/menu.py +++ b/resources/lib/menu.py @@ -2,6 +2,8 @@ import os import sys +from typing import List + import xbmc import xbmcgui @@ -123,6 +125,23 @@ def show_settings(self): AddonSettings.show_settings() self.refresh() + def clear_search(self): + """ Clears the complete search history for a channel.""" + + settings = AddonSettings.store(LOCAL) + settings.set_setting("search", [], self.channelObject) + self.refresh() + + def remove_search_item(self): + """ Removes a single item from the search history for a folder """ + + settings = AddonSettings.store(LOCAL) + history: List[str] = settings.get_setting("search", self.channelObject, []) # type: ignore + needle = self.params[keyword.NEEDLE] + history.remove(needle) + settings.set_setting("search", history, self.channelObject) + self.refresh() + def channel_settings(self): """ Shows the channel settings for the selected channel. Refreshes the list after closing the settings. """ diff --git a/retromenu.py b/retromenu.py index f19244e2..c5b9af4f 100644 --- a/retromenu.py +++ b/retromenu.py @@ -49,5 +49,9 @@ m.show_country_settings() elif command == "settings": m.show_settings() + elif command == "clear_search": + m.clear_search() + elif command == "remove_search_item": + m.remove_search_item() else: raise IndexError("Missing command in sys.argv: {}".format(sys.argv))