Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 12-06-2020, 04:27 PM   #1
un_pogaz
Chalut o/
un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.
 
un_pogaz's Avatar
 
Posts: 421
Karma: 145424
Join Date: Dec 2017
Device: Kobo
[GUI Plugin] Mass Search/Replace

Mass Search/Replace is a small plugin to facilitate the execution of one or more of your favorite Search and Replace operations to your books metadata.

Each entry in the context menu will launch a list of Search/Replace operations that you have previously set up. Setting up an operation uses the Calibre Search and Replace module.

The plugin has the following features:
  • Editable context menu
  • Editables operations list
  • Error Strategy
  • Quick Search/Replace on various range: Selection, Current Search, Virtual library, Library.
  • Shared Search/Replace operation: set in once, used where you want, edit them and all reference has edited (compatible with Calibre saved Search/Replace system)

Available operation type:
  • Character match
  • Regular expression
  • Replace field

To use a "Shared Search/Replace operation", create and save a operation in the Calibre combo box, or select one that already exist.
Important, don't edit any field after having select the "Shared operation" or the link will be broken. To edit a "Shared operation", it will have to be re-registered with the same name in the Calibre saved Search/Replace system.
Once the "Shared operation" corrrectly save, the name of this one will appear in operations list.

Special Notes:
  • Uses the Calibre Search/Replace module.
  • You can destroy your library using this plugin. Changes are permanent. There is no undo function. You are strongly encouraged to back up your library before proceeding.

Credits:
  • The icon dialog and the dynamic menus for chains are based on code from the Open With plugin by kiwidude.
  • The Calibre Actions is based on code from the Favourites Menu plugin by kiwidude.
  • The module editor is based on calibre editor function editor by Kovid Goyal.
  • The Search and Replace Action is based on calibre's search and replace. (chaley and Kovid Goyal)
  • Thanks to capink and its plugin Action Chains without which this one wouldn't exist.

Installation
Open Preferences -> Plugins -> Get new plugins and install the "Mass Search/Replace" plugin.
You may also download the attached zip file and install the plugin manually, then restart calibre as described in the Introduction to plugins thread

The plugin works for Calibre 5 and later.

Page: GitHub | MobileRead

Note for those who wish to provide a translation:
I am French! Although for obvious reasons, the default language of the plugin is English, keep in mind that already a translation.

Version History:
Spoiler:
version 1.8.2 - 2024/02/19
Bug fixes
  • Fix some untranslated string

version 1.8.1 - 2024/01/27
Bug fixes
  • Fix wrong text display when customizing keyboard shortcut

version 1.8.0 - 2023/11/17
Changed
  • Drop Python 2 / Calibre 4 compatibility, only Calibre 5 and above

version 1.7.5 - 2023/10/07
Bug fixes
  • Fix NotImplementedError: set() cannot be used in this context. ProxyMetadata is read only

version 1.7.4 - 2023/09/31
Bug fixes
  • Don't update the config file when Calibre start

version 1.7.3 - 2023/05/31
Bug fixes
  • Fix columns list not the same as Calibre

version 1.7.2 - 2023/04/12
Bug fixes
  • Fix active statue of Shared Search/Replace operation not conserved (always active)

version 1.7.1 - 2023/02/03
Bug fixes
  • Fix broken compatibility with 6.12 (use a icon instead of a red border to warn about a regex error)

version 1.7.0 - 2022/10/19
Changed
  • Again, big rework of common_utils (use submodule)

version 1.6.1 - 2022/10/17
Bug fixes
  • Fix a error when a user categorie exist in the library

version 1.6.0 - 2022/10/11
Changed
  • Big rework of common_utils.py

version 1.5.1 - 2022/09/08
Bug fixes
  • Fix a bug where the books are marked, even if an error has occurred in restore books
  • Icon not display when a theme colors is used

version 1.5.0 - 2022/08/17
Changed
  • Rework of the Quick Search/Replace for add alternatives range target (Selection / Current Search / Virtual library / Library)

version 1.4.5 - 2022/08/06
Changed
  • Improvement of the 'Replace Field' mode

version 1.4.4 - 2022/07/20
Changed
  • Small incompatibility Calibre6/Qt6

version 1.4.3 - 2022/07/11
Changed
  • More compatibility Calibre6/Qt6

version 1.4.2 - 2022/03/11
Changed
  • Small improvement for identifier operation

version 1.4.1 - 2022/02/25
Bug fixes
  • Calibre Search/Replace operation are not saved if it contains an error

