View Full Version : Plugin to fix author name


avantman42
03-16-2011, 06:58 AM
I've found that many (all?) of the books that I download from Amazon have the author name listed as lastname, firstname. Consequently, when adding the book to Calibre, I have to edit the author name and sort name.

Would it be possible to write a plugin that would fix the metadata in Calibre when author name is listed as lastname, firstname?

kiwidude
03-16-2011, 07:31 AM
I am not sure how you are adding your books, but have you tried the "Swap author firstname and lastname" option in Preferences->Adding books?

avantman42
03-16-2011, 07:46 AM
I am not sure how you are adding your books,

Usually I download them onto my Kindle, then add them to Calibre by plugging the Kindle in, viewing the books on Kindle, and copying them to the Calibre library.

have you tried the "Swap author firstname and lastname" option in Preferences->Adding books?

I haven't tried that :smack: I'll have to investigate, thanks.

avantman42
03-16-2011, 08:03 AM
I am not sure how you are adding your books, but have you tried the "Swap author firstname and lastname" option in Preferences->Adding books?

I just tried it with a sample, and it didn't seem to help. Whether that option was ticked or not, author name was shown as "Price, Willard".

One other point - if the option did work, it'd have to edit books not bought at Amazon, since it's only books bought from Amazon that have this issue.

DoctorOhh
03-16-2011, 08:46 AM
I just tried it with a sample, and it didn't seem to help. Whether that option was ticked or not, author name was shown as "Price, Willard".

The swap option only works if the data is read from the file name. The read metadata from file (next to it) would need to be unchecked.

One other point - if the option did work, it'd have to edit books not bought at Amazon, since it's only books bought from Amazon that have this issue.

I am confused what your "One other point" is, we change options to suit what we do in calibre all of time. The swap option does work when adding books reading their file name. I don't know if this can be done when adding books from the Kindle. The Quick Preferences Plugin (http://www.mobileread.com/forums/showthread.php?t=118764) allows quick on the fly changing of these settings, quite easily.

Update: This thread (http://www.mobileread.com/forums/showthread.php?t=116553) should help you change a bunch of these last, first names using the search and replace in the bulk metadata edit area.

Good Luck.

avantman42
03-16-2011, 10:05 AM
One other point - if the option did work, it'd have to edit books not bought at Amazon, since it's only books bought from Amazon that have this issue.

I am confused what your "One other point" is, we change options to suit what we do in calibre all of time.

I rarely change the options in Calibre, largely because I don't need to.

I was hoping that it would be simple to create a GUI plugin that would swap the first & last names in the author field when editing metadata.

It's not a big deal, I can copy/paste them the right way around.

kiwidude
03-16-2011, 10:18 AM
It is relatively simple to create a plugin to do this, but it would just duplicate functionality that exists using search/replace as per that link that dwanthny pointed you at. In a future version of the Quality Check plugin I may incorporate something like that.

There are already a bewildering away of GUI things related to authors - Search and Replace, the Manage Authors dialog, search queries and a tweak. It is a highly confusing and overly complicated part of Calibre imho. A user should be asked in the wizard when they first start Calibre whether they want to display their authors as FN LN or LN, FN, and have a flip author name menu/button for when they have imported it the wrong way around. Maybe I am just wishfully over-simplifying it.

avantman42
03-16-2011, 10:24 AM
have a flip author name menu/button for when they have imported it the wrong way around.

I may not have explained myself very well, but that's what I was hoping for. I check/edit the metadata whenever I add a book, so I don't need to do a mass update/fix. Basically, I was being lazy and looking for a simpler/better way than manually copying/pasting to correct the name.

kiwidude
03-16-2011, 10:47 AM
I think you explained yourself fine :) We just wanted to suggest ways of if possible of avoiding getting the author in the wrong order in the first place.

I would suggest you raise a feature request ticket for the edit metadata and bulk edit metadata dialogs and see what Kovid says about it. Personally while possible I don't believe a plugin menu would be a "convenient" enough general solution, and a plugin approach cannot be used to extend those dialogs.

DoctorOhh
03-16-2011, 10:48 AM
I may not have explained myself very well, but that's what I was hoping for. I check/edit the metadata whenever I add a book, so I don't need to do a mass update/fix. Basically, I was being lazy and looking for a simpler/better way than manually copying/pasting to correct the name.

I agree with you, having the ability to swap fn ln would be nice. If the First name and Last names were separate fields in the database this feature would already exist, but they exist in one field so accomplishing this feat is best (easiest) done on importing the book prior to placing those names in the database.

theducks
03-16-2011, 10:55 AM
I really think the place to fix this, would be the "Maintain Author Sort' area (of the Tag Browser) as this would fix all occurrences in 'Books', not just a single title.

kiwidude
03-16-2011, 10:59 AM
True, it would be a useful option to have there. However the Manage Authors dialog is one of the least discoverable dialogs in Calibre and suffers from a lack of find/filtering. Hitting Alt-A on a book to get all occurrences of the author and then E to bulk edit is a more natural route in my workflow.

Tegan
03-16-2011, 07:20 PM
I was just going to ask this exact same question under the exact same circumstances. The sort order is generally correct, so I've often wished that the button between the author and the author sort could be used to go either way (take the LN, FN in the sort order and generate FN LN in the author field). It wouldn't work for multiple authors, but it would be a help.

Anyway, lots of help in this thread, so thank you.