torttube/addon
Kayos f1c7264e75 M4 polish — search history + cacheToDisc + 0-is-falsy fixes
Search history (M4 ergonomics):
- _record_search() stores the query into search_history.json under
  Kodi's addon_data dir. Dedupe case-insensitively, keep newest first,
  cap at SEARCH_HISTORY_MAX=12.
- _recent_directory() (action=recent) shows persisted queries as
  quick-pick items, each re-running the same search on click. Each
  item gets a 'Clear history' context menu entry. Tail entry clears
  everything.
- Root menu adds a 'Recent searches' entry only when history is
  non-empty.
- _clear_history_action wires the clear path + a notification.

cacheToDisc=False on the root menu and on search results (audit MED-3):
prevents an empty Search button getting stuck cached after a no-input
cancel, and prevents the previous query's result-set shadowing the
next search.

_format_duration / _format_views fixed to treat 0 as a real value and
'' only for None/negative (audit MED-4) — brand-new 0-view uploads
and livestream pre-rolls now render correctly.

Verified end-to-end via Files.GetDirectory:
  - Two searches ('funny cats', 'python tutorial') record into history
  - history.json contains ['funny cats', 'python tutorial'] (newest
    first because 'funny cats' was searched second)
  - Recent dir lists both + Clear tail entry
  - Root dir gains 'Recent searches' entry once history is populated

No playback was tested (Leia was on the TV). Addon v0.0.14.
2026-05-23 12:30:44 -07:00
..
plugin.video.torttube M4 polish — search history + cacheToDisc + 0-is-falsy fixes 2026-05-23 12:30:44 -07:00