03-20-2010, 08:46 PM | #1 |
Junior Member
Posts: 2
Karma: 10
Join Date: Mar 2010
Device: Sony Reader Daily Edition
|
Importing and maintaining title, author
I'm loving Calibre (kudos to your wife on picking a good name!). But something is driving me nuts.
I have a collection of e-books. I carefully went through them and standardized the file names: Lastname, Firstname - Title.epub (e.g., Pratchett, Terry - The Color of Magic.epub). But when I import these into Calibre, it seems to come up with its own naming scheme. The author is usually changed to Firstname Lastname and the titles lose whatever capitalization corrections I made (e.g., "The Color of Magic" becomes "The color of magic"). It seems that Calibre is pulling the data from the file itself. But is there any way to either force it to use my structure, or at least tell it to use "Lastname, Firstname" for authors? Thanks for any help you can give! |
03-20-2010, 09:35 PM | #2 |
creator of calibre
Posts: 43,844
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
If you want metadata to be read from only the file names (as opposed to inside the file) there is an potion to set in Preferences->Add/Save->Adding books
|
Advert | |
|
03-20-2010, 10:09 PM | #3 | |||||
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
Quote:
Quote:
Quote:
Quote:
You might want to read the FAQ, particularly the section entitled: Why doesn’t calibre let me store books in my own directory structure?¶ Last edited by Starson17; 03-20-2010 at 10:20 PM. |
|||||
03-21-2010, 03:32 AM | #4 |
Junior Member
Posts: 2
Karma: 10
Join Date: Mar 2010
Device: Sony Reader Daily Edition
|
Ah, wonderful! Thank you both. Regex has always given me fits, but I was able to figure enough to get it to import properly. W00t!
|
03-21-2010, 08:29 AM | #5 | |
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
Code:
^((?P<author>([^\-_0-9]+)(?=\s*-\s*)(?!\s*-\s*[0-9.]+)|\b))(\s*-\s*)?((?P<series>[^0-9\-]+) (- )?(?P<series_index>[0-9.]+)\s*-\s*)?(?P<title>.+) If you have problems during the import, let us know. |
|
Advert | |
|
03-21-2010, 11:18 AM | #6 |
Zealot
Posts: 126
Karma: 1826
Join Date: Jan 2010
Device: Kindle 2
|
@Starson17
thanks for the regex.. this is great.. can it be modified to ignore brackets around series like - First last - (Series 1) - title.ext First last - [Series 1] - title.ext and i dont know if it is possible but here it goes, can we use regex such that if author name has a coma it swaps first/last name. like - First Last - title.ext -> Author name = "First Last" Last, First - title.ext -> Author name = "First Last" instead of "Last, First" Last, First M.- title.ext -> Author name = "First M. Last" instead of "Last, First M." |
03-21-2010, 01:20 PM | #7 | ||
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
Code:
^((?P<author>([^\-_0-9]+)(?=\s*-\s*)(?!\s*-\s*[0-9.]+)|\b))(\s*-\s*)?([\(\[]?(?P<series>[^0-9\-]+) (- )?(?P<series_index>[0-9.]+)[\)\]]?\s*-\s*)?(?P<title>.+) Quote:
Last edited by Starson17; 03-21-2010 at 01:25 PM. |
||
03-21-2010, 01:43 PM | #8 | |
Grand Sorcerer
Posts: 11,734
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
If you want to use "Lastname, Firstname" for authors, then you probably also want to change how calibre copies the author names to the author_sort field. If you don't, then you must manually edit author_sort every time you import a new book or change an author's name to avoid sorting by author displaying the list in a very strange order. You can control how the copy using a calibre 'tweak' that changes how author_sort is generated from author. In the file tweaks.py, change author_sort_copy_method to either copy or comma (see below for more detail). Tweaks.py is found in your settings directory, which for me on windows 7 is C:\Users\charles\AppData\Roaming\calibre. From tweaks.py: Code:
# The algorithm used to copy author to author_sort # Possible values are: # invert: use "fn ln" -> "ln, fn" (the original algorithm) # copy : copy author to author_sort without modification # comma : use 'copy' if there is a ',' in the name, otherwise use 'invert' author_sort_copy_method = 'invert' If the current author_sort fields are not correct, then once you set the tweak you can reset all the author_sort fields in one swoop. First, verify that the author names are all as you want them. Then select the books you want to change, press E to get the bulk metadata editor, check the box "automatically set author sort", and push OK. The author_sort field for all the selected books will be recomputed from the author field according to the value of the tweak. |
|
03-22-2010, 12:29 AM | #9 |
Zealot
Posts: 126
Karma: 1826
Join Date: Jan 2010
Device: Kindle 2
|
@Starson17 that is amazing. thank you thank you
I am happy even if we cant switch First/last as that gets corrected when we lookup for metadata. Last edited by rollercoaster; 03-22-2010 at 12:31 AM. |
04-02-2010, 10:57 PM | #10 |
Guru
Posts: 644
Karma: 1242364
Join Date: May 2009
Location: The Right Coast
Device: PC (Calibre), Nexus 7 2013 (Moon+ Pro), HTC HD2/Leo (Freda)
|
chaley,
I've seen references to this discussion several times. Maybe I've been dense every time I've looked, but I'm not sure I understand what you're saying here. Does this make a purely cosmetic change to Calibre, effectively changing how author names are displayed in the Author(s) column of the main window? Or, are your changes altering calibre's file structure instead? Or both? In other words, I have "Stephen King - The Stand.epub" (for example). Current Calibre functionality: Author = Stephen King (as shown on Edit Metadata screen) Author Sort = King, Stephen (ditto) File Structure results in the path: .../Stephen King/The Stand (nnn)/ Author Column = Stephen King, listing it in the K's. And after using the technique that you show above, it would alter the functionality to which of the following? 1) File Structure results in the path: .../King, Stephen/The Stand (nnn)/ 2) Author Column = King, Stephen listing it in the K's. 3) Both of the above changes Please explain. Because I might have to contact someone regarding nominations for sainthood - at least! |
04-03-2010, 04:08 AM | #11 | ||||
Grand Sorcerer
Posts: 11,734
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Quote:
For example, I enter (and see) David Weber as "Weber, David". Because author_sort is set to author, he appears correctly in the 'W' section. In calibre's library, one of his books is stored as (converting to forward /s) "/Library/Weber_ David/1633 (49)/1633 - Weber_ David.epub". On my Sony Pocket, the file name is "/database/media/books/Weber, David/1633 - Weber, David.epub" Quote:
Quote:
|
||||
04-03-2010, 11:48 AM | #12 | |
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
Anyone can do this without needing chaley's mods (and in fact, IIRC, that's what he did before he wrote his code.) His code just makes it easier to control the parts of Calibre that automatically reverse "firstname lastname" to "lastname, firstname" when creating the author_sort field. |
|
04-04-2010, 12:05 AM | #13 |
Guru
Posts: 644
Karma: 1242364
Join Date: May 2009
Location: The Right Coast
Device: PC (Calibre), Nexus 7 2013 (Moon+ Pro), HTC HD2/Leo (Freda)
|
Chaley,
You sir, should indeed be sainted! I will have to look into this further because I will definitely make use of this. Honestly, I don't think many other users understand what you've done. Calibre's current implementation of authors and titles is something I find less than ideal. Because what I've been taught to use, and how it is implemented, are not the same. Starson17, While that might be accurate, if I read that answer first I would only be further confused. |
04-04-2010, 09:04 AM | #14 | ||
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
Quote:
For me it's easier to think about how it really works. |
||
04-04-2010, 06:20 PM | #15 |
Guru
Posts: 644
Karma: 1242364
Join Date: May 2009
Location: The Right Coast
Device: PC (Calibre), Nexus 7 2013 (Moon+ Pro), HTC HD2/Leo (Freda)
|
Starson17
I was taught in the USA. So the library files books under author's LN, FN. Titles beginning with an article of speech are "re-named" for filing purposes, by appending the article of speech to the end of the title. As such, calibre only has a partial implementation, at least from my biased viewpoint, because these things are done, but not implemented, if you understand me. However, calibre has been around longer than I have been dealing with ebooks. It's also used internationally. Perhaps a previous discussion determined that this method was best - all things considered. I have no way of knowing about that. I just find its partial implementation confusing. As to the coding, I figured that you were being "programmatically correct", but despite that, your answer was not clear. Not to me anyway. But then neither was chaley's comment (message #8). Like I said, I can be a bit dense at times. But the implication of what chaley was offering was not clear to me until after he answered my questions (message #10). |
Tags |
author, calibre, firstname, lastname, sorting |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Changing from Title-Author to Author - Title | Amalthia | Calibre | 17 | 01-22-2017 11:20 PM |
looking for a book title and author | Joebill | Reading Recommendations | 16 | 05-23-2010 06:07 AM |
when importing file title metadata screwed up | dschiri1 | Calibre | 1 | 07-25-2009 11:24 AM |
Problems with commas in author field when importing | Halo | Calibre | 5 | 12-05-2008 12:40 AM |
how to embed title and author | gteague | Amazon Kindle | 3 | 11-26-2007 09:45 AM |