version 1.4.0 - 2022/02/25
Added
  • Shared Search/Replace operation: set in once, used where you want, edit them and all reference has edited
    Uses and compatible with Calibre saved Search/Replace system

version 1.3.3 - 2022/02/24
Bug fixes
  • Fix the fix of Calibre saved Search/Replace operation

version 1.3.2 - 2022/02/23
Bug fixes
  • The Calibre saved Search/Replace operation could not be loaded

version 1.3.1 - 2022/02/22
Changed
  • Various technical improvement

version 1.3.0 - 2022/01/04
Changed
  • Compatible Calibre6/Qt6

version 1.2.2 - 2021/07/01
Bug fixes
  • Fix wrong error message when an error occurs during the update of the library

version 1.2.1 - 2021/06/08
Bug fixes
  • Fix ghost identifier with empty value

version 1.2.0 - 2021/05/28
Added
  • Add a 'Replace Field' mode that replace any values with the specified string
Bug fixes
  • Fix freeze when your config the settings of operations when many books are selected
  • Fix the displaying of a error in dialog

version 1.1.0 - 2021/05/25
Bug fixes
  • Improved handling of errors with invalid identifiers

version 1.0.2 - 2021/05/16
Bug fixes
  • Fix invalide identifier with colon

version 1.0.1 - 2021/02/12
Bug fixes
  • Fix error in search mode "Character match"

version 1.0.0 - 2021/01/18
Full release
Bug fixes
  • Fix regression with case sensitivity

version 0.9.3 - 2020/12/08
Added
  • Add Spanish translation. Thanks dunhill

version 0.9.2 - 2020/12/08
Bug fixes
  • Fix case for the test result field
  • Fix detection of None and inchanged value

version 0.9.1 - 2020/12/07
Bug fixes
  • Fix library switch

version 0.9.0 - 2020/12/06
First release
  • Beta public test
Attached Thumbnails
Click image for larger version

Name:	config-menu.png
Views:	1460
Size:	51.3 KB
ID:	183821   Click image for larger version

Name:	config-operation.png
Views:	1351
Size:	29.6 KB
ID:	183822   Click image for larger version

Name:	search-replace.png
Views:	989
Size:	58.8 KB
ID:	187555   Click image for larger version

Name:	context2.png
Views:	531
Size:	64.4 KB
ID:	195990  
Attached Files
File Type: zip Mass Search-Replace-1.8.2.zip (440.4 KB, 13065 views)

Last edited by un_pogaz; 02-19-2024 at 11:28 AM.
un_pogaz is offline   Reply With Quote
Old 12-06-2020, 04:28 PM   #2
un_pogaz
Chalut o/
un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.
 
un_pogaz's Avatar
 
Posts: 421
Karma: 145424
Join Date: Dec 2017
Device: Kobo
reserverd for futur usage

Last edited by un_pogaz; 01-18-2021 at 12:55 PM.
un_pogaz is offline   Reply With Quote
Advert
Old 12-07-2020, 11:03 AM   #3
jjk
Enthusiast
jjk began at the beginning.
 
Posts: 46
Karma: 10
Join Date: Aug 2018
Location: Paris (France)
Device: Kobo Kindle Vivlio-Inkpad3
Hello un_pogaz
Thanks for your plugin. I've just tried it a little. (on Calibre 5.6)
In fields=authors, I search "Cam" and replace it by "CAM", case-sensitive, type=car. match (not regex).
Casse to apply to each replace = All in CAPS

I select some books from Camilla Lackberg, and other ones. For each of those selected books, authors are Camilla Lackberg, or Jack London..., ie initials in CAPS (MAJUSCULES), other letters not in CAPS (so minuscules)

When I apply MSR plugin, all authors become all in CAPS (CAMILLA LACKBERG, JACK LONDON...), although I thought that they would become CAMilla Lackberg, Jack London ... because I had precised only Cam/CAM in S/R fields.

