Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 01-22-2011, 10:05 PM   #1
Barriemackenzie
Junior Member
Barriemackenzie began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Jan 2011
Device: SONY PRS-505
Reverse Ln, Fn?

I have just imported all my books into Calibre and unfortunately some but not all of the author names are written 'Smith, John' and Calibre is assuming that John is the last name and sorting by John. I cannot see anyway to rectify this without individually editing all the names. Is there a script/plugin to do this?
Barriemackenzie is offline   Reply With Quote
Old 01-23-2011, 01:13 AM   #2
garcle
Connoisseur
garcle has a complete set of Star Wars action figures.garcle has a complete set of Star Wars action figures.garcle has a complete set of Star Wars action figures.garcle has a complete set of Star Wars action figures.garcle has a complete set of Star Wars action figures.
 
garcle's Avatar
 
Posts: 54
Karma: 442
Join Date: Oct 2010
Location: Detroit
Device: iPad
Quote:
Originally Posted by Barriemackenzie View Post
I have just imported all my books into Calibre and unfortunately some but not all of the author names are written 'Smith, John' and Calibre is assuming that John is the last name and sorting by John. I cannot see anyway to rectify this without individually editing all the names. Is there a script/plugin to do this?
How is your Regex knowledge?

The "simple" way to do this is to select ONLY the books that have the authors first and last names reversed, and perform a bulk metadata edit (press the E key after Ctrl Selecting the books you want to fix).

Then Go to the Search and Replace Tab.
Select [Authors] in the Search Field
Select [Regular Expression] in the Search Mode drop-down Field.
In the Search for: field enter (.*), (.*)
In the Replace with: field enter \2 \1

(check in the Test results table that the expected reversal will take place)

Make sure you have selected ONLY the books with the reversed names!
Make Sure you have backed up your library !!
Cross your fingers

Then Click OK

Calibre will update the Author-Sort field automagically at the same time.

The regular expression shown (.*), (.*) will only work for authors that are entered as LastName, FirstName i.e. it expects one comma and one space between a single last name and (one or more) first name(s).
garcle is offline   Reply With Quote
Old 01-23-2011, 02:47 AM   #3
unboggling
Wizard
unboggling ought to be getting tired of karma fortunes by now.unboggling ought to be getting tired of karma fortunes by now.unboggling ought to be getting tired of karma fortunes by now.unboggling ought to be getting tired of karma fortunes by now.unboggling ought to be getting tired of karma fortunes by now.unboggling ought to be getting tired of karma fortunes by now.unboggling ought to be getting tired of karma fortunes by now.unboggling ought to be getting tired of karma fortunes by now.unboggling ought to be getting tired of karma fortunes by now.unboggling ought to be getting tired of karma fortunes by now.unboggling ought to be getting tired of karma fortunes by now.
 
Posts: 1,065
Karma: 858115
Join Date: Jan 2011
Device: Kobo Clara, Kindle Paperwhite 10
Quote:
Originally Posted by garcle View Post
How is your Regex knowledge?

The "simple" way to do this is to select ONLY the books that have the authors first and last names reversed, and perform a bulk metadata edit
garcle, I sure wish I knew that a couple weeks ago. lol.
unboggling is offline   Reply With Quote
Old 01-23-2011, 08:40 AM   #4
Barriemackenzie
Junior Member
Barriemackenzie began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Jan 2011
Device: SONY PRS-505
OMG! that is amazing! Worked like a treat. Thanks Garcle
Barriemackenzie is offline   Reply With Quote
Old 02-23-2011, 01:10 PM   #5
AlanY
Member
AlanY began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Feb 2011
Device: kindle
Quote:
Originally Posted by garcle View Post
How is your Regex knowledge?

The "simple" way to do this is to select ONLY the books that have the authors first and last names reversed, and perform a bulk metadata edit (press the E key after Ctrl Selecting the books you want to fix).

Then Go to the Search and Replace Tab.
Select [Authors] in the Search Field
Select [Regular Expression] in the Search Mode drop-down Field.
In the Search for: field enter (.*), (.*)
In the Replace with: field enter \2 \1

(check in the Test results table that the expected reversal will take place)

Make sure you have selected ONLY the books with the reversed names!
Make Sure you have backed up your library !!
Cross your fingers

Then Click OK

