Skip to content

Attribute sidecar-only copies correctly and fix the remaining-time estimate - #210

Merged
Brandon-Haney merged 3 commits into
StudioNirin:mainfrom
Brandon-Haney:pr/banner-activity-accuracy
Sep 3, 2026
Merged

Attribute sidecar-only copies correctly and fix the remaining-time estimate#210
Brandon-Haney merged 3 commits into
StudioNirin:mainfrom
Brandon-Haney:pr/banner-activity-accuracy

Conversation

@Brandon-Haney

Copy link
Copy Markdown
Collaborator

Three fixes to what the completion banner and Recent Activity report.

Name the film when only its artwork was copied

Sidecars fold into their parent video's row, but the parent was indexed from the current run only. A video already on cache needs no copy, so a run that touched only its artwork produced unattributed rows: four ...-poster.jpg lines with nothing naming the film. The sibling map now covers every video with siblings rather than only the ones a run touched, so orphaned sidecars gather under a header carrying the video's filename in both surfaces. The header shows no size, because the video did not move and a size there would say it did. A lone sidecar stays flat, since its own filename already names the film.

Say when only a title's extras moved

That new header names the video, but it was still rendering the sidecars' own action badge, so a green CACHED sat beside a .mkv filename and read as though the video had been copied. FileActivity now carries sidecars_only through load, save and serialize, defaulting False so existing entries are unaffected. Both surfaces render a neutral tag instead: EXTRAS in the banner, "Extras only" in Recent Activity, each explaining in its tooltip that the video was already in place.

Price files as well as bytes in the remaining-time estimate

Copy time is bytes/rate plus a fixed per-file cost: open, size verify, chown, tracker write. The estimate modelled only the first, so a queue ending in artwork and NFOs read as nearly free. On a 199-file run it reported 9m 38s left when 11m 27s remained, because the 43 completed files averaged ~4 GB and the 156 still queued averaged ~0.75 GB.

_estimate_remaining_seconds() now splits the two. The best sustained rate seen is bulk throughput with per-file costs largely excluded, and whatever elapsed time that cannot explain is attributed to the files completed so far. Both are measured from the run in progress, so a slow array or a competing mover is reflected without a tuning constant. Sampled over 2s windows, since shorter ones are scheduling noise that would inflate the peak and hide the per-file term.

The banner also led with the file count while its bar and ETA were byte-based. At the moment above that read "43/199 files" beside a correct "9m left", which is a fifth against three fifths and makes the estimate look impossible. Bytes lead when byte progress is available, and the file count moves alongside elapsed.

How to test

  1. Cache a title whose video is already on the pool but whose artwork is not. The banner and Recent Activity show one row naming the film, tagged EXTRAS / "Extras only", not a green CACHED beside the .mkv.
  2. Confirm a single orphaned sidecar with no siblings still renders as a flat row.
  3. Start a run with a mix of large videos and many small sidecars. The remaining-time estimate should stay stable as the queue shifts to small files instead of collapsing toward zero.
  4. The banner leads with bytes transferred while byte progress is available, with the file count shown alongside elapsed.

Covered by tests/test_orphan_sidecar_grouping.py and tests/test_operation_eta.py.

Sidecars fold into their parent video's row, but the parent was indexed from
the current run only. A video already on cache needs no copy, so runs that
touched only its artwork produced several unattributed rows: four
"...-poster.jpg" lines with nothing naming the film.

sibling_map covers every video with siblings, not just the ones a run touched,
so the parent is known either way. Orphaned sidecars now gather under a header
carrying that filename, in the completion banner and the Recent Activity feed
alike. The header has no size, because the video did not move and a size there
would say it did.

A lone sidecar is left flat: its own filename already names the film, so a
header would add a row without adding anything to read.
The sidecar group header names the video so its artwork can be attributed, but
the video itself did not move. It was still rendering the sidecars' own action
badge, so a green CACHED sat beside a .mkv filename and read as though the
video had been copied — a clearer claim than the loose rows it replaced, and a
wrong one.

FileActivity carries sidecars_only through load, save and serialize, defaulting
False so existing entries are unaffected. Both surfaces render a neutral tag
for those rows: EXTRAS in the completion banner, "Extras only" in Recent
Activity, each explaining in its tooltip that the video was already in place.
Copy time is bytes/rate plus a fixed cost per file: open, size verify, chown,
tracker write. The estimate modelled only the first, so a queue that ends in
artwork and NFOs read as nearly free. On a 199-file run it reported 9m 38s
left when 11m 27s remained, because the 43 completed files averaged ~4 GB and
the 156 still queued averaged ~0.75 GB.

_estimate_remaining_seconds() splits the two. The best sustained rate seen is
bulk throughput with per-file costs largely excluded; whatever elapsed time
that cannot explain is attributed to the files completed so far. Both are
measured from the run in progress, so a slow array or a competing mover is
reflected without a tuning constant. Sampled over 2s windows, since shorter
ones are scheduling noise that would inflate the peak and hide the per-file
term.

The banner also led with the file count while its bar and ETA were byte-based.
At the moment above that read "43/199 files" beside a correct "9m left",
which is a fifth against three fifths and makes the estimate look impossible.
Bytes lead when byte progress is available; the file count moves alongside
elapsed.
@Brandon-Haney
Brandon-Haney merged commit 05b5c8b into StudioNirin:main Sep 3, 2026
2 checks passed
@Brandon-Haney
Brandon-Haney deleted the pr/banner-activity-accuracy branch September 3, 2026 18:47
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