View Single Post
Old 12-19-2009, 11:52 AM   #1
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Firstname as author - metadata.db and SQLite3

I've got about 10,000 books imported into Calibre, and most were originally in the lastname, firstname - optional series name - title.ext format.

I customized the regex so the import (5 hours) went well, but now realize that I've inadvertently imported them as multiple author books where the firstname is a second author.

I'd like to fix this, but could use some suggestions.

I'm comfortable in SQL, and would like to simply run a query to change the author name in metadata.db from lastname| firstname to firstname lastname in the authors table.

However, I realize there are several problems doing that. First, there is the author_sort field in the books table that would also need to be fixed. That's pretty easy too.

The next issue is that the directory structure is now lastname_ firstname and it should be firstname lastname. That needs to be fixed in both the table and in the actual folder structure.

I've noticed that all this is handled automatically inside Calibre when the author is changed, so I'm wondering if I can change just the author field inside metadata.db, then run Calibre or python to fix the directory.

Alternatively, Does anyone have any suggestions for fixing this? I can manually change the database and folders, if necessary. Another alternative is to go back to the import (another 5 hours), but I wasn't sure if the regex would allow me to swap firstname and lastname using groups and \1 \2 etc.

Another possibility is to modify the names of the files, then reimport. Finally, I can possibly create an xml file from the names, use macros in ultraedit to fix the xml file, then import from the xml.

I'd appreciate some comments before I go forward.

Thanks!
Starson17 is offline   Reply With Quote