fix(playlists): overlapping writes, and what the second review found

A read from before a write no longer brings a row back: a write calls off the
read on its way, what lands while one is out stays off the screen, and the last
write out does the refresh. A failure puts back its own rows, an accepted reorder
brings back none, and an Undo reads past the cache. A list the cache has dropped
is read before a removal, so its Undo has places.

undo-move refuses the same list twice, positions cannot repeat, and undo-move
and the Plex key bodies refuse a body without their videos. Focus goes to the
header's box when the last shown row or Save this order goes.
This commit is contained in:
2026-11-02 22:15:13 +01:00
parent 195b5f3917
commit b636ef38bc
12 changed files with 578 additions and 71 deletions
+3 -1
View File
@@ -559,7 +559,9 @@ def undo_move(
`dst`, which held them before. A moved video `dst` no longer holds has gone on from there, and
bringing it back would leave it in lists the reader never put it in, so it stays out, as a
move skips a video a concurrent edit took out. `positions` pairs with `moved` + `already_there`.
Says how many came back."""
Says how many came back. Raises `MoveRefused` for the same list twice, as a move does."""
if src.id == dst.id:
raise MoveRefused("same_playlist")
_lock_both(db, src, dst)
wanted = set(moved)
rows = {it.video_id: it for it in queries.items(db, dst.id) if it.video_id in wanted}