Skip to content

Bulk Metadata Editing#1184

Open
jaroslawjanas wants to merge 12 commits intociromattia:masterfrom
jaroslawjanas:metadata-editor-in-bulk
Open

Bulk Metadata Editing#1184
jaroslawjanas wants to merge 12 commits intociromattia:masterfrom
jaroslawjanas:metadata-editor-in-bulk

Conversation

@jaroslawjanas
Copy link
Contributor

Bulk Metadata Editing

Motivation

If you've ever had to update metadata for a whole series, fixing an author's name across 20 volumes.
You know how tedious it can be. Opening each file individually, making the same change over and over... it gets old fast.
Also it pisses me off.

This PR introduces bulk metadata editing to solve that problem.
Select multiple files, edit the common fields once, and apply changes to all of them in one go.

As I worked on this, it became clear that volume numbers would also benefit from bulk editing.
Adding volume metadata to a series usually follows a pattern (1, 2, 3...), so I extended the feature to support that as well.

Changes

  • Multi-file selection in metadata editor - select multiple comic files to edit their metadata simultaneously
  • Bulk editing - edit series, writer, penciller, inker, and colorist fields acros all selected files at once
  • Bulk volume - enable with a checkbox, then assign volume numbers with:
    • Single number (5) - generates a sequence starting from that number (5, 6, 7...)
    • Range (1-10) - expands to volumes 1 through 10
    • Comma list (1, 3, 5) - assigns specific volume numbers
  • File sorting - files are sorted by name before volume assignment
  • Count validation - ensures the number of volume values matches the number of selected files
  • Rich HTML tooltip - hovering over the volume checkbox displays explanation of input options
  • Status - status label shows which file is being processed
image image image image

Why are Title and Number disabled?

In bulk mode, the Title and Number fields are intentionally disabled because these are typically unique to each file:

  • Title - each volume usually has its own title (e.g., "Chapter 1", "The Beginning")
  • Number - issue/chapter numbers are inherently per-file values

* Enable multi-file selection in Metadata Editor using getOpenFileNames()

* Disable Volume, Number, and Title fields in bulk mode

* Pre-fill Series and author fields from first selected file in bulk mode

* Show status "Editing Y files" in bulk mode

* Add progress display during bulk save ("Processing X/Y: filename")

* Disable buttons during processing

* Skip read-only CBR files with error collection

* Show error summary dialog if any files fail to save

* Keep single file metadata editing the same
* Add checkbox next to Volume field for enabling bulk volume editing (only in bulk mode)

* Support single number (5), range (1-10), or comma list (1, 3, 5) input formats

* Sort files alphabetically before volume assignment

* Validate that volume count matches file count

* Add rich HTML tooltip explaining the feature
* Define bulkVolumeCheck QCheckBox in MetaEditor.ui instead of creating it programmatically in KCC_gui.py

* Update tab order to include bulkVolumeCheck after volumeLine
@kiryl85
Copy link
Contributor

kiryl85 commented Dec 5, 2025

@jaroslawjanas what about bulk editing for directories?

@jaroslawjanas
Copy link
Contributor Author

@jaroslawjanas what about bulk editing for directories?

Never used it in such a way, is it even possible to edit a single directory?
It doesn't seem work for me for a single dir.

@kiryl85
Copy link
Contributor

kiryl85 commented Dec 5, 2025

Yes, it is. Hover over editor button for few seconds. Shift + click

@jaroslawjanas
Copy link
Contributor Author

@kiryl85
So just to be clear, when we are talking about bulk editing for directories we mean the Volumes yes?

Series Name/
  ├─ Volume 1/
  │   ├─ ComicInfo.xml
  │   └─ page001.jpg, page002.jpg...
  ├─ Volume 2/
  │   ├─ ComicInfo.xml
  │   └─ page001.jpg, page002.jpg...
  └─ Volume 3/
      ├─ ComicInfo.xml
      └─ page001.jpg, page002.jpg...

So the selection would be e.g. (Volume 1, Volume 2), and not Series Name

In addition to that, we will have to completely abandon using the native dialog.

# Multi-directory selection for bulk editing ComicInfo.xml
dialog = QFileDialog(MW, 'Select volume directories', self.lastPath)
dialog.setFileMode(QFileDialog.FileMode.Directory)
dialog.setOption(QFileDialog.Option.ShowDirsOnly, True)
dialog.setOption(QFileDialog.Option.DontUseNativeDialog, True)  # <--

So instead:
image
We will get:
image

That's because to the best of my knowledge the native dialog does not seem to support selecting multiple directories.
At least in my testing I couldn't figure it out.
And even if we do figure it out I am not sure if it will work consistently across platforms.

Personally I am not opposed to the idea of using the built-in dialog, it looks okay.

@axu2
Copy link
Collaborator

axu2 commented Dec 8, 2025

So the selection would be e.g. (Volume 1, Volume 2), and not Series Name

Yes

That's because to the best of my knowledge the native dialog does not seem to support selecting multiple directories.
At least in my testing I couldn't figure it out.

