Library: the text filter only acts on the focused list
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
+3
-2
@@ -21,14 +21,15 @@ const helpText = `[yellow]Global[-]
|
||||
[yellow]Library[-]
|
||||
Tab switch between the movies and series lists
|
||||
f cycle filter (all, missing, downloaded, monitored, unmonitored);
|
||||
filters apply to both lists
|
||||
the status and property filters apply to both lists
|
||||
F filter by file properties: quality, codec (x265, x264, AV1),
|
||||
HDR / DV / SDR, audio (Atmos, TrueHD, DTS, DD+ ...), language.
|
||||
Changes apply live behind the dialog, also while you move through an
|
||||
open list; Esc undoes them. Options that would leave no
|
||||
results are not offered.
|
||||
Series are read on demand.
|
||||
/ text filter (Enter or Esc returns to the list)
|
||||
/ text filter for the focused list only; each list keeps its
|
||||
own text (Enter or Esc returns to the list)
|
||||
t toggle monitored
|
||||
s automatic search (series: all missing, asks first)
|
||||
i, Enter movie: release search; series: seasons and episodes
|
||||
|
||||
+11
-5
@@ -182,7 +182,8 @@ type libPane struct {
|
||||
shown []libItem
|
||||
loaded bool
|
||||
err error
|
||||
gen int // invalidates stale loads
|
||||
gen int // invalidates stale loads
|
||||
text string // text filter, set with / while this pane is the current one
|
||||
}
|
||||
|
||||
// libraryView shows the movies of Radarr above the series of Sonarr, with the
|
||||
@@ -222,7 +223,7 @@ func newLibraryView(app *App, r *radarr.Client, s *sonarr.Client) *libraryView {
|
||||
v := &libraryView{
|
||||
app: app, radarr: r, sonarr: s,
|
||||
header: tview.NewTextView().SetDynamicColors(true),
|
||||
input: tview.NewInputField().SetLabel("Filter: ").SetFieldWidth(0),
|
||||
input: tview.NewInputField().SetLabel("Filter Movies: ").SetFieldWidth(0),
|
||||
details: tview.NewTextView().SetDynamicColors(true).SetWordWrap(true),
|
||||
|
||||
seriesFiles: map[int]seriesFiles{},
|
||||
@@ -238,6 +239,8 @@ func newLibraryView(app *App, r *radarr.Client, s *sonarr.Client) *libraryView {
|
||||
p.table.SetInputCapture(v.handleKey)
|
||||
p.table.SetFocusFunc(func() {
|
||||
v.cur = kind
|
||||
v.input.SetLabel("Filter " + kind.String() + ": ")
|
||||
v.input.SetText(p.text)
|
||||
p.table.SetBorderColor(tcell.ColorYellow)
|
||||
v.renderDetails()
|
||||
})
|
||||
@@ -252,7 +255,10 @@ func newLibraryView(app *App, r *radarr.Client, s *sonarr.Client) *libraryView {
|
||||
AddItem(lists, 0, 3, true).
|
||||
AddItem(v.details, 0, 2, false), 0, 1, true)
|
||||
|
||||
v.input.SetChangedFunc(func(string) { v.render() })
|
||||
v.input.SetChangedFunc(func(text string) {
|
||||
v.pane().text = text // the text filter only acts on the current pane
|
||||
v.render()
|
||||
})
|
||||
v.input.SetDoneFunc(func(tcell.Key) { v.app.app.SetFocus(v.pane().table) })
|
||||
v.render()
|
||||
return v
|
||||
@@ -381,7 +387,7 @@ func (v *libraryView) renderPane(p *libPane) {
|
||||
if r, _ := p.table.GetSelection(); r >= 1 && r <= len(p.shown) {
|
||||
selID = p.shown[r-1].id
|
||||
}
|
||||
p.shown = filterItems(p.all, v.filter, v.input.GetText(), v.attr)
|
||||
p.shown = filterItems(p.all, v.filter, p.text, v.attr)
|
||||
|
||||
p.table.Clear()
|
||||
header(p.table, 0, "Title", "Status", "Size")
|
||||
@@ -511,7 +517,7 @@ func (v *libraryView) openFilterDialog() {
|
||||
func (v *libraryView) filterPool() filterPool {
|
||||
var p filterPool
|
||||
for _, pane := range v.panes {
|
||||
for _, it := range filterItems(pane.all, v.filter, v.input.GetText(), attrFilter{}) {
|
||||
for _, it := range filterItems(pane.all, v.filter, pane.text, attrFilter{}) {
|
||||
if !it.attrsKnown {
|
||||
p.unknown = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user