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 09-25-2019, 11:35 AM   #1
Horus68
Zealot
Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.
 
Horus68's Avatar
 
Posts: 143
Karma: 76596
Join Date: Feb 2015
Location: Portugal
Device: Kobo Aura HD
Saving to disk file name - using just the first author

I wasn't able to find a previous answer to this, so here it goes!

I think I know how to change file and folder names when saving to disk.
I have a book with 2 authors but I want only the first one be used in the folder/file name when saving to disk

The author_sort and the author fields outputs as
Code:
Doe, John & Jane, Mary
but I want it to just outputs the first author as in
Code:
Doe, John

Saving to disk template:
using
Code:
{author_sort}/{author_sort:.80}{title:.60| - |}/{author:.70}{series:.25| - |}{series_index:0>2s| - |}{title:.50| - |}
Code:
Doe, John & Jane, Mary\Doe, John & Jane, Mary - My own history\John Doe & Mary Jane - My collection - 01 - My own history.pdf

Note: In metadata editor I do have for authors
Code:
John Doe & Mary Jane
and the author sort field as
Code:
Doe, John & Jane, Mary
Is it supposed to have just one name in the author sorted field?
Attached Thumbnails
Click image for larger version

Name:	authors_My own history.png
Views:	188
Size:	6.8 KB
ID:	173698  

Last edited by Horus68; 09-25-2019 at 11:40 AM.
Horus68 is offline   Reply With Quote
Old 09-25-2019, 12:21 PM   #2
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,054
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Author sort is normally just the sort version of the Authors field.
2 names = 2 sort names (and these are really 2 name entries in the Authors Table)
The DB stores an Author Index record for each one separated by the &

& is a separator to Calibre Authors parsing.
I know you can use the advanced sublist function for Tag-like (,) But I don't know if you can use it on Authors

https://manual.calibre-ebook.com/gen...-val-separator
theducks is offline   Reply With Quote
Advert
Old 09-25-2019, 02:39 PM   #3
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 46,190
Karma: 168983734
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
You might try this as part of your template: {author_sort:sublist(0,1,&)} which I use as part of my save to disk and send to device templates. I'm not certain from what you wrote if you want this to show in the calibre library list view or in a save to disk template. If you use a custom author sort column built from other columns, this should work for the calibre library view.

Edit: added image of custom author sort column.
Attached Thumbnails
Click image for larger version

Name:	author_sort_custom_column.png
Views:	377
Size:	19.8 KB
ID:	173700  

Last edited by DNSB; 09-25-2019 at 02:47 PM.
DNSB is offline   Reply With Quote
Old 09-26-2019, 05:52 AM   #4
Horus68
Zealot
Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.
 
Horus68's Avatar
 
Posts: 143
Karma: 76596
Join Date: Feb 2015
Location: Portugal
Device: Kobo Aura HD
Thanks for both replies.
I'm ok with the way Calibre displays the information and also how it organizes (the calibre directory file names)
I just want to change the file name after "saving to disk" feature.
This because sometimes I have more than one author for a book but I want to export the pdf file for sharing with others and I do not want to have a long file name
Horus68 is offline   Reply With Quote
Old 09-26-2019, 08:05 AM   #5
Horus68
Zealot
Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.
 
Horus68's Avatar
 
Posts: 143
Karma: 76596
Join Date: Feb 2015
Location: Portugal
Device: Kobo Aura HD
Using the tip from @DNSB I was able to "save to disk" a pdf file using only the first author for the file and folder names:

My save to disk tempalte:
Code:
{author_sort:sublist(0,1,&)}/{author_sort:sublist(0,1,&)}{title:.60| - |}/{author_sort:sublist(0,1,&)}{series:.25| - |}{series_index:| - |}{title:.55| - |}
The file and folder structure output is:
Code:
Doe, John\Doe, John - My own history\Doe, John - My collection - 1 - My own history.pdf
Note:
I can't use in this template, to always saves the series number with 2 number format, the code
Code:
{series_index:0>2s| - |}
I can only use
Code:
{series_index:| - |}
The series code for numers as "01, 02, 03) instead of 1,2,3 works fine in the template if I don't use the sublist code
Code:
{author_sort:sublist(0,1,&)}
more than once in the template code.
But I can live with that!

Last edited by Horus68; 09-26-2019 at 08:11 AM.
Horus68 is offline   Reply With Quote
Advert
Old 09-26-2019, 09:58 AM   #6
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,054
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
The reason for using fixed number of digits in the series index is so:
it will (alpha) sort in the correct order, instead of 1,10,2,20...
If you don't care about sort order
theducks is offline   Reply With Quote
Old 09-26-2019, 10:30 AM   #7
Horus68
Zealot
Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.
 
Horus68's Avatar
 
Posts: 143
Karma: 76596
Join Date: Feb 2015
Location: Portugal
Device: Kobo Aura HD
Quote:
Originally Posted by theducks View Post
If you don't care about sort order
I do care... only I'm not able to implement it with the "save to disk" template I used.
Take my statement "I can live with it" as in" its not perfect but is the best I can do"!
I don't know any language code so I was not able to make it work in full!
Horus68 is offline   Reply With Quote
Old 09-26-2019, 10:50 AM   #8
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,054
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by Horus68 View Post
I do care... only I'm not able to implement it with the "save to disk" template I used.
Take my statement "I can live with it" as in" its not perfect but is the best I can do"!
I don't know any language code so I was not able to make it work in full!
You say you don't want 2 digits, but you want it to sort
NOTHING on Calibres end is going to change FILESYSTEM sorting rules

