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

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 11-07-2011, 07:39 PM   #16
Joe42
Junior Member
Joe42 began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Nov 2011
Device: Nook Color
Kovid has found and fixed the bug. It will be in the next release. Thank you everyone for trying to help.

Code:
https://bugs.launchpad.net/calibre/+bug/887141

Last edited by Joe42; 11-07-2011 at 09:55 PM. Reason: update
Joe42 is offline   Reply With Quote
Old 11-08-2011, 12:11 AM   #17
GoingDown
Zealot
GoingDown is no ebook tyro.GoingDown is no ebook tyro.GoingDown is no ebook tyro.GoingDown is no ebook tyro.GoingDown is no ebook tyro.GoingDown is no ebook tyro.GoingDown is no ebook tyro.GoingDown is no ebook tyro.GoingDown is no ebook tyro.
 
Posts: 114
Karma: 1274
Join Date: Dec 2010
Location: Finland
Device: Kobo Touch
Quote:
Originally Posted by chaley View Post
@goingdown: you don't say which version of calibre you are using. It would be useful to know whether or not the authors Unknown and unknown both simultaneously exist and if so whether the author_sort values for these two authors are defined, something you can see using "manage authors" (right-click on an author in the tag browser and choose "manage authors"). It also would be useful to know what the author_sort value is for a failing book after you make the change, and whether calibre considers that value as correct (not pink) -- both of these can be seen using edit metadata.
Using newest Calibre (linux binary install). Also, I did change author to "Unknown" and then recalculated author_sort every time I did my testing (with that arrow button). My tweak author_sort_copy_method = 'comma'

EDIT: Oh, I did not read this thread fully before responding... Anyway, Kovid was quick to fix this once again.
GoingDown is offline   Reply With Quote
Advert
Old 11-08-2011, 05:57 AM   #18
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,703
Karma: 6658935
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Note that the bug fixed might not be what you think it is.

The problem was that calibre was not consistent is setting author_sort for 'null' authors. The GUI set author_sort correctly, but it was erased when copied to one of the subprocesses such as save-to-disk or send-to-device. This caused the author_sort value to be erased no matter what it was set to in the GUI or no matter what was in the database. The fix is to make the two processes consistent. Creating a metadata record for a book with a null author will now set author and author_sort to the same value, which is what the GUI does.

There are at least two side effects. One is that changing the author_sort for a book with author "Unknown" will not have any effect on save/send. If the author is null (Unknown), then the author_sort will be "Unknown" as well. I might take a look at the GUI to prevent changing author_sort for a null author, but I suspect that there would be ways around it. Second is that people who depended on author_sort being empty for null authors will need to adapt their template.

Setting the author_sort to empty for a book with a non-null author should work correctly. The empty author_sort will be passed around just like any other author_sort.
chaley is offline   Reply With Quote
Old 11-08-2011, 10:26 AM   #19
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 chaley View Post
Note that the bug fixed might not be what you think it is.
I should probably look at the code, but since you have a handle on it, I'll ask first.
Quote:
The problem was that calibre was not consistent is setting author_sort for 'null' authors. The GUI set author_sort correctly,
By "correctly" do you mean that the GUI entered "Unknown" into both author and author_sort or do you mean that it entered Unknown into Author (instead of null) and entered whatever was specified for author_sort (null, Unknown, or something else) into author_sort? I suspect the latter.

Quote:
but it was erased when copied to one of the subprocesses such as save-to-disk or send-to-device.
By "erased" do you mean:
1) a null author caused a null author_sort regardless of how author_sort was set, (I'm not sure how this could happen - null authors weren't allowed) or
2)an Unknown author caused author_sort to be set to Unknown regardless of its value. Or what?
Quote:
This caused the author_sort value to be erased no matter what it was set to in the GUI or no matter what was in the database. The fix is to make the two processes consistent. Creating a metadata record for a book with a null author will now set author and author_sort to the same value, which is what the GUI does.
And that value is "Unknown" or the local language equivalent.
Quote:
There are at least two side effects. One is that changing the author_sort for a book with author "Unknown" will not have any effect on save/send.
So if I get this, if Author is "Unknown" in the db (which is what you get if you try to set it to null) and author_sort is something else (null or whatever) you always get author_sort set to "Unknown" on a save or send?

Quote:
If the author is null (Unknown), then the author_sort will be "Unknown" as well.
That seems to be what you said
Quote:
Setting the author_sort to empty for a book with a non-null author should work correctly. The empty author_sort will be passed around just like any other author_sort.
So the OP would still get his error on author_sort[0] if he set an author_sort to null for anything other than author=Unknown?

I think I know the answers after reading this several times, but just to be sure. Thanks in advance.
Starson17 is offline   Reply With Quote
Old 11-08-2011, 11:24 AM   #20
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,703
Karma: 6658935
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
@starson17: it is easiest to explain this if I drop fairly deep into the technology.

The problem arises because of how instances of the Metadata class are initialized and copied. When you create a new Metadata instance, both title and author are set to a "null" value, which is the word 'Unknown' translated as appropriate. Adding information to the instance is done in a combination of two ways, directly setting attributes or calling 'smart_update' with a dictionary of attributes. Save-to-disk and send-to-device use the latter form, for several reasons I won't go into here.

Smart update looks at the data in the source instance to see if it should be copied. If the author is null (== the translated null value), then neither author nor author_sort are copied to the destination Metadata instance. The destination is left with the values it originally had, which in the case of a new instance are the original null values. Before the fix, the original null value for author_sort was the empty string. Now it is "Unknown".

The GUI code predates the Metadata structure by quite some time, and it does things differently. First, the database cache is the prime collection of metadata, organized in rows. Second, there isn't a convenient way to copy metadata around, something that Metadata provides. Third, there is no central place that checks for null entries. Import and copy take care of their end as do some methods in db2, ensuring that "Unknown" ends up where it should, but that doesn't stop editing. Nothing stops a user from changing the author_sort for a book with a null author.

Instances of Metadata are used more and more (just look for calls to db2.get_metadata), but for the moment do not play a major role in the GUI. It is relatively easy to have differences in semantics between Metadata and db2 in particular.

Regarding author_sort[0], if the author is not null (!= 'Unknown'), then the author_sort from the db is copied by smart_update. Author_sort[0] will still toss exceptions in this case.
chaley is offline   Reply With Quote
Advert
Old 11-08-2011, 12:57 PM   #21
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 chaley View Post
@starson17: it is easiest to explain this if I drop fairly deep into the technology.
Thanks for the explanation. I remember looking at smart_update a few times and your explanation helps put it into context regarding the OP's issue and Kovid's change.
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
Field "author(s)" vanishes when attached to reader DrChiper Calibre 2 09-23-2011 04:10 PM
"Unknown Author" and can't open when transferring to Nook unclelobsterman Calibre 4 02-08-2011 02:31 PM
Problem "saving to disk" pdf files lucone Calibre 1 06-28-2010 05:29 AM
Rebuild "author sort" field enriquep Calibre 2 07-24-2009 11:21 AM
Newbie question for Calibre: "Unknown Book Type" error rvdparis Calibre 8 04-28-2009 04:20 AM


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


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