View Single Post
Old 07-19-2018, 11:44 AM   #4
andrewferguson
Junior Member
andrewferguson began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Jul 2018
Device: Android
So I've written a quick python script that should fix this for you.

Firstly, before you do ANYTHING, back up your Calibre books. I take no responsibility for any data loss that arises out of using the script. Although it worked fine on my library when I tested it a few minutes ago, you can never be too safe.

Then download the file fixcal.py (attached to this reply), open up a terminal or command-prompt, then run it either using python (e.g: python fixcal.py) or using calibre-debug (e.g: calibre-debug fixcal.py) if you don't have Python. This should not alter any of your books, but will instead print out a list of all books that contain the title of the book in the tags of the book. Check this output to ensure that the script isn't behaving funny, and if you're not sure if it is right, double-check before going any further.

Once you are happy that the script will be modifying the tags of the right books, run the script again, this time adding the "overwrite" option, eg: python fixcal.py overwrite / calibre-debug fixcal.py overwrite . This will actually modify the tags of the books to remove the title from the tag list.

Note: The script *doesn't* check just the first or last tag for the title, it checks them all. So if this isn't what you want (say, if you have the title in the tags of the book but it's the third tag in and you want to keep this tag) reply and I'll update the script for this.

Let me know how you get on..... and remember to backup your books first!
Attached Files
File Type: py fixcal.py (550 Bytes, 195 views)
andrewferguson is offline   Reply With Quote