You are correct, that was why the "Add directory" button was removed because of the single folder limitation was too annoying. I didn't realize I could have just changed to the built in picker. @Silver0006

That Qt build in one looks not bad honestly. I'll try to review the code sometime soon.

@jaroslawjanas
Copy link
Contributor Author

That Qt build in one looks not bad honestly. I'll try to review the code sometime soon.

Well I haven't pushed the changes for editing directories in bulk yet. Give me some more time, I want to look over them some more - I am really not that familiar with KCC itself and Qt.

I'll tag you.

@kiryl85
Copy link
Contributor

kiryl85 commented Dec 8, 2025

@jaroslawjanas
hmm, I haven't noticed that adding directories is actually supported only by Drag&Drop, sorry for that :/

Right now metadata editor can be opened by doubleclick on an item on the jobList, either it is a file or a directory.
I was thinking about adding multiselect to jobList widget, that would allow to select many items and open them in bulk edit :)

One more thing, directory structure could be also similar to this

Series Name/
  ├─ Volume 1/
  │   ├─ Chapter 01/
  │   │   ├─  ComicInfo.xml
  │   │   └─ page001.jpg, page002.jpg...
  │   ├─ Chapter 02/
  │   │   ├─  ComicInfo.xml
  │   │   └─ page001.jpg, page002.jpg...
  │   └─ Chapter 03/
  │        ├─  ComicInfo.xml
  │        └─ page001.jpg, page002.jpg...
...
  ├─ Volume 3/
  │   ├─ Chapter 07/
  │   │   ├─  ComicInfo.xml
  │   │   └─ page001.jpg, page002.jpg...
  │   ├─ Chapter 08/
  │   │   ├─  ComicInfo.xml
  │   │   └─ page001.jpg, page002.jpg...
  │   └─  Chapter 09/
  │        ├─  ComicInfo.xml
  │        └─ page001.jpg, page002.jpg...
...

and user would be adding chapters instead

@jaroslawjanas
Copy link
Contributor Author

@jaroslawjanas hmm, I haven't noticed that adding directories is actually supported only by Drag&Drop, sorry for that :/

I don't understand what you mean.

Right now metadata editor can be opened by doubleclick on an item on the jobList, either it is a file or a directory. I was thinking about adding multiselect to jobList widget, that would allow to select many items and open them in bulk edit :)

Same logic, different input sources. Let's do the Metadata Editor first and then if you want you can add bulk-editing in the job list in another PR. Personally I dislike it. How would you double-click a multi selection? You'd need a button. It just gets messy.
I think we should follow a Separation of Concerns approach here - I'd argue that bulk metadata editing has no place in a job queue.

One more thing, directory structure could be also similar to this

Series Name/
  ├─ Volume 1/
  │   ├─ Chapter 01/
  │   │   ├─  ComicInfo.xml
  │   │   └─ page001.jpg, page002.jpg...
  │   ├─ Chapter 02/
  │   │   ├─  ComicInfo.xml
  │   │   └─ page001.jpg, page002.jpg...
  │   └─ Chapter 03/
  │        ├─  ComicInfo.xml
  │        └─ page001.jpg, page002.jpg...
...
  ├─ Volume 3/
  │   ├─ Chapter 07/
  │   │   ├─  ComicInfo.xml
  │   │   └─ page001.jpg, page002.jpg...
  │   ├─ Chapter 08/
  │   │   ├─  ComicInfo.xml
  │   │   └─ page001.jpg, page002.jpg...
  │   └─  Chapter 09/
  │        ├─  ComicInfo.xml
  │        └─ page001.jpg, page002.jpg...
...

and user would be adding chapters instead

What's the current behaviour if we select single Volume 1 with chapters?
What about if you select Volume 1 with chapters but all the ComicInfo.xml are missing.

* Shift+click on editor button now opens multi-directory selection dialog
* Multiple directories enable bulk mode with volume number assignment
* Uses Qt's built-in dialog with multi-selection enabled for native look and feel
Copilot AI review requested due to automatic review settings December 10, 2025 02:07
@jaroslawjanas
Copy link
Contributor Author

jaroslawjanas commented Dec 10, 2025

Okay so I did apply the change for directory bulk editing, it simply changes the dialog to the Qt's native.
Additionally I realized that both cases below are actually identical:

Series Name/
  ├─ Volume 1/
  │   ├─ Chapter 01/
  │   │   ├─  ComicInfo.xml
  │   │   └─ page001.jpg, page002.jpg...
  │   ├─ Chapter 02/
  │   │   ├─  ComicInfo.xml
  │   │   └─ page001.jpg, page002.jpg...
  │   └─ Chapter 03/
  │        ├─  ComicInfo.xml
  │        └─ page001.jpg, page002.jpg...
...
  ├─ Volume 3/
  │   ├─ Chapter 07/
  │   │   ├─  ComicInfo.xml
  │   │   └─ page001.jpg, page002.jpg...
  │   ├─ Chapter 08/
  │   │   ├─  ComicInfo.xml
  │   │   └─ page001.jpg, page002.jpg...
  │   └─  Chapter 09/
  │        ├─  ComicInfo.xml
  │        └─ page001.jpg, page002.jpg...
