Skip to content

Settings: allow removing a secondary library path mapping#193

Merged
Brandon-Haney merged 2 commits into
StudioNirin:mainfrom
Brandon-Haney:pr/remove-secondary-library-mapping
Jun 27, 2026
Merged

Settings: allow removing a secondary library path mapping#193
Brandon-Haney merged 2 commits into
StudioNirin:mainfrom
Brandon-Haney:pr/remove-secondary-library-mapping

Conversation

@Brandon-Haney

Copy link
Copy Markdown
Collaborator

Summary

Adds a way to remove a secondary library path mapping from Settings > Libraries. Previously a library could accumulate extra path mappings (for example after auto-fill, or when a library spans multiple roots) with no way to delete one from the UI; the only options were edit or leave it. This adds a per-mapping Remove action.

What changed

  • UI: Each mapping in a library card's edit view gets a Remove button, shown only when the library has more than one mapping (so you can't delete a library's last mapping and orphan it). Clicking it opens a styled confirmation modal naming the mapping, consistent with the rest of the Settings dialogs, rather than a raw browser confirm.
  • Backend: update_library_paths honors a delete_<pos> flag per mapping. Flagged mappings are dropped from path_mappings instead of updated, then valid_sections is rebuilt and settings saved. Deletions are applied highest-index-first so earlier indices stay valid.

How to test

  1. Open Settings > Libraries and pick a library that has two or more path mappings (add a second one first if needed).
  2. Edit the library — each mapping now shows a Remove button.
  3. Click Remove on a secondary mapping, confirm in the modal, and save.
  4. The mapping is gone from the card and from plexcache_settings.json (path_mappings), and the library still works with its remaining mapping(s).
  5. Confirm a library with only one mapping shows no Remove button (can't be left with zero).

Covered by tests/test_library_paths_delete.py.

Libraries with more than one path mapping (e.g. Movies + Movies UHD) had no way
to delete the extra mapping from the UI — Edit Paths could only edit fields. Add
a per-mapping Remove button (shown when a library has 2+ mappings) that marks the
mapping for deletion via a hidden delete_<pos> flag; PUT /libraries/{id}/paths
now drops flagged mappings instead of updating them. The last remaining mapping
keeps no Remove button (toggle the library off instead).
Replace the native browser confirm() for removing a library path mapping with
the existing in-app modal pattern (matches the pinned-group unpin dialog) —
backdrop, header/body/footer, danger Remove button, Esc-to-cancel.
@Brandon-Haney Brandon-Haney merged commit 51efd8a into StudioNirin:main Jun 27, 2026
2 checks passed
@Brandon-Haney Brandon-Haney deleted the pr/remove-secondary-library-mapping branch June 27, 2026 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants