Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 10-15-2012, 08:33 AM   #1
ZaMotH
Junior Member
ZaMotH began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Sep 2011
Device: IQ pocketbook
Export to disk, using functions

Hi all,

I export all my ebooks to a file system, structed by folders. I have 2 ruleset for exporting :
- Export by name :
Code:
{authors:.1}/{authors}{series:| - |/{series_index:0>2s}} - {title}
- Export by series (when multiple authors work on same series) :
Code:
-Series-/{series}/{series_index:0>2s} - {title} \[{authors}\]
To seperate both, I added a tag : "By series"

Now, I would like to do all of this at one time, and I tried to look over functions, but somehow, when the query gets complicated, the export crashes :
This works
Code:
{tags:contains(By_series,-Series-/,{authors:.1}/)}{title}
In bold, the added statement which makes it not not work anymore
Code:
{tags:contains(By_series,-Series-/,{authors:.1}/{title}/)}{title}
Throwing the following error
Code:
calibre, version 0.9.1
ATTENTION : Impossible d’enregistrer certains livres: Impossible d’enregistrer certains livres, Cliquer le bouton afficher les détails pour voir lesquels.

Le Gardien de la Pierre
	Traceback (most recent call last):
	  File "site-packages\calibre\library\save_to_disk.py", line 434, in save_serialized_to_disk
	  File "site-packages\calibre\library\save_to_disk.py", line 306, in do_save_book_to_disk
	ValueError: A échoué à calculer le chemin pour enregistrer sur le disque. Modèle : {tags:contains(Export_Par_Serie,-Series-/,{authors:.1}/{title}/)}{title}
	Erreur : Incorrect number of arguments for function contains

... And 1 block like this for every ebook ...
Of course, what I would have liked to be able to do was (added return for better read) :
Code:
{tags:contains(By_series,
-Series-/{series}/{series_index:0>2s} - {title} \[{authors}\],
{authors:.1}/{authors}{series:| - |/{series_index:0>2s}} - {title})
Maybe I should not use tags ? Maybe I should use another function ? If any one could advise me, I would greatly thanks him/her.

Best regards,
Thomas
ZaMotH is offline   Reply With Quote
Old 10-15-2012, 11:01 AM   #2
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: 11,725
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
You are using a sub-template as a function argument, something that frequently breaks things. That is why the documentation for single function mode says you are not supposed to do that.

You should use general program mode. In GPM, your last template would be something close to:
Code:
program: 
	contains(field('tags'), 'By_series', 
		template('-Series-/{series}/{series_index:0>2s} - {title} [{authors}]'),
		template('{authors:.1}/{authors}{series:| - |/}{series_index:0>2s} - {title}'))
I changed the second template so that it does not use a subtemplate for series_index.
chaley is offline   Reply With Quote
Advert
Old 10-18-2012, 08:27 AM   #3
ZaMotH
Junior Member
ZaMotH began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Sep 2011
Device: IQ pocketbook
Hi,

Made a small mistake by willing to remove the "program:" ident, but after some 1 minute reading, I understood this was needed.

So now my exports works perfectly. I also wanted to try some advanced features, but after some reading, since I never coded in anything else than vbs and powershell, I left my export as is. If I have 30 minutes to spend, I will try to look deeper at it and increase my regex skills.

Regards
Thomas
ZaMotH is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Certain Functions of Calibre Not Working? BasilGrows Calibre 1 06-08-2012 12:14 AM
Functions not found when used in Export script Arco Witter Library Management 8 09-24-2011 04:41 PM
Most often used calibre functions thearr Calibre 17 08-07-2011 02:44 PM
what's the latest kindle? and functions? nelson7lim Amazon Kindle 2 08-03-2010 08:09 PM
New functions poco06 Calibre 4 05-01-2010 01:39 PM


All times are GMT -4. The time now is 02:23 AM.


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