Mobileread
Using author_sort, title_sort names
#1  meme 02-23-2011, 07:02 AM
While creating a list of Calibre columns to show to users to allow customization, all the regular ones (authors, series, tags, ...) have names associated with them in field_metadata.py (Author(s), Series, Tags... But 'author_sort' doesn't.

I've noticed that 'Author Sort' doesn't appear on the list of columns you can display on the main GUI (e.g. in Preferences->Add your own columns).

"Author Sort" is used in the Edit Metadata screen for a book, so its obviously stored somewhere (though it appears to be hard coded in fetch_metadata). ('title_sort' and 'isbn' are the other fields on Edit Metadata that don't appear as column selections).

Clearly some fields are 'internal', but these 3 seemed inconsistent with the others that are displayed to the user at some point.

For my plugin, I can just ignore author_sort on the basis that it isn't a column they see in the main GUI and the user can simply create a custom column using that value if they really need it. (I can display it for them to use - but they would see 'author_sort' instead of 'Author Sort' unless I hard code the display, which I'll consider)
Reply 

#2  kovidgoyal 02-23-2011, 08:38 AM
See http://calibre-ebook.com/user_manual/faq.html#how-does-app-manage-author-names-and-sorting

author and title sort values are, as their names suggest for sorting, not for displaying to the user.
Reply 

#3  meme 02-23-2011, 10:12 AM
I think then I'll just ignore author_sort in my list. (If I hardcode it and someone names their header Author Sort then I have to deal with that as well). Simplifies the approach.
Reply 

#4  chaley 02-23-2011, 12:01 PM
If you use db2.get_metadata, both author_sort and title_sort are available in the returned dict.

In field_metadata, title_sort is called 'sort'.
Reply 

#5  meme 02-23-2011, 12:12 PM
I see the values there (and I think its title_sort that is 'sort') - but the issue is there is no 'name' assigned to author_sort, unlike say authors, in field_metadata.py. As mentioned, I'll just ignore this - the user doesn't see a column labelled Author Sort, so I won't display it as a column they can use in the plugin.
Reply 

#6  chaley 02-23-2011, 12:17 PM
Ahh.. my bad. I didn't understand the problem.

Do you display composite columns? If so, then you can use them as people do on the library view to see things like author_sort, isbn, etc.
Reply 

#7  meme 02-23-2011, 01:41 PM
Yes, I use composite/custom columns so the user has complete flexibility in the collections they create.
Reply 

Today's Posts | Search this Thread | Login | Register