Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 03-08-2015, 01:35 PM   #16
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,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by eschwartz View Post
I would use a sublist, e.g. {authors:sublist(0,1,&)} -- or in GPM,
Code:
a = sublist(
    field('authors'),
    '0',
    '1',
    '&'
);
Except he wants the word "Various" if there are two or more authors.
chaley is offline   Reply With Quote
Old 03-08-2015, 01:40 PM   #17
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Quote:
Originally Posted by chaley View Post
Except he wants the word "Various" if there are two or more authors.
IME using the first author works better, so I felt it had merit as a suggestion. You already explained how to do it with various instead.
eschwartz is offline   Reply With Quote
Advert
Old 03-08-2015, 01:53 PM   #18
Thomas_AR
Zealot
Thomas_AR began at the beginning.
 
Thomas_AR's Avatar
 
Posts: 131
Karma: 10
Join Date: Jan 2015
Location: Buenos Aires
Device: Android
Thanks for all your help folks.
@chaley: your provides strings with various does not work, i still get different series - author folders. I think i have to put more time in this which i do not have for now

BTW, it is not so important to put a Various or first author to the folder name in case of various authors, there could be none, but in case there is only ONE author i would like to have the author after the series name in the folder.

For now i think i stay with a simple series folder
Thanks again

Last edited by Thomas_AR; 03-08-2015 at 01:57 PM.
Thomas_AR is offline   Reply With Quote
Old 03-08-2015, 02:00 PM   #19
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Yes, and I solve the problem by truncating the authors field after the first author.
That might or might not work for you -- it does for me.

Usually happens with anthologies for me, in which case I get the editor.
eschwartz is offline   Reply With Quote
Old 03-08-2015, 02:18 PM   #20
Thomas_AR
Zealot
Thomas_AR began at the beginning.
 
Thomas_AR's Avatar
 
Posts: 131
Karma: 10
Join Date: Jan 2015
Location: Buenos Aires
Device: Android
Quote:
Originally Posted by eschwartz View Post
Yes, and I solve the problem by truncating the authors field after the first author.
That might or might not work for you -- it does for me.

Usually happens with anthologies for me, in which case I get the editor.
Sorry i may not be on top of this. What do you mean?
Thomas_AR is offline   Reply With Quote
Advert
Old 03-08-2015, 02:58 PM   #21
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
My save template:
Code:
{author_sort:sublist(0,1,&)}/{title}/{title} - {authors:sublist(0,1,&)}
Same as the default, except if there are multiple authors, then the sublist function ensures only the first author is used.

Example:
The Way of the Wizard, by:
John Joseph Adams & George R. R. Martin & David Barr Kirtley & Susanna Clarke & Delia Sherman & Jeffrey Ford & C. C. Finlay & Rajan Khanna & Genevieve Valentine & Nnedi Okorafor & Krista Hoeppner Leahy & Orson Scott Card & Robert Silverberg & Wendy N. Wagner & Kelly Link & Neil Gaiman & Christie Yant & Mike Resnick & Cinda Williams Chima & Adam-Troy Castro & Yoon Ha Lee & Lev Grossman & Simon R. Green & T. A. Pratt & Jeremiah Tolbert & Jonathan L. Howard & David Farland & Vylar Kaftan & Desirina Boskovich & Peter S. Beagle & Ursula K. Le Guin & John R. Fultz & Marion Zimmer Bradley

Obviously, that is a bad time to be saving all authors as the filename.

So sublisting the authors field means it gets sent as "Adams, John Joseph/The Way of the Wizard/The Way of the Wizard - John Joseph Adams.azw3"

This is a massive improvement over:

Spoiler:

