Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 07-12-2025, 02:27 PM   #46
edojan
Connoisseur
edojan can tame squirrels without the assistance of a chair or a whip.edojan can tame squirrels without the assistance of a chair or a whip.edojan can tame squirrels without the assistance of a chair or a whip.edojan can tame squirrels without the assistance of a chair or a whip.edojan can tame squirrels without the assistance of a chair or a whip.edojan can tame squirrels without the assistance of a chair or a whip.edojan can tame squirrels without the assistance of a chair or a whip.edojan can tame squirrels without the assistance of a chair or a whip.edojan can tame squirrels without the assistance of a chair or a whip.edojan can tame squirrels without the assistance of a chair or a whip.edojan can tame squirrels without the assistance of a chair or a whip.
 
Posts: 68
Karma: 11226
Join Date: Mar 2022
Device: Kobo Libra 2, Aura H2O
[QUOTE=chaley;4524192]
Code:
python:
def evaluate(book, context):
	import os
	from calibre.library import current_library_path

	fmt_metadata = book.get('format_metadata')
	if fmt_metadata:
		for v in fmt_metadata.values():
			# A calibre format name is three section, author, title, format.extension
			# We want to return author/format without the extension
			p = v['path']
			r,f = os.path.split(p)
			format = os.path.splitext(f)[0]
			r,title = os.path.split(r)
			r,author  = os.path.split(r)
			return '/'.join((author, format))
	else:
		return 'title - author'
your code works well also! Thank you for your help.
edojan is offline   Reply With Quote
Old 07-12-2025, 08:17 PM   #47
edojan
Connoisseur
edojan can tame squirrels without the assistance of a chair or a whip.edojan can tame squirrels without the assistance of a chair or a whip.edojan can tame squirrels without the assistance of a chair or a whip.edojan can tame squirrels without the assistance of a chair or a whip.edojan can tame squirrels without the assistance of a chair or a whip.edojan can tame squirrels without the assistance of a chair or a whip.edojan can tame squirrels without the assistance of a chair or a whip.edojan can tame squirrels without the assistance of a chair or a whip.edojan can tame squirrels without the assistance of a chair or a whip.edojan can tame squirrels without the assistance of a chair or a whip.edojan can tame squirrels without the assistance of a chair or a whip.
 
Posts: 68
Karma: 11226
Join Date: Mar 2022
Device: Kobo Libra 2, Aura H2O
Quote:
Originally Posted by PeterT View Post
I csn't help but think that you'd get more assistance from the koReader community; presumably others in that community also want to sync across multiple devices.
Yes, there are many great folks there as well. Thanks!
edojan is offline   Reply With Quote
Old Yesterday, 07:10 AM   #48
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,440
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
For future reference, the next calibre release (8.7 or a preview) will contain a template function that can do what the python template does.

formats_path_segments(with_author, with_title, with_format, with_ext, sep)
return parts of the path to a book format in the calibre library separated by ``sep``. The parameter ``sep`` should usually be a slash (``'/'``). One use is to be sure that paths generated in Save to disk and Send to device templates are shortened consistently. Another is to be sure the paths on the device match the paths in the calibre library.

See the manual for full documentation.
chaley is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Calibre's folder structure and long names in Windows crixtiano Calibre 1 07-28-2017 02:05 PM
Calibre taking a long, long time to update metadata on sony prs650 hydin Calibre 5 06-05-2012 12:21 AM
Is there anything in Calibre that can fix long file names automatically? dmunson Calibre 4 02-05-2012 06:12 PM
File Names to long? JTAL604622 Calibre 5 08-31-2011 03:21 AM
Files with long names? cmhsieh54 iRex 0 08-05-2009 12:43 PM


All times are GMT -4. The time now is 09:28 PM.


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