Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 06-20-2011, 08:11 PM   #1
encapuchado
Banned
encapuchado ought to be getting tired of karma fortunes by now.encapuchado ought to be getting tired of karma fortunes by now.encapuchado ought to be getting tired of karma fortunes by now.encapuchado ought to be getting tired of karma fortunes by now.encapuchado ought to be getting tired of karma fortunes by now.encapuchado ought to be getting tired of karma fortunes by now.encapuchado ought to be getting tired of karma fortunes by now.encapuchado ought to be getting tired of karma fortunes by now.encapuchado ought to be getting tired of karma fortunes by now.encapuchado ought to be getting tired of karma fortunes by now.encapuchado ought to be getting tired of karma fortunes by now.
 
Posts: 130
Karma: 7587966
Join Date: Oct 2010
Location: Mexico
Device: Black Sony Touch (650)
Another help with regular expressions

Well, following Starsons advice in another thread [use regexp to get info from the file name], I'm close to get the authors listed by <last-name, first-name>.

I found that the default regexp, found in the "Preferences ->Adding Books" menu is almost what I need.

Code:
(?P<title>.+) - (?P<author>[^_]+)
Thus, for a file named "SuchandSuch - Azimov_Isaac.epub" I got title="SuchandSuch", author="Asimov Isaac".

However, I would like to get author="Asimov, Isaac". Now, AFAIK regexps are for pattern matching, not for string processing. So, my question is if there is a way to get that extra comma between the last name and the first name.
encapuchado is offline   Reply With Quote
Old 06-20-2011, 08:17 PM   #2
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,890
Karma: 55267620
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by encapuchado View Post
Well, following Starsons advice in another thread [use regexp to get info from the file name], I'm close to get the authors listed by <last-name, first-name>.

I found that the default regexp, found in the "Preferences ->Adding Books" menu is almost what I need.

Code:
(?P<title>.+) - (?P<author>[^_]+)
Thus, for a file named "SuchandSuch - Azimov_Isaac.epub" I got title="SuchandSuch", author="Asimov Isaac".

However, I would like to get author="Asimov, Isaac". Now, AFAIK regexps are for pattern matching, not for string processing. So, my question is if there is a way to get that extra comma between the last name and the first name.
There is a tick box for that (swap Author Firstname with Lastname)
in the Adding books preference
theducks is offline   Reply With Quote
Advert
Old 06-20-2011, 08:36 PM   #3
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,641
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
@theducks - that won't directly do what they want. They don't want to swap first and last name, they just want a comma inserted. So "Asimov Isaac" becomes "Asimov, Isaac".

Other than changing it manually or using search/replace, your other option is to do a metadata download with the authors box checked. This should overwrite the author in the format you prefer.
kiwidude is offline   Reply With Quote
Old 06-20-2011, 08:46 PM   #4
encapuchado
Banned
encapuchado ought to be getting tired of karma fortunes by now.encapuchado ought to be getting tired of karma fortunes by now.encapuchado ought to be getting tired of karma fortunes by now.encapuchado ought to be getting tired of karma fortunes by now.encapuchado ought to be getting tired of karma fortunes by now.encapuchado ought to be getting tired of karma fortunes by now.encapuchado ought to be getting tired of karma fortunes by now.encapuchado ought to be getting tired of karma fortunes by now.encapuchado ought to be getting tired of karma fortunes by now.encapuchado ought to be getting tired of karma fortunes by now.encapuchado ought to be getting tired of karma fortunes by now.
 
Posts: 130
Karma: 7587966
Join Date: Oct 2010
Location: Mexico
Device: Black Sony Touch (650)
Quote:
Originally Posted by kiwidude View Post
@theducks - that won't directly do what they want. They don't want to swap first and last name, they just want a comma inserted. So "Asimov Isaac" becomes "Asimov, Isaac".
Yes, that is exactly what I want. I was hoping there was some kind of replace function added to the basic regexp processing.
encapuchado is offline   Reply With Quote
Old 06-20-2011, 09:08 PM   #5
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,641
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
No there isn't (in the adding process - you can do it post process but that would be messy). If you want such functionality, the best way would be to use a bulk renaming tool outside of Calibre to insert the comma.
kiwidude is offline   Reply With Quote
Advert
Old 06-21-2011, 01:40 PM   #6
encapuchado
Banned
encapuchado ought to be getting tired of karma fortunes by now.encapuchado ought to be getting tired of karma fortunes by now.encapuchado ought to be getting tired of karma fortunes by now.encapuchado ought to be getting tired of karma fortunes by now.encapuchado ought to be getting tired of karma fortunes by now.encapuchado ought to be getting tired of karma fortunes by now.encapuchado ought to be getting tired of karma fortunes by now.encapuchado ought to be getting tired of karma fortunes by now.encapuchado ought to be getting tired of karma fortunes by now.encapuchado ought to be getting tired of karma fortunes by now.encapuchado ought to be getting tired of karma fortunes by now.
 
Posts: 130
Karma: 7587966
Join Date: Oct 2010
Location: Mexico
Device: Black Sony Touch (650)
Finally, following the advices given by the fine patrons of this sub-forum, I got what I wanted, see the authors listed as <LN, FN> and sorted by LN.

In case somebody else wants to do the same, this was my procedure:

1. Using the free Bulk Rename Utility (just google it), I renamed the file to "title - lastname, firstname.epub"
2. Open Calibre.
3. In menu "Preferences->Tweak->Author sort name algorithm" I put author_sort_copy_method = 'copy'
4. In menu "Preferences->Adding books" I unchecked all three options and I left the default regular expression alone.
5. Close and open Calibre.
6. Add the books to Calibre library and voila!

Thanks to all
encapuchado is offline   Reply With Quote
Old 06-21-2011, 03:14 PM   #7
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 encapuchado View Post
Finally, following the advices given by the fine patrons of this sub-forum, I got what I wanted,
Great!
Starson17 is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with regular expressions jevonbrady Library Management 6 06-21-2011 10:16 AM
An introduction to regular expressions Manichean Conversion 0 01-26-2011 05:05 PM
Help with Regular Expressions ghostyjack Workshop 2 01-08-2010 11:04 AM
Regular Expressions help needed Phil_C Workshop 20 10-03-2009 12:14 AM
BookDesigner v5 and regular expressions ShineOn Sony Reader 11 08-25-2008 04:06 PM


All times are GMT -4. The time now is 01:28 AM.


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