Adams, John Joseph & Martin, George R. R. & Kirtley, David Barr & Clarke, Susanna & Sherman, Delia & Ford, Jeffrey & Finlay, C. C. & Khanna, Rajan & Valentine, Genevieve & Okorafor, Nnedi & Leahy, Krista Hoeppner & Card, Orson Scott & Silverberg, Robert & Wagner, Wendy N. & Link, Kelly & Gaiman, Neil & Yant, Christie & Resnick, Mike & Chima, Cinda Williams & Castro, Adam-Troy & Lee, Yoon Ha & Grossman, Lev & Green, Simon R. & Pratt, T. A. & Tolbert, Jeremiah & Howard, Jonathan L. & Farland, David & Kaftan, Vylar & Boskovich, Desirina & Beagle, Peter S. & Guin, Ursula K. Le & Fultz, John R. & Bradley, Marion Zimmer/The Way of the Wizard/The Way of the Wizard - John Joseph Adams & George R. R. Martin & David Barr Kirtley & Susanna Clarke & Delia Sherman & Jeffrey Ford & C. C. Finlay & Rajan Khanna & Genevieve Valentine & Nnedi Okorafor & Krista Hoeppner Leahy & Orson Scott Card & Robert Silverberg & Wendy N. Wagner & Kelly Link & Neil Gaiman & Christie Yant & Mike Resnick & Cinda Williams Chima & Adam-Troy Castro & Yoon Ha Lee & Lev Grossman & Simon R. Green & T. A. Pratt & Jeremiah Tolbert & Jonathan L. Howard & David Farland & Vylar Kaftan & Desirina Boskovich & Peter S. Beagle & Ursula K. Le Guin & John R. Fultz & Marion Zimmer Bradley.azw3


Going back to the original template:

Code:
{series:'test($, strcat("_", field('series'), " - ",field('authors')), field('authors'))'}/{series_index:0>4s| | - }{title} - {authors}
I would use

Code:
{series:'test($, strcat("_", field('series'), " - ",sublist(field('authors'),0,1,&)), sublist(field('authors'),0,1,&))'}/{series_index:0>4s| | - }{title} - {authors:sublist(0,1,&)}
All books will pretend, for the purposes of the save filename, that they only have one author -- the first. As long as the series' in question share the first author in common, this should work. (There are series' out there that are written by multiple people as a collaborative effort. But then, those series' are just as likely to have one author per book, in which case the problem would be there anyway.)

Last edited by eschwartz; 03-08-2015 at 03:04 PM.
eschwartz is offline   Reply With Quote
Old 03-08-2015, 03:14 PM   #22
Thomas_AR
Zealot
Thomas_AR began at the beginning.
 
Thomas_AR's Avatar
 
