Skip to content

Commit

Permalink
Merge branch '1874-wissen-van-zoektermen'
Browse files Browse the repository at this point in the history
  • Loading branch information
basrieter committed Dec 20, 2024
2 parents c2196b0 + ea6a1f9 commit 7e2682d
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 2 deletions.
10 changes: 10 additions & 0 deletions addon.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@
<visible>ListItem.Property(RetrospectCloaked)</visible>
</item>

<item library="retromenu.py" args="clear_search">
<label>30377</label>
<visible>ListItem.Property(RetrospectSearchFolder)</visible>
</item>

<item library="retromenu.py" args="remove_search_item">
<label>30378</label>
<visible>ListItem.Property(RetrospectSearchFolder)</visible>
</item>

<!-- Channel settings -->
<menu>
<label>30580</label>
Expand Down
10 changes: 9 additions & 1 deletion resources/language/resource.language.en_gb/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,15 @@ msgctxt "#30376"
msgid "Continue Watching"
msgstr ""

# empty strings from id 30377 to 30400
msgctxt "#30377"
msgid "Clear Search History"
msgstr ""

msgctxt "#30378"
msgid "Remove Item"
msgstr ""

# empty strings from id 30379 to 30400

msgctxt "#30401"
msgid "Dutch"
Expand Down
11 changes: 10 additions & 1 deletion resources/language/resource.language.nl_nl/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,16 @@ msgctxt "#30376"
msgid "Continue Watching"
msgstr "Doorgaan met kijken"

# empty strings from id 30373 to 30400
msgctxt "#30377"
msgid "Clear Search History"
msgstr "Zoekhistorie wissen"

msgctxt "#30378"
msgid "Remove Item"
msgstr "Verwijder"

# empty strings from id 30379 to 30400

msgctxt "#30401"
msgid "Dutch"
msgstr "Nederlands"
Expand Down
1 change: 1 addition & 0 deletions resources/lib/actions/addonaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions resources/lib/actions/folderaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
19 changes: 19 additions & 0 deletions resources/lib/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import os
import sys
from typing import List

import xbmc
import xbmcgui

Expand Down Expand Up @@ -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. """
Expand Down
4 changes: 4 additions & 0 deletions retromenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

0 comments on commit 7e2682d

Please sign in to comment.