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 05-19-2015, 07:24 PM   #1
Wimi_Bussard
Member
Wimi_Bussard began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Nov 2013
Device: PRS-T3
How to get author data from folder name? (importing a lot of cbz)

Hi,
I have got a little problem and I hope you guys can help me out.

There is a huge collection of cbz-files which I want to catalogue in calibre. Unfortunately, the files themselves do not contain any metadata such as "author". Instead you can find the files in the their author's folder.

Example: Author A has written three books B1, B2 and B3. There is one folder called "Author A" which contains all three books.

There are a hella lot of them, so importing them as usual would result in countless hours of re-tagging the files with "author" which I want to avoid. So, here is my question: Is there any way to use the folders' names with the information of the author?
(or in other words: Can Calibre automatically tag the files with the author-data from their folders?)
Wimi_Bussard is offline   Reply With Quote
Old 05-19-2015, 08:44 PM   #2
BetterRed
null operator
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 5,091
Karma: 3786999
Join Date: Mar 2012
Location: NSW Australia
Device: none
Quote:
Originally Posted by Wimi_Bussard View Post
Hi,
I have got a little problem and I hope you guys can help me out.

There is a huge collection of cbz-files which I want to catalogue in calibre. Unfortunately, the files themselves do not contain any metadata such as "author". Instead you can find the files in the their author's folder.

Example: Author A has written three books B1, B2 and B3. There is one folder called "Author A" which contains all three books.

There are a hella lot of them, so importing them as usual would result in countless hours of re-tagging the files with "author" which I want to avoid. So, here is my question: Is there any way to use the folders' names with the information of the author?
(or in other words: Can Calibre automatically tag the files with the author-data from their folders?)
@Wimi_Bussard - one way would be to use an OS level renamer that has the ability to include parent folder name in the rename, so that you end up with file names like "Author A - B1".

Then you could use a template in Add Books such as (?P<author>[^_]+) - (?P<title>.+) and use this add option

Click image for larger version

Name:	Screenshot - 2015-05-20 , 10_38_53.jpg
Views:	34
Size:	40.5 KB
ID:	138485

BR
BetterRed is offline   Reply With Quote
Old 05-19-2015, 09:14 PM   #3
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: 16,554
Karma: 7667666
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: Astak Pocket Pro, K4NT,Galaxy Tab 2
Just clarify:
Calibre is Path unaware. Onlu the filename is usable
The method BR suggested is a good way to work around this.

If the folders were fairly densely populated, you could import 1 folder at a time and bulk Metadata edit change the Author. spin, rinse, repeat
theducks is offline   Reply With Quote
Old 05-20-2015, 11:45 AM   #4
Wimi_Bussard
Member
Wimi_Bussard began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Nov 2013
Device: PRS-T3
Okay, thanks for clarifying. I will try to play with the file names a little bit. I guess batch renaming should still be more comfortable than importing them folderwise as there a many folders with only one file in it. T.T
Wimi_Bussard is offline   Reply With Quote
Old 05-21-2015, 07:21 AM   #5
drjenkins
Zealot
drjenkins ought to be getting tired of karma fortunes by now.drjenkins ought to be getting tired of karma fortunes by now.drjenkins ought to be getting tired of karma fortunes by now.drjenkins ought to be getting tired of karma fortunes by now.drjenkins ought to be getting tired of karma fortunes by now.drjenkins ought to be getting tired of karma fortunes by now.drjenkins ought to be getting tired of karma fortunes by now.drjenkins ought to be getting tired of karma fortunes by now.drjenkins ought to be getting tired of karma fortunes by now.drjenkins ought to be getting tired of karma fortunes by now.drjenkins ought to be getting tired of karma fortunes by now.
 
Posts: 134
Karma: 1131448
Join Date: Nov 2010
Device: Kindle
If you don't already have a favorite batch renamer you might consider AdvancedRenamer:
http://www.advancedrenamer.com/

