Skip to content

MacGui: add queue import and export - #8112

Open
anandghegde wants to merge 2 commits into
HandBrake:masterfrom
anandghegde:macgui-queue-import-export
Open

anandghegde wants to merge 2 commits into
HandBrake:masterfrom
anandghegde:macgui-queue-import-export

Conversation

@anandghegde

@anandghegde anandghegde commented Sep 20, 2026 •

Copy link
Copy Markdown

Closes #6351. Also covers #7299 for the Mac GUI.

Adds File > Import Queue… and Export Queue…, plus an Export… item in the queue contextual menu for the selected rows.

This now sits on top of the relink window (#8250), so the first commit here is that one, only the second commit is new. I'll rebase once the relink PR is in.

What changed since the last round:

  • the import / export code is in its own class (HBQueueArchive) instead of in HBQueue
  • queue files have their own version number, files from a newer version are refused with an error
  • importing shows a sheet where you choose which items to add
  • if the imported items point to sources or destinations that arent there, the relink sheet opens for those items

Testing

macOS 26, sandboxed build. Export, import with some items unchecked, importing a file that is not a queue, the overwrite warning, and importing after moving the sources (relink sheet comes up). Didnt test a file with a diffrent job version, or the non sandboxed build.

  • Windows 10+ (via MinGW)
  • macOS 10.13+
  • Ubuntu Linux

@galad87

galad87 commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

What would the use case be for this? The exported file can be used only with the MacGui, and only on the same computer.

@anandghegde

Copy link
Copy Markdown
Author

Fair question, and you're right about the limits — a .hbqueue file is same-app, same-version, same-machine. It's queue snapshots, not interchange. On the machine point specifically: _fileURL and _destinationFolderURL are encoded alongside the bookmarks, so the paths survive a copy to another Mac and refreshSecurityScopedResources falls back to them, but the sandbox won't grant access without the bookmark resolving, so in practice it's the same computer. I'm not claiming otherwise.

The use cases in the issues are all same-machine ones:

Splitting a large queue (#7299, the reason for the context-menu Export…). The request is to select a subset of a few hundred queued items and export just those, so a big batch can be broken into pieces and run one at a time rather than as one unstoppable run. That's entirely within one install — the file never leaves the machine.

Parking a queue to run later, or keeping more than one. Today the queue is a single implicit list. With this you can keep, say, a "weekly rips" file and a "re-encode archive" file, load whichever you want to run, and not have to rebuild the item list with its per-item settings each time. This is the substance of #6351 and #4845 as the reporters described them.

A snapshot before something destructive. Autorecovery covers a crash or a relaunch within a version, but it doesn't help before Clear Completed, or before deliberately emptying the queue to run something urgent first. An explicit file does.

What it deliberately does not solve: carrying a queue across a HandBrake upgrade. HB_JOB_VERSION rejects a file from a different version, which is the same constraint autorecovery has, and I'd rather it refuse with a clear message than half-import. If #4845's reporter reads "export queue" as "survives an upgrade", they'll be disappointed — but that's true of any format here short of the hb_job_t JSON route with a real JSON → HBJob importer, and that one can't export a job whose source isn't currently mounted.

Two things I'm happy to change if it helps:

  1. Naming. Import/Export matches the Windows GUI's menu wording, which is what the requests are asking for by name, but Save Queue… / Open Queue… sets a more honest expectation for a file that only this app on this Mac can read. Your call.
  2. Scope. If only Export Selected Items from Queue #7299 is interesting to you, the context-menu Export… plus Import is the useful core and the File menu pair could go.

And if the team's view is that queue snapshots aren't worth the surface area, say so and I'll close it — no hard feelings, I'd rather that than have it sit open.

@exekutive

Copy link
Copy Markdown

Use case: many times I've needed to put a queue on hold to encode something else more urgent, with the intent to return to the queue later. Sometimes I also want to build up a queue to have ready to run when I'm not actively using the machine. Those are just a few examples ... there are others. Would love to see this feature. Also still patiently waiting for manual stop insertion like Windows users have had for a while.

@galad87

galad87 commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

I know that there are use cases for an actually well implemented import/export. I was asking about a barely working implementation that works differently from the other UIs, and don't have any way to relink URLs.

P.S.: actually I implemented a way to insert a stop action in the Queue yesterday, it just needs to be committed ;)

@anandghegde

Copy link
Copy Markdown
Author

The relink gap is fair, and it's the one I'd like to fix here. Concretely: on import, run each job item's refreshSecurityScopedResources before adding it, collect the items whose bookmarks don't resolve, and offer to re-pick their source and destination (the same open panels the queue edit path already uses) or skip them — instead of what happens today, where an unresolvable item imports cleanly and then fails when it reaches the encode. That covers both the moved-file case and the copied-to-another-Mac case, and _fileURL/_destinationFolderURL already give the relink panel its starting point.

On "works differently from the other UIs" — worth being precise about what that difference is, because there's no queue format shared across the UIs today. WinGui exports its own QueueTask JSON (plus a CLI jobs JSON via ExportCliJson); the gtk UI has no queue export at all. The one common artifact any of them produce is the CLI jobs JSON, and I can add that as a second export format — but it's inherently one-way (CLI jobs carry no sandbox bookmarks and no queue state), so it's an interchange export, not a companion to import. The .hbqueue file is deliberately the same archive the MacGui already persists in Application Support, which is what lets import validate versions, reset item states to ready exactly like WinGui's ImportJson resets InProgress/Paused to Waiting, and append to the live queue. Same behavior contract as WinGui, different container.

If relink-on-import is what you want to see before this is mergeable, I'll do that next here — just say whether the CLI-jobs-JSON export belongs in scope too or is better kept out.

@anandghegde
anandghegde force-pushed the macgui-queue-import-export branch from 41b49b9 to bb28ac0 Compare October 5, 2026 11:42
@galad87

galad87 commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

The gtk UI queue can be loaded directly by the cli, because it uses the same format.

Anyway, we can start without json support, but it needs a couple thing:

  1. A relink window similar to the Final Cut Pro (see the attached screenshot) to relink sources/destinations when needed, because URLs will surely break often. A relink window would be useful even without the import/export feature.
  2. A way to select which items to import.
  3. Avoid crashing if HBJob changes in a non backward compatible way.
  4. The code should refactored and moved out from the existing classes as much as possible.
  5. Be not sloppy, my mind turns off when I have to review LLM generated code that makes no sense, or when I have to read a wall for text that contains no information.
Screenshot 2026-10-05 alle 15 46 29

@anandghegde

Copy link
Copy Markdown
Author

Point 5 is fair, and I am sorry.

I handed parts of this PR to an AI tool, and I pushed the result without a
proper review. That is why some of the code makes no sense, and why my earlier
text was long and empty. From now on I read every line before it goes up, and I
keep my comments short.

I shall start without JSON support, as you suggest.

On your list:

  • 2 and 4 — both are doable in this PR.
  • 3 — I shall write a version number into the archive, and refuse any newer
    version at import.
  • 1 — this is the open question. The relink window is a large piece of UI,
    and you say it is useful on its own. Which order do you prefer?
    • The relink window as a separate PR first, with import and export behind the
      same.
    • Import and export first, with a plain "skip the missing sources" path, and
      the relink window after that.

Kindly tell me the order and I shall follow the same.

And in case you feel this PR is too sloppy to carry forward at all, I am okay
if you close it. I would rather you close it than spend your time on code that
irritates you. In that case I shall start again from the relink window alone,
as a small PR, whenever you are open to it.

@galad87

galad87 commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Maybe doing the relink window first would be better.

@sr55 sr55 added the MacUI label Nov 9, 2026
Adds File > Relink Queue Items…, a sheet that lists the source files and
destination folders used by the pending queue items and lets the user
point missing ones to a new location. Jobs keep their settings.
Adds File > Import Queue… and Export Queue…, and an Export… item in the
queue contextual menu. Queue files carry their own version, and a sheet
lets the user choose which items to import. If the imported items point
to missing sources or destinations, the relink sheet is shown.
@anandghegde anandghegde mentioned this pull request Nov 10, 2026
1 of 3 tasks
@anandghegde
anandghegde force-pushed the macgui-queue-import-export branch from 6ff0282 to e015cc9 Compare November 10, 2026 12:51
@anandghegde

Copy link
Copy Markdown
Author

Reworked this, sorry for the delay.

The relink window is its own PR now, #8250, as suggested. This one is rebased on top of it and is down to just import/export in a single commit (no more merge commits). It also has the selection sheet on import, a version in the queue file, and the import/export code moved out to a seperate class. Description is updated too.

Probably easier to look at #8250 first.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

Please add the 'export queue' and 'import queue' functions in the macOS version.

4 participants