sort issue after converting

Bug #1503683 reported by Katja
This bug affects 1 person
Affects Status Importance Assigned to Milestone
David Forrester

Bug Description

I am using Calibre version 2.40 64bit on Win10 with Kobo Glo HD 3.17.3.
I face an issue with sorting books after converting.

I use book-converting out of the box with some settings in layout section only. This works well as all books looks similar on the reader after that. The fields Titel and Titel-Sort are having same content.
I use kobo utility and extended feature to get kepub which also works fine.
I do not use plugboard.

When I add books to Calibre and load them to the Reader they are sorted by Titel as expected (same sorting in Calibre and the Reader as per attached screen_Calibre). It is German but alphabet is the same.
when I add books to Calibre, CONVERT them and load them to the Reader they are sorted different on the Reader (on the Reader as attached screen_Reader while Calibre is unchanged). The Article (German Der Die Das while english is The) is not used for sorting.

My concern is:
Something is happening during conversion which leads the reader to wrong sorting.

btw: it seems that Kobo Glo HD with 3.17.3 use titel instead of titel_sort but that should not matter for the issue above which is related to before/after converting.

Tags: kobo-driver
Revision history for this message
Katja (katjawy) wrote :
Revision history for this message
Kovid Goyal (kovid) wrote : Re: calibre bug 1503683

Changing the component for this bug.

 assignee davidfor
 tag kobo-driver
 status triaged

Changed in calibre:
assignee: nobody → David Forrester (davidfor)
status: New → Triaged
Revision history for this message
David Forrester (davidfor) wrote :

Firstly, the Kobo devices do not use the "sort" columns. The title and author are loaded into the database from the values of "dc:title" and "dc:creator". The sorting on the device is done using this value in the database. That is also what is displayed.

Title sorting on the device uses "library order", so it is ignoring articles. And the articles used appear to be based on the language of the book (also put into the database).

Looking at the screenshot of the Kobo device, the sort on title is correct. The first and last title start with articles, hence the second word is used for the sort. Without seeing the pre-converted version, I can't be sure what is happening.

The sort in calibre suggests you are either manually setting the title_sort to not use the articles or have used a tweak to change the sorting.

Also, you say you are not using a metadata plugboard. But, it looks like you are. The title on the device appears to have been set using "{title} - {author}".

The only reason I can see that there might be a difference is if you have set the language of the books between the original send and post-conversion send. If these were originally sent to the device with the language set to English, they would have sorted as if "Die" and "Der" were not-articles. I you sent them after the conversion and the language had been set to German, then these would be used as articles. Using the Kobo Utilities plugin to set the metadata on the device could also do this.

And thinking more about this, the following occurred to me:
- Are you using the KoboTouchExtended driver or converting to kepub and sending that?
- Do you have t Kepub metadata writer plugin installed?

Revision history for this message
Katja (katjawy) wrote :

Hi David,
thanks for your time looking in my concerns.

I also find out that kobo is not using sort field, which I feel is wrong but for sure not a calibre issue.

There is a name for that kind of sorting? wow - «library order» - I hate it but again not a calibre issue.

And yes ;-) I use the plugboard but the basic tests are done without. This was a former screen.
My temporary solution is a plugboard entry "-{title} - {author}" as the «-» prevent kobo from finding the article.

I have the following add-ons installed
- kobotouchextended
- koboutilities
- kobobooks
I cannot see any kepub metada writer at all in the list.

For converting I am using from epub to epub, send afterwards to kobo while at the reader kobo.epub arrives.

Looking in the kepub on the reader (unzip on the pc) I cann see that there is a content.opf when it is converted.
But for those without conversion there is a metadata.opf.
Is there anything I can look at or are you interested in those files?

Also the hint with the language could be a good one. The book is «very» German but the download page is not. So maybe that's why there is a different before and after.
Can I use that to get rid of «library order»? The reader should have language German but the books may stay with english. I cannot see why not.
How could I achive that?

Revision history for this message
David Forrester (davidfor) wrote :

Yes, I think the language being set to German is the difference. You can avoid this by setting the language to something else. But, this has other affects. At the least, it will mean the wrong dictionary will be used for the book on the device. You can select the correct dictionary and that will be remembered for that book.

The simplest way to do this is by setting the language in the calibre library. Personally, I wouldn't as I would prefer to have the correct info in the library.

The next way to do it is with a metadata plugboard. This can set the language during the send. If you wanted to be clever, you could probably create a plugboard that checked the first word of the title and only used different language if it was an article.

Another way to do it is to fiddle with the title. There has been a bit of discussion about sorting in the Kobo forums at MobileRead. One of the discussions was how to handle authors whose surnames had two words. And someone else who didn't want "LN FN" to be sorted as "FN, LN". The solution was to replace the space with some other character. The simple way to do it would be to use an underscore. But, I think they tried something else. I think a non-breaking space worked.

The only problem with using a metadata plugboard is that you need an extra plugin to update the metadata in kepubs. You will need the "KePub Metadata Writer" plugin to do this. It is installable from the plugins section of the calibre preference.

Revision history for this message
Katja (katjawy) wrote :

Hi David,
I am impressed about the detailed answer with several options depending on the user knowledge and behaviour and pointing to side effects.

Following the recommendation to keep metadata untouched, I already take half the way of «clever». For now I added a column where I put something in for special-sort. I added the plugin mentioend by you. I use metadata plugboard and refer to new column to adjust language with function «test».
This could be automated but I need to understand the syntax looking into calibre manual. Please do NOT help. I am keen to figure that out by myself.

Now my title order on the reader looks ok (normal alphabeth without extra sign) and this could be easy achived with any further book added. To switch the dictionary to an other in case it is needed and only one-time is a very small side effect to me.

Thanks again and sorry that I assume it was a calibre issue due to converting.
Your grateful Katja.

Revision history for this message
Katja (katjawy) wrote :

Hi David @davidfor
I found a "clever" solution and like to share this with other user as there are several blogs around the same topic: sorting.
What about adding this to
as there are already a lot of nice solutions.

Something like:

Metadata: Show title sorted including article and author by firstname (Kobo)

Kobo (at least Glo HD) ignore title_sort and author_sort fields.
1) Verify title value is not manipulated i.e. showing "The Garden" and not "Garden, The"
2) Verify author values are Firstname Surname.
3) Create a plugboard
format: any
device: any

to get title sorted on the reader without ignoring articles
either add a small sign in front
template: -{title}
destination: title
or replace the language for books with an article
template {title:switch(^The,de,^A,de,{languages})}
destination: language

to get autor sorted on the reader by firstname followed by surname
template: {authors: re( , )}
destination: authors
Please take care that the first space in the brackets is a normal one but the second (behind the comma) is created by pressing ALT key and entering (on number block) 0160

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.