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

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

Notices

Reply
 
Thread Tools Search this Thread
Old 08-29-2011, 12:19 AM   #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, 01:01 AM   #2
theducks
Grand Sorcerer
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: 15,268
Karma: 6020309
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
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
Old 08-29-2011, 02: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: 8,908
Karma: 12755553
Join Date: Feb 2009
Location: North Carolina
Device: 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, 12:02 PM   #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, 12:12 PM   #5
theducks
Grand Sorcerer
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: 15,268
Karma: 6020309
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
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
Old 08-29-2011, 12:34 PM   #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, 12:57 PM   #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, 04: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, 05: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,473
Karma: 1053245
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, 05: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: 8,908
Karma: 12755553
Join Date: Feb 2009
Location: North Carolina
Device: 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 06:05 PM.
DoctorOhh is offline   Reply With Quote
Old 08-29-2011, 05: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, 06: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: 8,908
Karma: 12755553
Join Date: Feb 2009
Location: North Carolina
Device: 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:	56
Size:	102.7 KB
ID:	75880  
DoctorOhh 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
Regex question and maybe some help crutledge Sigil 9 03-10-2011 05:37 PM
Regex Question Archon Conversion 11 02-05-2011 11:13 AM
The Watcher - An occult horror thriller involving an inhuman villain brinlingfm Self-Promotions by Authors and Publishers 3 01-13-2011 05:15 AM
Server maintenance involving E-Mail and Dev Alexander Turcic Announcements 20 06-02-2010 07:36 PM
Import files, regex question al35 Calibre 0 03-22-2010 01:33 PM


All times are GMT -4. The time now is 10:26 PM.


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