![]() |
#16 |
Junior Member
![]() 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 |
![]() |
![]() |
![]() |
#17 | |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 114
Karma: 1274
Join Date: Dec 2010
Location: Finland
Device: Kobo Touch
|
Quote:
EDIT: Oh, I did not read this thread fully before responding... Anyway, Kovid was quick to fix this once again. |
|
![]() |
![]() |
Advert | |
|
![]() |
#18 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,343
Karma: 8012652
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. |
![]() |
![]() |
![]() |
#19 | ||||||
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
I should probably look at the code, but since you have a handle on it, I'll ask first.
Quote:
Quote:
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:
Quote:
Quote:
![]() Quote:
I think I know the answers after reading this several times, but just to be sure. Thanks in advance. |
||||||
![]() |
![]() |
![]() |
#20 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,343
Karma: 8012652
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. |
![]() |
![]() |
Advert | |
|
![]() |
#21 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
|
![]() |
![]() |
![]() |
|
![]() |
||||
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 |