Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 08-28-2011, 11:19 PM   #1
hanbalfrek
Junior Member
hanbalfrek began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Aug 2011
Device: Nook Color
Regex Question involving multiple . (periods)

Sorry if this has been asked, but I've tried google and searching this forum and came up empty.

I'm trying to import books with author names with multiple periods in them, such as

George R. R. Martin - Game of Thrones

A. A. Attanasio - In Other Worlds

A. Bertram Chandler - All Laced Up

C. S. Friedman - The Wilding

and none of them come up correctly.

Any help is greatly appreciated.
hanbalfrek is offline   Reply With Quote
Old 08-29-2011, 12:01 AM   #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,782
Karma: 54830978
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 hanbalfrek View Post
Sorry if this has been asked, but I've tried google and searching this forum and came up empty.

I'm trying to import books with author names with multiple periods in them, such as

George R. R. Martin - Game of Thrones

A. A. Attanasio - In Other Worlds

A. Bertram Chandler - All Laced Up

C. S. Friedman - The Wilding

and none of them come up correctly.

Any help is greatly appreciated.
to match only periods, they need to be escaped.

Code:
\.
theducks is offline   Reply With Quote
Advert
Old 08-29-2011, 01:04 AM   #3
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,864
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
Quote:
Originally Posted by hanbalfrek View Post
I'm trying to import books with author names with multiple periods in them, such as

George R. R. Martin - Game of Thrones

A. A. Attanasio - In Other Worlds

A. Bertram Chandler - All Laced Up

C. S. Friedman - The Wilding

and none of them come up correctly.
What regex are you using for import?

I use the following regex under Preferences - Adding Books for importing books with the author first.

Code:
^((?P<author>([^\-_0-9]+)(?=\s*-\s*)(?!\s*-\s*[0-9.]+)|\b))(\s*-\s*)?((?P<series>[^0-9\-]+)(\s*-\s*)?(?P<series_index>[0-9.]+)\s*-\s*)?(?P<title>[^\-_0-9]+)
It works on the books you gave as an example.

Good Luck.
DoctorOhh is offline   Reply With Quote
Old 08-29-2011, 11:02 AM   #4
hanbalfrek
Junior Member
hanbalfrek began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Aug 2011
Device: Nook Color
I'm not replicating the success you're getting, but I think that's because I have a bigger problem.

Using the default regex to test in the test tool in Adding Books, I'm not even getting the right response for a basic

Code:
(?P<title>.+) - (?P<author>[^_]+)
Test Title - Test Author

gives me

Title: No match
Authors: Unknown

I tried uninstalling/reinstalling the application, but that didn't help.

Any ideas about this? Is something corrupt?
hanbalfrek is offline   Reply With Quote
Old 08-29-2011, 11:12 AM   #5
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,782
Karma: 54830978
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 hanbalfrek View Post
I'm not replicating the success you're getting, but I think that's because I have a bigger problem.

Using the default regex to test in the test tool in Adding Books, I'm not even getting the right response for a basic

Code:
(?P<title>.+) - (?P<author>[^_]+)
Test Title - Test Author

gives me

Title: No match
Authors: Unknown

I tried uninstalling/reinstalling the application, but that didn't help.

Any ideas about this? Is something corrupt?
Settings are saved in the configuration directory.
Un-installing does not touch your settings or Library.

Kill the configuration directory (after un-installing),
then install to remove corrupted settings
theducks is offline   Reply With Quote
Advert
Old 08-29-2011, 11:34 AM   #6
hanbalfrek
Junior Member
hanbalfrek began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Aug 2011
Device: Nook Color
Thanks for the quick reply, but no dice.

It still doesn't work.
hanbalfrek is offline   Reply With Quote
Old 08-29-2011, 11:57 AM   #7
hanbalfrek
Junior Member
hanbalfrek began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Aug 2011
Device: Nook Color
New update.

The test function doesnt work, but actually importing the files come out correct.

Thanks for the help everyone!
hanbalfrek is offline   Reply With Quote
Old 08-29-2011, 03:24 PM   #8
hanbalfrek
Junior Member
hanbalfrek began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Aug 2011
Device: Nook Color
Quote:
Originally Posted by dwanthny View Post
What regex are you using for import?

I use the following regex under Preferences - Adding Books for importing books with the author first.

Code:
^((?P<author>([^\-_0-9]+)(?=\s*-\s*)(?!\s*-\s*[0-9.]+)|\b))(\s*-\s*)?((?P<series>[^0-9\-]+)(\s*-\s*)?(?P<series_index>[0-9.]+)\s*-\s*)?(?P<title>[^\-_0-9]+)
It works on the books you gave as an example.

Good Luck.
Hey dwanthny,

Thanks for the last one. I got another one for you.

I have another directory of books that go

