Thread: Save to disk
View Single Post
Old 11-26-2024, 11:28 AM   #1
SoboliUcho
Junior Member
SoboliUcho began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Jun 2024
Device: Pocketbook 634
Question Save to disk

Hi
I wan to save export my books with rules.
If they are in series and from one author to author/series/series_series_index-title-authors.epub
If they are in series and have multiple authors to series/series_series_index-title-authors.epub
If is normal to author/title-authors.epub

I tried use calibre template language but id didnt work as i want.

Code:
{program:
def autors_in_series(name):
	ret = 1;
	all_books=book_values('authors', 'series:'&name, ',', 0);
	author = list_item(all_books, 0, ',');
	for book in all_books:
		if author != book then
			ret = 0
		fi
	rof;
	return ret
	fed;

serie = field('series');
if field('series') then
	if autors_in_series(serie)==1 then
		strcat('authors}/{series}/{series} {series_index:0>3s} - {title} - {authors')
	else
		  strcat('series}/{series} {series_index:0>3s} - {title} - {authors')
	fi
else
	strcat('authors}/{title} - {author')
fi;}
when i tried use {} in stracat it dint work at all. (It end with {series}/{series} {series_index:0>3s} - {title} - {authors} filenames)

this code dont work for single author and dont add author name to file and make folder for book file

Can anybody help?
SoboliUcho is offline   Reply With Quote