A filename is always Alpha-numeric: sorted by character weight, left to right
That is why it is 02 and not just a 2 (<space>2 would sort, but this causes cross platform and passing filename issues. So we avoid it )
theducks is offline   Reply With Quote
Old 09-26-2019, 12:00 PM   #9
Horus68
Zealot
Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.
 
Horus68's Avatar
 
Posts: 143
Karma: 76596
Join Date: Feb 2015
Location: Portugal
Device: Kobo Aura HD
I'm not an English user so something was lost in translation.
See attached print screens!

I want to sort series the proper way when saving to disk.
In Save to disk I used
Code:
{series_index:0>2s| - |}
taken from here... https://manual.calibre-ebook.com/template_lang.html

It works fine and the output is a proper two digits with trailing zeros
Code:
- 02 -
BUT... when using that code in my template it doesn't allow to save the code as there is a parsing error when hitting the button APPLY (the template editor do not shows any error)

This code can be saved in Calibre "Save to disk" template
Code:
{author_sort:sublist(0,1,&)}/{author_sort:sublist(0,1,&)}{title:.60| - |}/{author_sort:sublist(0,1,&)}{series:.25| - |}{series_index:| - |}{title:.55| - |}
BUT this code (with trailing zeros for series) cannot be saved in Calibre "Save to disk" template

Code:
{author_sort:sublist(0,1,&)}/{author_sort:sublist(0,1,&)}{title:.60| - |}/{author_sort:sublist(0,1,&)}{series:.25| - |}{series_index:0>2s| - |}{title:.55| - |}
In the editor popup it works fine but in the main window, the apply button fires an error:
The error says something like "The template contains no {fields}"

So I know that something is wrong... only I don't know what!
Note: Using Calibre 3.48.0 windows x86
Attached Thumbnails
Click image for larger version

Name:	editor_no_trailingzeros_working_en.png
Views:	223
Size:	43.5 KB
ID:	173731   Click image for larger version

Name:	editor_trailingzeros_editor_working_en.png
Views:	173
Size:	13.6 KB
ID:	173732   Click image for larger version

Name:	template_trailingzeros_not saving_en.png
Views:	418
Size:	67.6 KB
ID:	173733  

Last edited by Horus68; 09-26-2019 at 12:14 PM.
Horus68 is offline   Reply With Quote
Old 09-26-2019, 12:44 PM   #10
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,054
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Ah! Leading Zeros. They are in front.

I have never used the type (.##) of formatting you show \ (You can tell I am not an expert)

I use (but my other requirements are simpler)
Code:
{series_index:0>5.2f}
is what I use so I get: 12.34 (2 leading and 2 trailing the . )

BTW spaces in file names should be avoided ( - ) ->(-)


Code:
{title:.60| - |}/
You are ending a title with a - then making a folder?
theducks is offline   Reply With Quote
Old 11-04-2019, 08:20 AM   #11
Horus68
Zealot
Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.Horus68 understands the mechanisms of the catecholamine pathways.
 
Horus68's Avatar
 
Posts: 143
Karma: 76596
Join Date: Feb 2015
Location: Portugal
Device: Kobo Aura HD
Just for an update, this is my actual template (and a work in progress!)

Example book:
Title: The Working Title: in Progress
Authors: John Doe Livingstone & Jane Doe Bernadette
Series: My series title with several words
Series Number: 1.00
Date: 2019


"Save to disk" Template
Code:
{author_sort:.20s:sublist(0,1,&)}/{author_sort:.28s:sublist(0,1,&)}{title:re(\,,_)|--|}/{author_sort:.28s:sublist(0,1,&)}{pubdate:| (|)}{series:.20s| [|}{series_index:0>2s|-|]}{title:.50:re(\,,_)|--|}

Output is
Code:
Author Sort/Author Sort--Title/Author Sort [Series-03]--Title
or live folders and file:
Livingstone,_John_Do
Livingstone,_John_Doe--The_Working_Title__in_Progress
Livingstone,_John_Doe_(2019)_[My_series_title_with-01]--The_Working_Title__in_Progress.epub



Tweek applied:
Code:
author_sort_copy_method = u'invert'
save_template_title_series_sorting = u'strictly_alphabetic'
Save to disk pptions:
- Format date as: %Y
- Replace Space with undersores (Check)

Thank you all for sharing ideas and helping in this and other posts!
Attached Thumbnails
Click image for larger version

Name:	calibre - Preferences - Saving books to disc2.png
Views:	169
Size:	26.3 KB
ID:	174718  

Last edited by Horus68; 11-04-2019 at 11:35 AM. Reason: info update
Horus68 is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving to disk -> ValueError: I/O operation on closed file Backi Calibre 2 05-05-2012 02:29 PM
Saving to disk with "Unknown" in author field Joe42 Calibre 20 11-08-2011 12:57 PM
Losing files when saving saving to disk theaccountant Library Management 4 03-10-2011 02:38 PM
Save to Disk now saving file with full path? Mnementh Calibre 3 09-14-2009 01:24 AM
Any way to not have Caliber add numbers to file names when saving to disk JGB Calibre 13 12-09-2008 04:35 PM


All times are GMT -4. The time now is 05:17 AM.


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