Add a setting to hide the quarantine from Plex

Settings -> Media servers -> "Hide quarantine from Plex" writes a
.plexignore into every pair's quarantine folder (.playlink-trash by
default), with patterns for every folder depth quarantined files live
at. Quarantine folders opened later get the file automatically.

The file carries a marker line: turning the option off removes only
playlink's own file, and an existing .plexignore written by someone else
is never overwritten or deleted (reported instead). Writes go through a
temporary file and a rename.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
cdnutterandClaude Opus 5.5 committed 2026-09-28 21:57:56 -07:00
1 parent 42161e4287
commit 1da0132d5e
7 files changed
+238 -2

No files matched your search

+18 -2
View File
@@ -193,16 +193,19 @@ func (s *Server) handleInfo(w http.ResponseWriter, r *http.Request) {
"allowed_roots": s.eng.AllowedRoots(),
"default_extensions": engine.DefaultExtensions,
"dry_run": s.st.DryRun(r.Context()),
"plex_ignore": s.st.Setting(r.Context(), "plex_ignore", "0") == "1",
})
}
func (s *Server) handleGetSettings(w http.ResponseWriter, r *http.Request) {
writeJSON(w, 200, map[string]any{"dry_run": s.st.DryRun(r.Context())})
writeJSON(w, 200, map[string]any{"dry_run": s.st.DryRun(r.Context()),
"plex_ignore": s.st.Setting(r.Context(), "plex_ignore", "0") == "1"})
}
func (s *Server) handlePutSettings(w http.ResponseWriter, r *http.Request) {
var body struct {
DryRun *bool `json:"dry_run"`
DryRun *bool `json:"dry_run"`
PlexIgnore *bool `json:"plex_ignore"`
}
if !readJSON(w, r, &body) {
return
@@ -218,6 +221,19 @@ func (s *Server) handlePutSettings(w http.ResponseWriter, r *http.Request) {
}
s.log.Info("dry run changed", "dry_run", *body.DryRun)
}
if body.PlexIgnore != nil {
v := "0"
if *body.PlexIgnore {
v = "1"
}
if err := s.st.SetSetting(r.Context(), "plex_ignore", v); err != nil {
writeErr(w, 500, err)
return
}
results := s.eng.ApplyPlexIgnore(r.Context(), *body.PlexIgnore)
writeJSON(w, 200, map[string]any{"dry_run": s.st.DryRun(r.Context()), "plex_ignore": *body.PlexIgnore, "results": results})
return
}
s.handleGetSettings(w, r)
}