10-02-2010, 05:09 PM | #16 |
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Turn on the option in Preferences|Import/Export|Adding Books|"Swap author firstname and lastname"
|
10-02-2010, 05:14 PM | #17 |
Wizard
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
|
|
Advert | |
|
10-02-2010, 05:35 PM | #18 |
Wizard
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
|
chaley, I think he was talking about getting the kid to edit the metadata individually for all books he wants imported... that's no job for a kid, it's a job for a monkey. A well-trained one.
Apart from that, I'm too old to do a teenagers job, I'm afraid... |
10-02-2010, 08:34 PM | #19 |
Dreamer
Posts: 112
Karma: 501282
Join Date: Sep 2010
Location: Philadelphia, PA
Device: kindle
|
If the "input" string is this:
Armstrong, Kelley - Jauría and the desired output is Kelley Armstrong then I think a correct search term would be this (so that it doesn't match anything after the author first name and omits the " - Jauria"). (\w*),\s{0,1}(\w*)\s.* \2 \1 would still be the correct replacement string I'm not sure if this will be helpful or not (and I haven't tested it so ymmv). I understand that the previously presented solutions assume that the lastname,firstname have been imported into the {Author} field and that they are meant only to parse in this (limited) context. I thought that a regex to match the author info from the full filename might be the missing link. Last edited by bthrowsnaill; 10-02-2010 at 08:36 PM. |
10-03-2010, 03:09 AM | #20 | |
Wizard
Posts: 3,454
Karma: 10484861
Join Date: May 2006
Device: PocketBook 360, before it was Sony Reader, cassiopeia A-20
|
;-)
I am guilty as charged as well. I even knew there was an option. But the question asked for Regular expression, so I got, kinda ... carried away ... Quote:
Armstrong Kelly AND Kelly, Armstrong (with optional series) in one go ;-) And search and replace in field is good solution if you import lots of books that have BOTH notations, so you do not need to switch the option on and off. I know, I know ... I have got a hammer and now every problem looks like a nail ;-) |
|
Advert | |
|
10-03-2010, 05:19 AM | #21 | |
Wizard
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
|
Quote:
@kacir: I have thought about how to do that as well, at this point I don't believe there is an elegant solution. Maybe if you could use backreferences in importing books, but as it stand now, there just is no way. |
|
10-03-2010, 05:58 AM | #22 |
Wizard
Posts: 3,454
Karma: 10484861
Join Date: May 2006
Device: PocketBook 360, before it was Sony Reader, cassiopeia A-20
|
OK.
Here is what I use at this moment (?P<author>[^-]+)( - \[?(?P<series>[^-]+)(\[| )+(?P<series_index>[0-9]+)\]?)? - (?P<title>.+) It will process Bitten.rtf Armstrong, Kelley - Bitten.rtf Armstrong, Kelley - Otherworld 1 - Bitten.rtf Armstrong, Kelley - [Otherworld 1] - Bitten.rtf Armstrong, Kelley - Otherworld [1] - Kelley Armstrong - Bitten.rtf Kelley Armstrong - Otherworld 1 - Bitten.rtf Kelley Armstrong - [Otherworld 1] - Bitten.rtf Kelley Armstrong - Otherworld [1] - Bitten.rtf At the end of the day you - Select books you have added - Right click, select Bulk Edit Metadata - go to Search and Replace - select Search mode Regular Expressions - Search for ([^,]*), (.*) - Replace expression \2 \1 - and, of course select Search Field and Destination Field "authors" Not a single step, but better than adding thousands well organized books from an old hoard one by one ;-) EDIT: Do you want me to explain that monstrous (and almost unreadable by *me* - the author) Regular Expression in detail? Last edited by kacir; 10-03-2010 at 06:01 AM. |
10-03-2010, 06:02 AM | #23 |
Wizard
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
|
@kacir: Yes, but that still requires the search & replace- pass after importing. I don't think there's currently a way to avoid that.
@dkritso109: Use what kacir described above. It's the best solution you'll get now. |
10-03-2010, 07:14 PM | #24 | |
Enthusiast
Posts: 28
Karma: 10
Join Date: Oct 2010
Device: iPad / Kindle DX
|
Kacir,
Quote:
This is what I make of it: (?P<author>[^-]+) matches any string of characters except the character - and make that string the 'author' field. I don't get [^-]. Wouldn't that eliminate a possible hyphen from the name? Why not simply use (?P<author>.+), like you do for the title? ( - \[?(?P<series>[^-]+)(\[| )+(?P<series_index>[0-9]+)\]?)? The whole expression between the first and the last parenthesis is followed by a question mark. Does this question mark mean that the whole expression can either not appear or appear once, thus letting us process two types of books (those with a series and those without)? Again, I don't get the [^-]. I'm also not sure about the + in (\[| )+. Is it to process the possibility of an erroneous duplication of either a left bracket or a white space before the series index? - (?P<title>.+) This part seems clear enough: after the last whitespace hyphen whitespace sequence, all characters are the title. However, since [^-] was used for the author and the series, why not use it here as well? A clarification would be most welcome. Thanks! W. |
|
10-04-2010, 04:04 AM | #25 | |||||
Wizard
Posts: 3,454
Karma: 10484861
Join Date: May 2006
Device: PocketBook 360, before it was Sony Reader, cassiopeia A-20
|
Hi. Welcome to Mobileread.
You might find this https://www.mobileread.com/forums/showthread.php?t=99258 thread very informative. Quote:
Quote:
So if you have string "<b> this is bold text </b>" and you want to get rid of the hypertext tags, you might be tempted to write the search string as "<.*>" but that would eat up everything, including the first ">" I could have used "non-greedy" version of the + quantifier, so the RE in question might look like (?P<author>.+?). But I am old fashioned, I learned to write Regular Expressions using tools that do not support non-greedy quantifiers, and this way the RE is more universal/compatible across various implementations of RE engine. This RE was created under the assumption that there are no hyphens in the name of the author or name of the series. This assumption works 99.5% of time, the rest of the books (0.5%) will have to be tweaked by hand Quote:
I was tired of changing the RE back and forth when I needed to import book with series or without Explained above Quote:
You see, I have created this Regular Expression gradually, with use. I wrote the first simple one, then I came across the book where it didn't work, so I tweaked it to work on that book as well ... So far I have been processing books where - author, (optional series info)?, title is separated by " - " - the whole series or just series number might be enclosed in square bracket, so the RE is made to match also: author - series - title author - series 01 - title author - [series] - title author - [series 01] - title author - series [01] - title author - series [ 01] - title and as a side effect might also match nonsense like author - [series - title author - [series [01 - title author - series 01] - title but in its current form wouldn't match author - series01 - title notice there is no space or square bracket separating series number Quote:
You are welcome |
|||||
10-04-2010, 09:54 AM | #26 |
Enthusiast
Posts: 43
Karma: 10
Join Date: Jun 2010
Device: Kindle 3
|
ok first off kacir your awesome,
(?P<author>[^-]+)( - \[?(?P<series>[^-]+)(\[| )+(?P<series_index>[0-9]+)\]?)? - (?P<title>.+) this works great, this totaly solved my author sort issue. the only problem is with the series numbers Foster, Alan Dean - Catechist 02 - Carnivores of Light and Darkness turns into this Carnivores of Light and Darkness Foster, Alan Dean please also keep in mind that i am having trouble keeping up with yalls techie kung-fu. you guys are definately experts at this, while i am a measly little business major. also one more thing: i know nothing about the search and replace function, all of my 4000 + books are already in the Alan Dean Foster format how do i change them all to Foster, Alan Dean. what exactly do i need to do? so just to recap: 1. my series loses their numbering 2. search and replace all authors to the author sort format in the author box thanks guys for your awesome help so far, yall rock!!! p.s. can anyone lend me a well trained monkey??? |
10-04-2010, 10:16 AM | #27 | |||
Wizard
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
|
Quote:
Quote:
Quote:
As for the search & replace- stuff here, that's a bit trickier. I suspect something like searching for Code:
(.*)\s(.*?) Code:
\2, \1 My monkey is currently busy hacking a problem I have. I'll tell it you asked. EDIT: If you were to search & replace for each author individually (or, to be more correct, edit the single firstname, single lastname cases in one go, then edit the double firstname, single lastname, and so on), then the problem would cease to exist, of course. In that case, you could write a custom-tailored regexp to match each author perfectly. Last edited by Manichean; 10-04-2010 at 10:19 AM. |
|||
10-04-2010, 10:56 AM | #28 |
Enthusiast
Posts: 43
Karma: 10
Join Date: Jun 2010
Device: Kindle 3
|
i am sooooo close i can feel it
now about your question of how it fills in the metadata card you are right it's like this: Carnivores of Light and Darkness {Title} Foster, Alan Dean {Author(s)} so my most important issue now is retaining the series names and numbers. i want: Foster, Alan Dean - Catechist 02 - Carnivores of Light and Darkness to look like this: Catechist 02 - Carnivores of Light and Darkness {Title} Foster, Alan Dean {Author(s)} i totally understand what you mean about authors with multiple names and how it can confuse. i still need to find a way to convert most of my {Author(s)} so that they are in the {Author(s)} fields in the Author Sort format, but the search and replace info doesn't seem to be working. i don't know if i am doing it wrong or not understanding or what. but it doesn't change anything. I don't want to start inputing them now as Foster, Alan Dean {Author(s)}, when i have 4000 books as Alan Dean Foster {Author(s)} |
10-04-2010, 11:06 AM | #29 | ||
Wizard
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
|
Quote:
Quote:
Code:
([^,]*),\s(.*?) Code:
\2 \1 |
||
10-04-2010, 11:23 AM | #30 |
Enthusiast
Posts: 43
Karma: 10
Join Date: Jun 2010
Device: Kindle 3
|
omg! i totaly missed that my series have a series field completely missed that. yes the series field retains the info perfectly, buuuuuut i do want the series name and number in the {Title} field aswell.
and for your last question, i want to search and replace all my {Author(s)} that are in the Alan Dean Foster {Author(s)} format to be in the Foster, Alan Dean {Author(s)} format. Search and Replace: Alan Dean Foster {Author(s)} ---------> Foster, Alan Dean {Author(s)} i just tried your search and replace code and it does nothing. i can totally see the search and replace function as an extremely powerful tool, but i'm kinda scared to use it. back up time!!! also i'm hoping that there's a way to retain series name and number in the {Title} field without having to search and replace each and everytime i input a series. Last edited by dkritso109; 10-04-2010 at 11:31 AM. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Regular Expression Help | Azhad | Calibre | 86 | 09-27-2011 02:37 PM |
Regular Expression Help | smartmart | Calibre | 5 | 10-17-2010 05:19 AM |
Sigil 024 and regular expressions on "all HTML files" | WS64 | Sigil | 4 | 08-13-2010 07:33 PM |
Help with the regular expression | Dysonco | Calibre | 9 | 03-22-2010 10:45 PM |
Help: Is there a search expression for "books without Series"? | LARdT | Calibre | 3 | 01-20-2010 09:34 PM |