It's free and it has the specific ability to rename a file using folder names. It also handles regex for complex file renaming.
drjenkins is offline   Reply With Quote
Old 05-21-2015, 05:47 PM   #6
Wimi_Bussard
Member
Wimi_Bussard began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Nov 2013
Device: PRS-T3
Quote:
Originally Posted by drjenkins View Post
If you don't already have a favorite batch renamer you might consider AdvancedRenamer:
http://www.advancedrenamer.com/

It's free and it has the specific ability to rename a file using folder names. It also handles regex for complex file renaming.
Thanks, that's the tool I used, too. I only have got one problem, I don't get the regex commands of calibre.

My cbz-files do have this name pattern: [Author A (pseudonym if available)] Title YXZ [random tag: e.g. translated] (<-- square brackets!)

As it does not work with this regex expression "(?P<author>[^_]+) - (?P<title>.+)", I had to either change the regex or the name. Sadly, I wasn't able to change the regex (though I tried), because I don't quite understand this stuff. So I had to change the names, but this is kinda time consuming.

Is there a way to change the regex so it fits the required pattern? Sorry for having a lot of questions .

PS: It does suffice if calibre can extract the whole author part. I can re-tag the pseudonyms later manually T.T, shouldn't take me thaaat long ^^'.

Many thanks! (I will try to understand this regex stuff, too, could be useful *sigh*)
Wimi_Bussard is offline   Reply With Quote
Old 05-21-2015, 11:49 PM   #7
eschwartz
Irrational Optimist
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 12,675
Karma: 30811118
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
How does this look? (EDIT: fixed unescaped brackets)

Code:
\[(?P<author>[^\]]+)\] (?P<title>[^\]]+) \[(?P<tags>.+)\]
Matches:
Code:
[author_fn author_ln (optional_pseudonym)] title [tag1, tag2]
It assumes there MUST be a tag(s), but that can be made optional. Also, I don't know how you handle pseudonyms, but you cannot use custom columns in an Add regex so I just matched the pseudonym in with the author name. You can fix that manually later.


More about regex, if you are interested: http://regular-expressions.info

Last edited by eschwartz; 06-10-2015 at 10:12 PM. Reason: dur....
eschwartz is offline   Reply With Quote
Old 05-22-2015, 07:54 PM   #8
Wimi_Bussard
Member
Wimi_Bussard began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Nov 2013
Device: PRS-T3
Hi, I've tested everything and so far it is working fine. OFC the inconsistent naming methods of my folders aren't making it easy for me, but it's doable ^^. (some are just named in a completely different way T.T)

I had to change your code a little bit, though, eschwartz. It seems that we do need some backslashes in front of the squared brackets, because squared brackets are something special and therefore not recognized as simple letters/chars (I kinda did my homework, though I can't build complex expressions yet lol).

Thanks, everyone, we were on the right track!
Wimi_Bussard is offline   Reply With Quote
Old 06-05-2015, 03:16 AM   #9
crnirg
Junior Member
crnirg began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Nov 2010
Device: kindle
Maybe in TC -> [P] - [N]

Sorry if I miss.
crnirg is offline   Reply With Quote
Old 06-10-2015, 10:11 PM   #10
eschwartz
Irrational Optimist
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 12,675
Karma: 30811118
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Quote:
Originally Posted by Wimi_Bussard View Post
Hi, I've tested everything and so far it is working fine. OFC the inconsistent naming methods of my folders aren't making it easy for me, but it's doable ^^. (some are just named in a completely different way T.T)

I had to change your code a little bit, though, eschwartz. It seems that we do need some backslashes in front of the squared brackets, because squared brackets are something special and therefore not recognized as simple letters/chars (I kinda did my homework, though I can't build complex expressions yet lol).

Thanks, everyone, we were on the right track!
How mortifying. Good catch.


Glad I could help.
eschwartz 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
Importing HTML Meta Data Options RonBall42 Sigil 1 08-12-2014 11:39 AM
CBZ containing folder daigo75 Calibre 4 08-05-2010 03:17 PM
importing from calibre to itunes with album data 07thompsone Calibre 16 07-11-2010 05:20 AM
Folder customization when importing Heathen Calibre 8 06-01-2010 02:40 AM


All times are GMT -4. The time now is 03:11 AM.


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