Calibre will update the Author-Sort field automagically at the same time.

The regular expression shown (.*), (.*) will only work for authors that are entered as LastName, FirstName i.e. it expects one comma and one space between a single last name and (one or more) first name(s).
i have a very similar problem that i have filenames in two groups;

1) Hide & seek_ a novel - James Patterson
2) Hide & seek_ a novel - Patterson_ James

i have been trying to change filenames 1) to 2) use the 'Search and Replace Tab' as discribed above method with a few variations but without any success.

as there is no , between the fisrt and last name i just can't get the [Regular Expression] to work.

any help could be much appreciated. many thanks in advance.
AlanY is offline   Reply With Quote
Old 02-23-2011, 01:16 PM   #6
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
Quote:
Originally Posted by AlanY View Post
i have a very similar problem that i have filenames in two groups;

1) Hide & seek_ a novel - James Patterson
2) Hide & seek_ a novel - Patterson_ James

i have been trying to change filenames 1) to 2) use the 'Search and Replace Tab' as discribed above method with a few variations but without any success.

as there is no , between the fisrt and last name i just can't get the [Regular Expression] to work.

any help could be much appreciated. many thanks in advance.
Do you have these as "filenames" as posted above, i.e., not yet imported into Calibre, or have you already imported incorrectly and are in a field, like author or title? If they are still files, and you want to import them correctly, you use regex in the Add Books Preferences, while if they are already in the wrong field, you use Search and Replace.
Starson17 is offline   Reply With Quote
Old 02-23-2011, 01:22 PM   #7
AlanY
Member
AlanY began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Feb 2011
Device: kindle
Quote:
Originally Posted by Starson17 View Post
Do you have these as "filenames" as posted above, i.e., not yet imported into Calibre, or have you already imported incorrectly and are in a field, like author or title? If they are still files, and you want to import them correctly, you use regex in the Add Books Preferences, while if they are already in the wrong field, you use Search and Replace.
oh, i see. thanks for the clarification.

actually, i have both. some are already there and some are ready to Ádd, but i just cant get the regex to work correctly.

Last edited by AlanY; 02-23-2011 at 01:25 PM.
AlanY is offline   Reply With Quote
Old 02-23-2011, 01:30 PM   #8
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
Quote:
Originally Posted by AlanY View Post
oh, i see. thanks for the clarification.

actually, i have both. some are already there and some are ready to Ádd, but i just cant get the regex to work correctly.
Try this simple one for the ones to be added:
Code:
(?P<title>.+) - (?P<author>[^_]+)
It should work for both, but you need to turn on the swap author FN LN option for the second group. (I assume you want to keep the "a novel" in the title.)


For those that are already in, you'll need to provide more info about what field they are in.
Starson17 is offline   Reply With Quote
Old 02-23-2011, 01:35 PM   #9
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
I reread your post, and it looks like you want to swap first name and last name in some cases. You need to get your author names all consistent and your author_sort all fixed. From then on you can use the regex I gave you to bring in the author correctly and the author_sort will fix itself. Start by fixing or reimporting everything you have now. From then on, you can import correctly and all should be fine.
Starson17 is offline   Reply With Quote
Old 02-23-2011, 02:01 PM   #10
AlanY
Member
AlanY began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Feb 2011
Device: kindle
Quote:
Originally Posted by Starson17 View Post
I reread your post, and it looks like you want to swap first name and last name in some cases. You need to get your author names all consistent and your author_sort all fixed. From then on you can use the regex I gave you to bring in the author correctly and the author_sort will fix itself. Start by fixing or reimporting everything you have now. From then on, you can import correctly and all should be fine.
that's great, it works.

many many thanks
AlanY is offline   Reply With Quote
Old 02-23-2011, 02:08 PM   #11
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
Quote:
Originally Posted by AlanY View Post
that's great, it works.

