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 08-24-2011, 09:32 AM   #1
donnelyn
Junior Member
donnelyn began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Aug 2011
Device: Kindle
Help with Regexp for importing Magazines

Hi,

I am trying to import magazines into calibre and I want to have the Year imported into Series and Month (in numerical form) into Series Index.

The filenames are in the form of
Analog Science Fiction and Fact, 2008-03, March 2008.mobi
Analog Science Fiction and Fact, 2008-01, January-February 2008.mobi

but I could rename them to the following form if that's easier

Analog Science Fiction and Fact - 2008-03 - March 2008.mobi

I was using the following regexp
(?P<title>.+) ?\s*(?P<series>[0-9][^_-]+) -?\s*(?P<series_index>[0-9]*)\s*-\s*

and test filename Analog Science Fiction and Fact - 2008-03 - March 2008.mobi

But it includes the year as part of the title and puts the number of the month into the series instead of the series index.

Can any kind soul offer me some help please
donnelyn is offline   Reply With Quote
Old 08-24-2011, 09:51 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: 14,226
Karma: 5495470
Join Date: Aug 2009
Location: The (original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
Quote:
Originally Posted by donnelyn View Post
Hi,

I am trying to import magazines into calibre and I want to have the Year imported into Series and Month (in numerical form) into Series Index.

The filenames are in the form of
Analog Science Fiction and Fact, 2008-03, March 2008.mobi
Analog Science Fiction and Fact, 2008-01, January-February 2008.mobi

but I could rename them to the following form if that's easier

Analog Science Fiction and Fact - 2008-03 - March 2008.mobi

I was using the following regexp
(?P<title>.+) ?\s*(?P<series>[0-9][^_-]+) -?\s*(?P<series_index>[0-9]*)\s*-\s*

and test filename Analog Science Fiction and Fact - 2008-03 - March 2008.mobi

But it includes the year as part of the title and puts the number of the month into the series instead of the series index.

Can any kind soul offer me some help please
You do need to include the Month AND year as the title to avoid the Duplicate Title issue.
I also created series hierarchy to sort in order
Attached Thumbnails
Click image for larger version

Name:	Analog_series2.jpg
Views:	36
Size:	260.8 KB
ID:	89986  

Last edited by theducks; 07-31-2012 at 09:57 AM. Reason: updated Image
theducks is offline   Reply With Quote
Old 08-24-2011, 09:53 AM   #3
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 donnelyn View Post
test filename Analog Science Fiction and Fact - 2008-03 - March 2008.mobi

But it includes the year as part of the title and puts the number of the month into the series instead of the series index.

Can any kind soul offer me some help please
Try this:
Code:
(?P<title>.+), (?P<series>[0-9]+)-(?P<series_index>[0-9]+)

Last edited by Starson17; 08-24-2011 at 10:54 AM.
Starson17 is offline   Reply With Quote
Old 08-24-2011, 10:26 AM   #4
donnelyn
Junior Member
donnelyn began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Aug 2011
Device: Kindle
Starson,

Thank you for your help.

That works just the way I want it to.

You've saved me hours of manually entering the information myself.

Last edited by donnelyn; 08-24-2011 at 10:56 AM.
donnelyn is offline   Reply With Quote
Old 08-24-2011, 10:34 AM   #5
donnelyn
Junior Member
donnelyn began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Aug 2011
Device: Kindle
theducks,

Thank for pointing out the duplicate issue I will rename my files to get around that.

e.g.
Analog Science Fiction and Fact September 2010, 2010-09.mobi

Last edited by donnelyn; 08-24-2011 at 10:36 AM.
donnelyn is offline   Reply With Quote
Old 08-24-2011, 10:56 AM   #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 donnelyn View Post
Starson,

Thank you for your help. The end of the regex you posted seems to be missing some code from the end.
My highlight didn't reach the end before I copied and pasted I fixed it in my post. Just add "]+" minus the quotes. It worked fine for my test.
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
Regexp help - I think... paulfiera Calibre 4 07-20-2011 03:27 AM
RegExp in search field Format C: Library Management 4 06-13-2011 11:00 AM
Is this as it supposed to be? (Regexp issue?) Mixx Calibre 13 03-09-2011 03:30 AM
Error in Regexp documentation arifzaman Calibre 3 03-02-2011 06:03 AM
Multiple line regexp janvanmaar Calibre 19 11-02-2010 01:02 PM


All times are GMT -4. The time now is 01:03 PM.


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