Skip to content

Update kobo.py to include subtitle if field exists in custom columns #3358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dotknott
Copy link

@dotknott dotknott commented Apr 8, 2025

Since Subtitle is becoming more common in Calibre DB setups with Kobo users, I added subtitle to the sync data when there's a custom column labeled 'subtitle'. When no matching column exists it returns an empty string.

@szkafen
Copy link

szkafen commented Apr 9, 2025

In my particular case, I wanted the subtitle field to show the number of pages as, e.g., "256 pages". This solution seems to only like columns with plain text or numbers. I made the #subtitle column be populated with integers from Count Words and it worked, however it only outputed "256", which was only half my desired end goal.

I tried making a new #subtitle column, having it referencing the number column and with the template {#pages:} pages. The output of the column was indeed "256 pages", but sync would fail allways. It seems it doesn't like templates.

However, I found a solution. Going back to making the #subtitle column be the one populated by Count Pages and changing line 440 to return str(subtitleColumn[0].value) + " pages" worked flawlessly, and outputed the desired outcome in the Kobo. Here, " pages" can be changed to the desired word (in my case, since I want to respect Spanish grammar, " páginas"). It could also be changed to return "Pgs: " + str(subtitleColumn[0].value) or whatever to show variants of this output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants