View Single Post
Old 07-18-2022, 10:32 PM   #862
Deobulakenyo
Guru
Deobulakenyo ought to be getting tired of karma fortunes by now.Deobulakenyo ought to be getting tired of karma fortunes by now.Deobulakenyo ought to be getting tired of karma fortunes by now.Deobulakenyo ought to be getting tired of karma fortunes by now.Deobulakenyo ought to be getting tired of karma fortunes by now.Deobulakenyo ought to be getting tired of karma fortunes by now.Deobulakenyo ought to be getting tired of karma fortunes by now.Deobulakenyo ought to be getting tired of karma fortunes by now.Deobulakenyo ought to be getting tired of karma fortunes by now.Deobulakenyo ought to be getting tired of karma fortunes by now.Deobulakenyo ought to be getting tired of karma fortunes by now.
 
Posts: 706
Karma: 2153490
Join Date: Aug 2021
Location: Stupid Philippines
Device: Kobo Libra 2, Boyue Likebook P78
Quote:
Originally Posted by allanahk View Post
These are all sideloaded books, and the subtitle info is generated in Calibre. It requires the Kobo Touch Extended driver to put the info of your choice into the subtitle metadata when sending books to your device.

If you want the same setup as I have, you will need the Count Pages plugin which puts the word count into a custom column usually called #words (instructions are in the linked thread). Then in the Kobo touch extended driver configuration, go to "Metadata, on device & advanced", tick "Subtitle", and paste the following into the template editor:

Spoiler:

program:

int_words = raw_field('#words');

# return wordcount in terms of million, e.g. 1m, 1.2m etc
if int_words ># 995000 then
int_words2 = divide(int_words,1000000);
str_words = strcat(format_number(int_words2, '{0: 2.1f}'), '');
if '0' in str_words then
sf_words = format_number(int_words2, '{0: 2.0f}')
else
sf_words = format_number(int_words2, '{0: 2.1f}')
fi;
word_count = strcat(sf_words, 'm')
# wordcount in terms of thousands, e.g. 120k, 230k etc
elif int_words ># 10000 then
int_words2 = divide(int_words,10000);
sf_words = format_number(int_words2, '{0: 2.0f}');
word_count = strcat(sf_words, '0k')
elif int_words ># 1 then
int_words2 = divide(int_words,1000);
sf_words = format_number(int_words2, '{0: 2.0f}');
word_count = strcat(sf_words, 'k')
fi;

subtitle = strcat(field('#genre'), ' |', word_count, ' words')


Note that I have a separate genre column that I use, but you could also use tags - just replace field('#genre') with field('tags') (without the # symbol). You can put any column info that you like! The Calibre template language is quite powerful.

I tried using your settings and this is what i got:

Plugboard Template error

Now I can't remove the error displaying

Edit: Got it working now.
Attached Thumbnails
Click image for larger version

Name:	screen_033.png
Views:	391
Size:	343.4 KB
ID:	195126  

Last edited by Deobulakenyo; 07-18-2022 at 10:54 PM.
Deobulakenyo is offline   Reply With Quote