Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > KOReader

Notices

Reply
 
Thread Tools Search this Thread
Old 09-02-2024, 07:48 AM   #16
calk
Junior Member
calk began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Sep 2024
Device: Kobo Libra Colour
I'm on mobile so apologies first up for formatting. My first post looks like it failed so trying again. I think you can do this with Calibre's template language and the kobo touch extended plugin.

I'm not a programmer and the documentation on Calibre functions was hard to follow but I've put this together.

> Modify and use this in the device save tenplate settings (Kobo touch extended plugin - save output)

program:
# Template function to check if PDF is the only format
# Use with Kobo plugin to store PDF in a different location to epubs
# Can be modified to include CBR/CBZ as well

book_formats = field('formats');
format_length = count(book_formats,',');
found_format = str_in_list(book_formats, ',', '1', '0');
save_path = '';
if format_length == 1 && found_format == 1 then
save_path = '.pdfs/{author_sort} - {series}{series_index:0>2s| | - }{title} - {authors}'
return save_path
else
save_path = 'books/{author_sort}/{series}/{series}{series_index:0>2s| | - }{title} - {authors}'
return save_path
fi

> Modify this and use this in the kobo touch extended plugin (in the extended settings tab for kepubification) to stop PDFs being kepubified

program:
# Template function to lookup CBZ or CBR Manga file formats
# Use with Kobo plugin where 'epubs' by KCC have been added to the format
# Use to avoid having Kobo plugin convert KCC kepub to kepub
# This uses a custom shelf to check if a book is either in the shelf or if there is a manga file as well - if either are true then don't kepubify
# Can be modified to exclude PDFs as well
book_formats = field('formats');
shelfs = field('#calibre_web_shelf');
found_format = str_in_list(book_formats, ',', 'cbr', 'found cbr', 'cbz', 'found cbz', 'no comic found');
found_shelf = str_in_list(shelfs, ',', 'Graphic-novels', 'found shelf','no shelf found');
if str_in_list(book_formats, ',', 'cbr', 'found cbr', 'cbz', 'found cbz', 'no comic found') || str_in_list(shelfs, ',', 'Graphic-novels', 'found shelf','no shelf found') then
return ''
else
return 'true'
fi
calk is offline   Reply With Quote
Old 10-07-2024, 11:08 PM   #17
camifran
Hija del sol luminoso ☀️
camifran plays well with otherscamifran plays well with otherscamifran plays well with otherscamifran plays well with otherscamifran plays well with otherscamifran plays well with otherscamifran plays well with otherscamifran plays well with otherscamifran plays well with otherscamifran plays well with otherscamifran plays well with others
 
Posts: 7
Karma: 2754
Join Date: Feb 2017
Location: Chile
Device: Kindle Voyage, Kobo Sage, TCL Nxtpaper 11
Quote:
Originally Posted by calk View Post
I'm on mobile so apologies first up for formatting. My first post looks like it failed so trying again. I think you can do this with Calibre's template language and the kobo touch extended plugin.

I'm not a programmer and the documentation on Calibre functions was hard to follow but I've put this together.

> Modify and use this in the device save tenplate settings (Kobo touch extended plugin - save output)

program:
# Template function to check if PDF is the only format
# Use with Kobo plugin to store PDF in a different location to epubs
# Can be modified to include CBR/CBZ as well

book_formats = field('formats');
format_length = count(book_formats,',');
found_format = str_in_list(book_formats, ',', '1', '0');
save_path = '';
if format_length == 1 && found_format == 1 then
save_path = '.pdfs/{author_sort} - {series}{series_index:0>2s| | - }{title} - {authors}'
return save_path
else
save_path = 'books/{author_sort}/{series}/{series}{series_index:0>2s| | - }{title} - {authors}'
return save_path
fi

> Modify this and use this in the kobo touch extended plugin (in the extended settings tab for kepubification) to stop PDFs being kepubified

program:
# Template function to lookup CBZ or CBR Manga file formats
# Use with Kobo plugin where 'epubs' by KCC have been added to the format
# Use to avoid having Kobo plugin convert KCC kepub to kepub
# This uses a custom shelf to check if a book is either in the shelf or if there is a manga file as well - if either are true then don't kepubify
# Can be modified to exclude PDFs as well
book_formats = field('formats');
shelfs = field('#calibre_web_shelf');
found_format = str_in_list(book_formats, ',', 'cbr', 'found cbr', 'cbz', 'found cbz', 'no comic found');
found_shelf = str_in_list(shelfs, ',', 'Graphic-novels', 'found shelf','no shelf found');
if str_in_list(book_formats, ',', 'cbr', 'found cbr', 'cbz', 'found cbz', 'no comic found') || str_in_list(shelfs, ',', 'Graphic-novels', 'found shelf','no shelf found') then
return ''
else
return 'true'
fi
Hi! I tried this but I get the following error:

EXCEPTION: Formatter: if statement: expected 'fi', found 'return' near Unknown on line 12

Could you help me?

I would also want to be able to save both a kepub and pdf version of the same book separately (considering I have both versions beforehand).

Thank you!
camifran is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Elipsa: reading pdfs franklekens Kobo Reader 20 08-26-2021 03:51 AM
KOreader doesn't see most PDFs and EPUBs on reMarkable tablet cavolatan KOReader 2 12-16-2020 02:54 AM
koreader highlighting pdfs UncleInf KOReader 4 07-03-2018 11:24 AM
pdfs: koreader vs aura hd native reader mrmojorizing Kobo Reader 4 08-26-2014 09:48 AM
Are koreader pdfs portable? milmike0 Introduce Yourself 3 07-30-2014 04:52 AM


All times are GMT -4. The time now is 10:18 AM.


MobileRead.com is a privately owned, operated and funded community.