Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 02-05-2018, 11:16 AM   #1
DeBig
Junior Member
DeBig began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Jan 2018
Device: Kobo Aura
Book author sort value to author table value ?

Hello,

It is possible to copy the individual author sort values of the author table to book's author sort by using the bulk metadata edit dialog. Good.

But is there a solution for perform the inverse function, copying some book's author sort to the author table, using a bulk command ?

or a python script for Author Management ?

or execute some SQL command directly metadata.db ?

... I'm stuck.
DeBig is offline   Reply With Quote
Old 02-05-2018, 11:23 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,844
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You should be able to use the search and replace tab of the bulk metadata edit dialog for that.
kovidgoyal is online now   Reply With Quote
Old 02-06-2018, 05:26 PM   #3
DeBig
Junior Member
DeBig began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Jan 2018
Device: Kobo Aura
Thank you for your answer, Kovid - but I don't understand well : the replace field in the bulk metadata edit pop-up are the book's metadata fields, not those of the tags table, isn't it ?

My objective is a bulk editing/management of the author table - trying to do that through "<dc:creator opf:role="aut" opf:file-as=Surname, etc. " of epub files (normalized, verified with exceptions)

Actually, if you import an epub with
<dc:creator opf:role="aut" opf:file-as="La Farge, Oliver">Oliver La Farge</dc:creator>
The author table entry will be :
Oliver La Farge - Farge, Oliver La (applying the standard Calibre algorithm)

Denis

Last edited by DeBig; 02-06-2018 at 05:39 PM.
DeBig is offline   Reply With Quote
Old 02-06-2018, 08:10 PM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,844
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
It makes no sense to copy from a books author_sort to the author_sort table. A book can have multiple authors, and there is no guarantee that the books author sort value is decomposable into individual author sort values. Therefore, there is no way to do what you are asking via metadata import. You can control the algorithm calibre uses to derive sort name via Preferences->Tweaks and you can correct individual author sort values by right clicking the author name in the tag browser and choosing "Manage authors". Once you have corrected the value for a particular author, it will remain that way for future imports as well.
kovidgoyal is online now   Reply With Quote
Old 02-06-2018, 08:17 PM   #5
BetterRed
null operator (he/him)
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: 20,559
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by DeBig View Post
Thank you for your answer, Kovid - but I don't understand well : the replace field in the bulk metadata edit pop-up are the book's metadata fields, not those of the tags table, isn't it ?

My objective is a bulk editing/management of the author table - trying to do that through "<dc:creator opf:role="aut" opf:file-as=Surname, etc. " of epub files (normalized, verified with exceptions)

Actually, if you import an epub with
<dc:creator opf:role="aut" opf:file-as="La Farge, Oliver">Oliver La Farge</dc:creator>
The author table entry will be :
Oliver La Farge - Farge, Oliver La (applying the standard Calibre algorithm)

Denis
Simplest way to correct sort names of that kind is via the Manage Authors feature, which you can get to via right clicking on an author name in the Book Details or Tag Browser panels, or via the Configure button at the bottom of the Tag browser

Edit the sort name for the author in question to be as you want it, e.g. La Farge, Oliver; St John, Madeleine; Bonham Carter, Victor, or García Lorca, Federico etc. I included the last two as examples of names that are not the sort of things you want to fix with a tweak. Not all double barrelled are hyphenated and there are rules that define who can hyphenate their names. Any sort names you override will persist.

BR

Last edited by BetterRed; 02-06-2018 at 08:22 PM.
BetterRed is online now   Reply With Quote
Old 02-08-2018, 08:50 AM   #6
DeBig
Junior Member
DeBig began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Jan 2018
Device: Kobo Aura
Kovid, more thanks for your detailed answer, now I have a better understanding of Calibre design of "opf:file-as", an attribute of the book, that may contain references to all authors, and mainly used for directories organization.

I was confused because I based myself on the design of the epub standard, where "opf:file-as" is an attribute of a name, not of the book :

This specification recommends that the content of the creator elements hold the text for a single name as it would be presented to the Reader.
This specification adds to the creator element two optional attributes: role and file-as. The set of values for role are identical to those defined in Section 2.2.6 for the contributor element. The file-as attribute should be used to specify a normalized form of the contents, suitable for machine processing. For example, one might find

<dc:creator opf:file-as="King, Martin Luther Jr." opf:role="aut">Rev. Dr. Martin Luther King Jr.</dc:creator>


This standard is followed by quality epub publishers, such as the Gutenberg project - for instance :

<metadata>
<dc:identifier id="id" opf:scheme="URI">http://www.gutenberg.org/ebooks/52790</dc:identifier>
<dc:creator opf:file-as="Shelley, Mary Wollstonecraft">Mary Wollstonecraft Shelley</dc:creator>
<dc:creator opf:file-as="Shelley, Percy Bysshe">Percy Bysshe Shelley</dc:creator>
...

In substance, this design should be compatible with Calibre, using the opf:file-as of the first author as book_sort information, and the opf:file-as of each author as individual author_sort. I am very aware that a Calibre software update could be an heavy work, and I'm sorry I could not easily participate in this work (Calibre code, python). Hence my request for a bulk editing of the author table...

Bulk editing : I'm tired of doing "Manage Author" individually for each particular name, for each new dedicated Calibre Base !

Denis

Last edited by DeBig; 02-08-2018 at 09:06 AM.
DeBig is offline   Reply With Quote
Old 02-08-2018, 09:11 AM   #7
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,844
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
calibre long predates the epub standard. And incidentally, the epub standard is dead in any case. It's a trivial script to make the change you want to the authors table, using either SQL or the calibre DB API, which is documented in the user manual. For example, to copy author sort to author, something like:

Code:
calibre-debug -c "from calibre.library import db; db = db().new_api; a = db.get_author_data(); n = {aid:v['sort'] for aid, v in a.iteritems()}; db.rename_items('authors', n)"
kovidgoyal is online now   Reply With Quote
Old 02-08-2018, 10:58 AM   #8
DeBig
Junior Member
DeBig began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Jan 2018
Device: Kobo Aura
Thanks, I will snoop on Calibre API (or SQL). I was afraid of side effects.
(epub standard dead, may be, but not the DRM free epub books)
DeBig is offline   Reply With Quote
Reply

Tags
author, author management, sort


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bulk changing author names to author sort in tag browser AussieTupp Library Management 6 02-05-2017 04:22 AM
author → author sort ∀ books ⇒ long time! Geremia Calibre 2 04-17-2013 09:57 AM
Author and author sort fields and importing books guspasho Calibre 3 03-13-2013 11:07 PM
Author field update and author sort derangedhermit Calibre 4 01-23-2013 04:10 AM
using author sort for author - Sony 950 Purple Lady Devices 2 01-29-2011 12:23 AM


All times are GMT -4. The time now is 12:09 AM.


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