In a second time, to try to repare it, I put : Casse to apply to replace = Majuscule à chaque mot (I'm French also), and still S/R=Cam/CAM.
Result : CamILLA LACKBERG, Jack London
I don't understand the whole logic.

That is all my test for the moment.

Anyway, your plugin is promising. Cheers.
jjk is offline   Reply With Quote
Old 12-07-2020, 12:26 PM   #4
un_pogaz
Chalut o/
un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.
 
un_pogaz's Avatar
 
Posts: 421
Karma: 145424
Join Date: Dec 2017
Device: Kobo
Si t'est français, met ton texte en français dans un Spoiler, et traduit traduit normalement pour le mesage publique.

Spoiler:
Je rappel que j'ai utilisé le module de Calibre telle quelle, et je peut difficilement le "corrigé". Aussi, il est difficile a mettre en tort, encore faut-il comprendre ça logique.

Pour le premier cas:
Apparemment dans type=car. match (not regex), Calibre applique la "CASE applique sur le remplacement" dans tous les cas. Il ne faut vraiment l'utilisé qu'avec parcimonie.
Dans votre cas, il aurait fallut gardé "Casse a appliqué" vide.
Le case-sensitive ne marche que pour la recherche : Cam/cam/cAm => CAM

Pour second cas:
Ça ressemble plus un bug de Calibre. Signale-le en temps que telle, je vais voir de mon coté ce que je peut faire.
En gros, la Casse n'est appliqué normalement que pour le texte de remplacement, le reste est copier telle quelle.
Mais dans le cas où le texte cherchée n'est pas trouvé, il capture tous et applique la Casse.
(CAM)ILLA LACKBERG, (JACK LONDON) => (Cam)ILLA LACKBERG, (Jack London)
Seul le texte entre parenthèse voit ça Casse changé.

A la réflexion, le modificateur de Casse n'e doit être utilisé que pour du Regex.


EDIT: Après avoir regardé, s'est bien le comportement attendu.
Le seul bug est que, en mode "Correspondance de caractères", la Casse n'est pas correctement appliqué dans le champs de test. J'ai corrigé et reporté le bug.


I remind you that I used the Caliber module as is, and I can hardly "correct" it. Also, it is difficult to blame it, but it is still necessary to understand that logic.

For the first case:
Apparently in type=car. match (not regex), Calibre applies the "CASE applies on replacement" in all cases. It should really be used sparingly.
In your case, you should have kept "Case applied" empty.
The case-sensitive only works for search : Cam/cam/cAm => CAM

For second case:
It looks more like a Caliber bug. Report it as such, I'll see what I can do.
Basically, the Case is normally applied only for the replacement text, the rest is copied as is.
But if the text you are looking for is not found, it captures all of it and applies the Casse.
(CAM)ILLA LACKBERG, (JACK LONDON) => (Cam)ILLA LACKBERG, (Jack London)
Only the text in brackets sees that Case changed.

On second thought, the Casse modifier should only be used for Regex.

EDIT: After look, this is expected behaviour.
The only bug is, in "Character Matching" mode, the box is not correctly applied in the test field. I have corrected and reported the bug.

Last edited by un_pogaz; 12-07-2020 at 02:09 PM.
un_pogaz is offline   Reply With Quote
Old 12-07-2020, 03:04 PM   #5
jjk
Enthusiast
jjk began at the beginning.
 
Posts: 46
Karma: 10
Join Date: Aug 2018
Location: Paris (France)
Device: Kobo Kindle Vivlio-Inkpad3
Ok. Sorry, I hadn't seen that it was an internal Calibre feature. And thanks for postponing the bug.
Spoiler:
Désolé, je n'avais pas vu que c'était une fonctionnalité interne à Calibre. Et merci d'avoir reporté le bug.
jjk is offline   Reply With Quote
Advert
Old 12-08-2020, 01:20 PM   #6
dunhill
Guru
dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.
 
dunhill's Avatar
 
Posts: 774
Karma: 340954
Join Date: Sep 2017
Location: Argentina
Device: moon+ reader, kindle paperwhite
Couldn't upload po and mo on GitHub
With your permission I upload them here.
Excelent travail!!
Attached Files
File Type: zip translations spanish.zip (9.8 KB, 439 views)
dunhill is offline   Reply With Quote
Old 12-08-2020, 04:29 PM   #7
un_pogaz
Chalut o/
un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.
 
un_pogaz's Avatar
 
Posts: 421
Karma: 145424
Join Date: Dec 2017
Device: Kobo
Thanks o/
un_pogaz is offline   Reply With Quote
Old 01-17-2021, 07:41 PM   #8
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,139
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
Here is another fix by Kovid. You might want to include that into your plugin.
capink is offline   Reply With Quote
Old 01-18-2021, 12:57 PM   #9
un_pogaz
Chalut o/
un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.
 
un_pogaz's Avatar
 
Posts: 421
Karma: 145424
Join Date: Dec 2017
Device: Kobo
Quote:
Originally Posted by capink View Post
Here is another fix by Kovid. You might want to include that into your plugin.
Thanks, fixed.

Also, I think the development is stable enough for this stage:
New version 1.0.0
Full release
Fix regression with case sensitivity
un_pogaz is offline   Reply With Quote
Old 06-08-2021, 05:40 AM   #10
un_pogaz
Chalut o/
un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.
 
un_pogaz's Avatar
 
Posts: 421
Karma: 145424
Join Date: Dec 2017
Device: Kobo
Lot of little thing, but the 1.2.0 has a significant addition:
  • Add a 'Replace Field' mode that replace any values with the specified string.
This mode is an extension/edit of the caliber's search and replace module, and was made to facilitate the editing of a field with a predefined values without the headache of a complex regex.
Attached Thumbnails
Click image for larger version

Name:	replace-field.png
Views:	505
Size:	40.3 KB
ID:	187559  
un_pogaz is offline   Reply With Quote
Old 02-25-2022, 05:05 PM   #11
un_pogaz
Chalut o/
un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.
 
un_pogaz's Avatar
 
Posts: 421
Karma: 145424
Join Date: Dec 2017
Device: Kobo
Version 1.4.0
Shared Search/Replace operation: set in once, used where you want, edit them and all reference has edited (compatible with Calibre saved Search/Replace system)

To use a "Shared Search/Replace operation", create and save a operation in the Calibre combo box, or select one that already exist.
Important, don't edit any field after having select the "Shared operation" or the link will be broken. To edit a "Shared operation", it will have to be re-registered with the same name in the Calibre saved Search/Replace system.
Once the "Shared operation" corrrectly save, the name of this one will appear in operations list.

Last edited by un_pogaz; 02-25-2022 at 05:11 PM.
un_pogaz is offline   Reply With Quote
Old 08-29-2022, 03:34 PM   #12
Rellwood
Library Breeder (She/Her)
Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.
 
Rellwood's Avatar
 
Posts: 1,192
Karma: 1900479
Join Date: Apr 2015
Location: Fullerton, California
Device: Kobo Aura HD (1) PW3 (4) PW3 2019 new edition (1)
Just and FYI, the icon for the plugin isn't rendering anymore. I tried to replace it in the folder and reinstalled, but it still won't render. I suspect that whatever line in the plugin instructions that indicate the icon has changed and won't point to it anymore. Can someone check it?
Rellwood is offline   Reply With Quote
Old 08-29-2022, 09:11 PM   #13
dunhill
Guru
dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.
 
dunhill's Avatar
 
Posts: 774
Karma: 340954
Join Date: Sep 2017
Location: Argentina
Device: moon+ reader, kindle paperwhite
Quote:
Originally Posted by Rellwood View Post
Just and FYI, the icon for the plugin isn't rendering anymore. I tried to replace it in the folder and reinstalled, but it still won't render. I suspect that whatever line in the plugin instructions that indicate the icon has changed and won't point to it anymore. Can someone check it?
In linux it is in the toolbar
Attached Images
 
dunhill is offline   Reply With Quote
Old 08-31-2022, 05:21 PM   #14
Rellwood
Library Breeder (She/Her)
Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.
 
Rellwood's Avatar
 
Posts: 1,192
Karma: 1900479
Join Date: Apr 2015
Location: Fullerton, California
Device: Kobo Aura HD (1) PW3 (4) PW3 2019 new edition (1)
I have Windows 10 and since the last update (plugin or Calibre - I don't remember)


Also, is there any way that the plugin can offer the choice of books (all library, virtual library or selected books) for all the options, not just the quick search?
Attached Thumbnails
Click image for larger version

Name:	Screenshot - 8_31_2022 , 1_15_45 PM.jpg
Views:	243
Size:	8.1 KB
ID:	196188  
Rellwood is offline   Reply With Quote
Old 09-01-2022, 04:17 AM   #15
un_pogaz
Chalut o/
un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.
 
un_pogaz's Avatar
 
Posts: 421
Karma: 145424
Join Date: Dec 2017
Device: Kobo
Also Windows 10, no problem.
Please, share a debug log and/or your versions of Mass Search/Replace and Calibre, so I can understand where your problem comes from.
Attached Thumbnails
Click image for larger version

Name:	Capture d’écran 2022-09-01 091055.png
Views:	228
Size:	18.1 KB
ID:	196207  
un_pogaz is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[GUI Plugin] Search the Internet kiwidude Plugins 434 09-30-2024 04:04 AM
[GUI Plugin] Clipboard Search kiwidude Plugins 29 04-02-2024 11:05 PM
[GUI Plugin] Drop Search Results DaltonST Plugins 29 07-11-2022 02:03 AM
Mass search and replace word in epub Fangles Library Management 4 07-26-2016 06:23 PM


All times are GMT -4. The time now is 11:08 PM.


MobileRead.com is a privately owned, operated and funded community.