...

I mean the user can always go inside the Volume 1 folder and bulk-edit the chapters, it's the same logic.
The only difference is that I need to add the option to bulk-edit the Number field - right now that's only possible for Volume.

I'd rather not add any fancy dynamic structure detection especially one that assumes that ComicInfo.xml exists.

Would you say this is a satisfactory solution?
@kiryl85

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces bulk metadata editing functionality to the Kindle Comic Converter, allowing users to edit metadata for multiple comic files simultaneously. The feature addresses the tedious task of updating metadata across entire series by enabling multi-file selection and batch processing.

Key changes include:

  • Multi-file selection support in the metadata editor (both file and directory modes)
  • Bulk editing of common metadata fields (series, writer, penciller, inker, colorist)
  • Flexible bulk volume number assignment with three input formats: single number sequences, ranges, and comma-separated lists

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 13 comments.

File Description
kindlecomicconverter/KCC_ui_editor.py Adds bulk volume checkbox UI component with rich tooltip and updates tab order
kindlecomicconverter/KCC_gui.py Implements multi-file selection dialogs, bulk mode logic, volume parsing, and batch save operations
gui/MetaEditor.ui Defines checkbox widget properties and layout in the UI XML definition

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

* Handle invalid range formats like "1-2-3" or "--" that previously fell through, now returns an error message

* Add explicit check for empty/malformed range parts before attempting to parse

* Add positive number validation for all input types (range, comma-list, single number) to be consistent with single file mode which uses isnumeric()

* Add explicit validation for empty volumes list after parsing
* Check all files for CBR format during load instead of during save

* Unify the CBR check for single and bulk mode
* In bulk mode, compare Series + Writer/Penciller/Inker/Colorist across all selected files (instead of using only the first file)

* When values differ, show “(multiple values)” placeholder for that field

* Add hover tooltip with overwrite warning and a File|Value table (or Value|Count summary when there are >20 files)
@jaroslawjanas
Copy link
Contributor Author

jaroslawjanas commented Dec 12, 2025

This is a continuation to #1184 (comment) please check it too.

Okay so now I know what Automatic Copilot code review does and I am never enabling it again.
With that said some of the suggestions were spot on.


Miscellaneous

  • Fixed volume parsing and validation
  • Error handling
  • Keep the dialog open for error messages

CBR Handling

If there are any CBR files in the bulk we just disable the editing, same as in single file mode.

image

Mixed Metadata Values

So I quite liked this suggestion and I took my time with it trying to plan it out properly.
I don't quite like just leaving the user with (mixed values) now go and figure out which of the 30 files it is.

Instead I dynamically create a tooltip for that mixed field that shows (up to 20) rows and their values for that field (if mixed).
If there are too many rows, I simply show the values and the counts. Sorry not sorry but the user can just go in bulks of 20 to see details.

image image

Notes

I kept some comments but removed all the ones that seems useless since the repo's vibe seems to be code is enough, comment at your own risk which I think is a good enough approach for projects like this one.

With that said the ' and " are a mess and used interchangeably throughout the file so... I'll just add to this problem and leave for someone else to fix if they have the patience.

AI Tool Assistance Disclosure

This PR was developed with assistance from Claude Code using Opus 4.5. All generated code was reviewed, tested, and adjusted by a human developer.

Don't hate the player, hate the game.


@axu2 @kiryl85

Please have a look.
I put a lot of work into this so please be gentle with the critique - I can handle it just please be gentle with me.
I didn't encounter any errors or unexpected behaviours in my testing but I might have missed something.
This is a big enough change so if you could play with it yourself to make sure it works that would be great, thanks.

jaroslawjanas and others added 3 commits December 13, 2025 00:47
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 5 to 6.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@v5...v6)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@jaroslawjanas
Copy link
Contributor Author

Any update on the review of this?

@axu2
Copy link
Collaborator

axu2 commented Feb 5, 2026

Ah sorry, this PR is a lot larger than I expected so I kept putting it off. I've been a bit more focused on bug squashing over new features recently. I will get to it at some point, but no timeline set.

@jaroslawjanas
Copy link
Contributor Author

jaroslawjanas commented Feb 5, 2026

Ah sorry, this PR is a lot larger than I expected so I kept putting it off. I've been a bit more focused on bug squashing over new features recently. I will get to it at some point, but no timeline set.

All good. Just making sure it's still in the queue.
Just tag me when you get around to it. I am not in hurry.

@axu2
Copy link
Collaborator

axu2 commented Feb 5, 2026

I don't mess with metadata myself, but my perception is that people use ComicTagger for bulk editing, was that not sufficient for your use case?

@jaroslawjanas
Copy link
Contributor Author

I had no idea it existed.

Most of the time I don't really care about detailed metadata.
But when for examples Volumes are missing or Title is ugly it's a bit of a pain.

We already have a Metadata Editor why not give it an upgrade?
I may be biased.

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.

3 participants