Posts: 131
Karma: 10
Join Date: Jan 2015
Location: Buenos Aires
Device: Android
Thanks again.
Tried:
Code:
{series:'test($, strcat("_", field('series'), " - ",sublist(field('authors'),0,1,&)), sublist(field('authors'),0,1,&))'}/{series_index:0>4s| | - }{title} - {authors:sublist(0,1,&)}
But i get following in the template editor:
EXCEPTION: Formatter: failed to scan program. Invalid input &)), sublist(field('authors'),0,1,&)) near (
Thomas_AR is offline   Reply With Quote
Old 03-08-2015, 03:43 PM   #23
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Whoopsies, I got confused between the different template modes -- function mode doesn't require quote, template program mode (TPM) and general program mode (GPM) do.

That should've been:
Code:
{series:'test($, strcat("_", field('series'), " - ",sublist(field('authors'),'0','1','&')), sublist(field('authors'),'0','1','&'))'}/{series_index:0>4s| | - }{title} - {authors:sublist(0,1,&)}
And in GPM:
Code:
program:

short_authors = sublist(field('authors'), '0', '1', '&');
sindex = finish_formatting(field('series'), '0>4s', '', ' - ');

strcat(
	test(
		field('series'),
		strcat("_", field('series'), " - ", short_authors),
		short_authors
	),
	'/', sindex, field('title'), ' - ', short_authors)
eschwartz is offline   Reply With Quote
Old 03-08-2015, 05:29 PM   #24
Thomas_AR
Zealot
Thomas_AR began at the beginning.
 
Thomas_AR's Avatar
 
Posts: 131
Karma: 10
Join Date: Jan 2015
Location: Buenos Aires
Device: Android
This is getting funny. Just tested both of your posted templates/program.
Still got different folders "series - author" for each author.
Well perhaps it would be easier to do something like:
If series has different authors folder name has only series name, if one author we will get "series - author".
But do not worry folks , for now i am happy with the easy series folder name for all.

Later i will read more of the tutorial, perhaps i find the thinking problem or a more elegant solution.
Thanks again for your help and patience.
Thomas_AR is offline   Reply With Quote
Old 03-09-2015, 05:07 AM   #25
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,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
@Thomas_AR: are you testing the templates by sending a book to the device that is already on the device? If so, then you are probably running into a calibre wireless device driver feature that prevents duplicate books on the device when metadata changes. If the WD detects a book with the same unique ID (UUID) and format already on the device then the template is ignored and the current path on the device is used.

There are two ways to avoid this behavior.
  1. Delete the book from the device before you resend it. If you delete the book using calibre then you must disconnect and reconnect so calibre forgets about the book. If you delete it in CC then it should be forgotten as of the next connect.
  2. Totally turn off this behavior by unchecking the option "Replace books with same calibre ID" in the wireless device driver configuration.
Note that if you choose the second option then you will likely end up with the same book in CC multiple times, once for each different path generated by the template.
chaley is offline   Reply With Quote
Old 03-09-2015, 06:52 PM   #26
Thomas_AR
Zealot
Thomas_AR began at the beginning.
 
Thomas_AR's Avatar
 
Posts: 131
Karma: 10
Join Date: Jan 2015
Location: Buenos Aires
Device: Android
Thanks for your answer.
yes i always delete the book via Calibre on CC, restart both applications, and those books have a unique id and i have option "Replace books with same calibre ID" as i have epub and comics with the same name.
next weekend i will have a closer look at all this again.
Thanks again for your help.
Thomas
Thomas_AR is offline   Reply With Quote
Old 03-09-2015, 11:19 PM   #27
Thomas_AR
Zealot
Thomas_AR began at the beginning.
 
Thomas_AR's Avatar
 
Posts: 131
Karma: 10
Join Date: Jan 2015
Location: Buenos Aires
Device: Android
Well here we go again, i am going to make it less complicated - LOL:

I noticed that the only series i have which contain various authors are those who contain in the series name "Rhodan"
New goal is now:
1. Series with various Authors: _ Series/0001 - title - author
2. Series with one author: _ Series - Author/0001 - title - author
3. Books with no series: author/Title - author

Using:
Code:
{series:|_ |} {series:contains(Perry Rhodan,, - )} {series:lookup(Perry Rhodan,,authors)}/{series_index:0>4s| | - }{title} - {authors}
Everything is working fine but example 3.
I get "- author/title - author.
There should not be a "-" in front of the author folder-name.

I am getting crazy

Thomas

Last edited by Thomas_AR; 03-09-2015 at 11:36 PM.
Thomas_AR is offline   Reply With Quote
Old 03-09-2015, 11:55 PM   #28
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Err, because if series doesn't contains() the text "Perry Rhodan", you replace series with " - " -- that also applies if the series is just plain empty...

Try:

Code:
{series:'in_list($, "&", "Perry Rhodan", strcat($, ' - '), $)'|_ | }{series:lookup(Perry Rhodan,,authors)}/{series_index:0>4s| | - }{title} - {authors}

Last edited by eschwartz; 03-10-2015 at 12:11 AM.
eschwartz is offline   Reply With Quote
Old 03-09-2015, 11:58 PM   #29
Thomas_AR
Zealot
Thomas_AR began at the beginning.
 
Thomas_AR's Avatar
 
Posts: 131
Karma: 10
Join Date: Jan 2015
Location: Buenos Aires
Device: Android
Code:
{series:'in_list($, "Perry Rhodan", strcat($, ' - '), $)'|_ |}{series:lookup(Perry Rhodan,,authors)}/{series_index:0>4s| | - }{title} - {authors}
GETTING: EXCEPTION: Formatter: incorrect number of arguments for function in_list near )

Last edited by Thomas_AR; 03-10-2015 at 12:02 AM.
Thomas_AR is offline   Reply With Quote
Old 03-10-2015, 12:12 AM   #30
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Fixed. Today is stupid-typos-day I see...

(rant: I fixed that twice in the template tester in calibre -- it still migrated to my post! What the....)
eschwartz is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Send to device - Template help Snow Sciles Library Management 12 05-26-2014 05:16 PM
Generic "Sending to Device" template not kicking in on Folder Device At_Libitum Library Management 2 11-01-2013 07:12 AM
Save to Device template HFC3 Library Management 6 07-08-2013 11:48 AM
Save template for sending books to Kindle 3 Eaglebeak60 Devices 2 02-14-2011 06:12 PM
Send to device template rockeh Calibre 6 08-17-2010 05:28 PM


All times are GMT -4. The time now is 12:44 PM.


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