Rim Change - A. Bertram Chandler - Grimes 046

and I've modified your code to get title and author, but can't get series/index.


I changed it to
Code:
^(?P<title>[^\-_0-9]+)(\s*-\s*)((?P<author>([^\-_0-9]+)(?=\s*-\s*)(?!\s*-\s*[0-9.]+)|\b))(\s*-\s*)?((?P<series>[^0-9\-]+)(\s*-\s*)?(?P<series_index>[0-9.]+)\s*-\s*)?
test-A. Bertram Chandler - Grimes 046.pdf

becomes
Title: test
Authors: A. Bertram Chandler
Series: No match
Series index: No match

Thanks again!
hanbalfrek is offline   Reply With Quote
Old 08-29-2011, 04:34 PM   #9
user_none
Sigil & calibre developer
user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.
 
user_none's Avatar
 
Posts: 2,488
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
Quote:
Originally Posted by hanbalfrek View Post
Code:
(?P<title>.+) - (?P<author>[^_]+)
Test Title - Test Author
gives me
Title: No match
Authors: Unknown

Any ideas about this? Is something corrupt?
The test input requires a file extension. E.G. "Test Title - Test Author.epub"
user_none is offline   Reply With Quote
Old 08-29-2011, 04:47 PM   #10
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,864
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
Quote:
Originally Posted by hanbalfrek View Post
The test function doesnt work, but actually importing the files come out correct.
As user_none says the test function requires a complete file name to work, including the extension.

Rim Change - A. Bertram Chandler - Grimes 046.epub

Adding the books extension allows you to use the test box successfully.

Quote:
Originally Posted by hanbalfrek View Post
Rim Change - A. Bertram Chandler - Grimes 046

and I've modified your code to get title and author, but can't get series/index.

becomes
Title: test
Authors: A. Bertram Chandler
Series: No match
Series index: No match
I don't understand them fully, but I can rearrange ones that work.

Try

Code:
^((?P<title>([^\-_0-9]+)(?=\s*-\s*)(?!\s*-\s*[0-9.]+)|\b))(\s*-\s*)?((?P<author>[^\-_0-9]+)\s*-\s*)?(?P<series>[^0-9\-]+)(\s*-\s*)?(?P<series_index>[0-9.]+)

Last edited by DoctorOhh; 08-29-2011 at 05:05 PM.
DoctorOhh is offline   Reply With Quote
Old 08-29-2011, 04:57 PM   #11
hanbalfrek
Junior Member
hanbalfrek began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Aug 2011
Device: Nook Color
Quote:
Originally Posted by user_none View Post
The test input requires a file extension. E.G. "Test Title - Test Author.epub"
Thanks for that! Exactly what the problem was.



Quote:
Originally Posted by dwanthny View Post

I don't understand them fully, but I can rearrange ones that work.

Try

Code:
^((?P<title>([^\-_0-9]+)(?=\s*-\s*)(?!\s*-\s*[0-9.]+)|\b))(\s*-\s*)?((?P<author>[^\-_0-9]+)\s*-\s*)?(?P<series>[^0-9\-]+)(\s*-\s*)?(?P<series_index>[0-9.]+)

Thanks again! That worked!
I was able to edit the end so that the series was not necessary, but I still gotta study regex more to understand why I'm having such problems with the first two fields on my own.

Edited one is:
Code:
^((?P<title>([^\-_0-9]+)(?=\s*-\s*)(?!\s*-\s*[0-9.]+)|\b))(\s*-\s*)?((?P<author>[^\-_0-9]+))?(\s*-\s*(?P<series>[^0-9\-]+)(\s*-\s*)?(?P<series_index>[0-9.]+)?)?
Thanks again everyone!
hanbalfrek is offline   Reply With Quote
Old 08-29-2011, 05:06 PM   #12
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,864
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
Quote:
Originally Posted by hanbalfrek View Post
Thanks again! That worked!
You're welcome!

Also the Quick Preferences GUI plugin (see attached) allows you to quickly change add books settings from the toolbar without drilling down in the main preferences section.
Attached Thumbnails
Click image for larger version

Name:	quickpreferences.jpg
Views:	183
Size:	102.7 KB
ID:	75880  
DoctorOhh is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Regex question and maybe some help crutledge Sigil 9 03-10-2011 04:37 PM
Regex Question Archon Conversion 11 02-05-2011 10:13 AM
The Watcher - An occult horror thriller involving an inhuman villain brinlingfm Self-Promotions by Authors and Publishers 3 01-13-2011 04:15 AM
Server maintenance involving E-Mail and Dev Alexander Turcic Announcements 20 06-02-2010 06:36 PM
Import files, regex question al35 Calibre 0 03-22-2010 12:33 PM


All times are GMT -4. The time now is 08:19 PM.


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