many many thanks
You're welcome, but I got you only part of the way. You'll want to decide whether you want your authors all to appear as LN, FN or FN LN. Then you want to set your tweaks so that the author_sort is set correctly when you bring in new books. (In case you aren't familiar with it, author_sort controls how your authors are sorted) Look in Preferences for the new and improved Tweaks setting screen. You may need to use Search and Replace to fix any errors you have now, but once all that's set, you won't have to use it again.

Feel free to ask if more help is needed.

Good luck!
Starson17 is offline   Reply With Quote
Old 02-23-2011, 02:45 PM   #12
AlanY
Member
AlanY began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Feb 2011
Device: kindle
Quote:
Originally Posted by Starson17 View Post
Try this simple one for the ones to be added:
Code:
(?P<title>.+) - (?P<author>[^_]+)


It should work for both, but you need to turn on the swap author FN LN option for the second group. (I assume you want to keep the "a novel" in the title.)


For those that are already in, you'll need to provide more info about what field they are in.
Quote:
Originally Posted by Starson17 View Post
You're welcome, but I got you only part of the way. You'll want to decide whether you want your authors all to appear as LN, FN or FN LN. Then you want to set your tweaks so that the author_sort is set correctly when you bring in new books. (In case you aren't familiar with it, author_sort controls how your authors are sorted) Look in Preferences for the new and improved Tweaks setting screen. You may need to use Search and Replace to fix any errors you have now, but once all that's set, you won't have to use it again.

Feel free to ask if more help is needed.

Good luck!
sorry starson17, spoke too soon. isn't that the same as the default setting?

Code:
(?P<title>.+) - (?P<author>[^_]+)
so, which one should i use to add

1) First name, and
2) Last name_first name?
AlanY is offline   Reply With Quote
Old 02-23-2011, 03:04 PM   #13
AlanY
Member
AlanY began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Feb 2011
Device: kindle
Quote:
Originally Posted by AlanY View Post
sorry starson17, spoke too soon. isn't that the same as the default setting?

Code:
(?P<title>.+) - (?P<author>[^_]+)
so, which one should i use to add

1) First name, and
2) Last name_first name?
ok, let me explain;
i've 50 books with a mixture of filenames 1) and 2) to add to the library.

using the regex (?P<title>.+) - (?P<author>[^_]+) i got

33 books under the Authors LastName, FirstName, and
17 books under the authers FirstName LastName (with space inbetween).

so, what regex do i need to put into the 'search and replace' to 17 to the same as the other 33?
AlanY is offline   Reply With Quote
Old 02-23-2011, 03:13 PM   #14
AlanY
Member
AlanY began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Feb 2011
Device: kindle
Quote:
Originally Posted by Starson17 View Post
Try this simple one for the ones to be added:
Code:
(?P<title>.+) - (?P<author>[^_]+)
It should work for both, but you need to turn on the swap author FN LN option for the second group. (I assume you want to keep the "a novel" in the title.)

I've tried that but as it read from the filenames thus excluded all the cover/comments etc that i would like to keep.

For those that are already in, you'll need to provide more info about what field they are in.
...................................
AlanY is offline   Reply With Quote
Old 02-23-2011, 03:23 PM   #15
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
Quote:
Originally Posted by AlanY View Post
sorry starson17, spoke too soon. isn't that the same as the default setting?
Yes, but it worked, so I concluded you'd damaged or replaced the default.

Quote:
so, which one should i use to add

1) First name, and
2) Last name_first name?
Which one what? I only gave you one.
Quote:
ok, let me explain;
i've 50 books with a mixture of filenames 1) and 2) to add to the library.

using the regex (?P<title>.+) - (?P<author>[^_]+) i got

33 books under the Authors LastName, FirstName, and
17 books under the authers FirstName LastName (with space inbetween).

so, what regex do i need to put into the 'search and replace' to 17 to the same as the other 33?
There isn't any regex that will split the FN and the LN, and reverse some, but not others. Use the regex I gave you (default) for all the FN LN format files, then click the option that reverses FN and LN (it's on the Add books regex page) and import the other group. That gives you files all in FN LN format, which is what Calibre expects. (It will create an author_sort field that is LN, FN and use it for sorting).
Starson17 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Reverse Windowing: The Tourist Trail johnyunker Writers' Corner 11 06-21-2010 10:13 PM
Reverse Proxying Stanza RoninTech Calibre 3 11-10-2009 11:20 AM
Unutterably Silly Reverse Prank Call NatCh Lounge 16 05-28-2009 02:03 PM
reverse display output? LDB Sony Reader 0 08-10-2008 11:14 PM
Reverse engineer HandStory clips Aragorn Reading and Management 3 04-01-2003 06:40 PM


All times are GMT -4. The time now is 09:35 AM.


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