![]() |
#1 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 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 Code:
Doe, John & Jane, Mary Last edited by Horus68; 09-25-2019 at 11:40 AM. |
![]() |
![]() |
![]() |
#2 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. Last edited by DNSB; 09-25-2019 at 02:47 PM. |
![]() |
![]() |
![]() |
#4 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 |
![]() |
![]() |
![]() |
#5 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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| - |} Code:
Doe, John\Doe, John - My own history\Doe, John - My collection - 1 - My own history.pdf I can't use in this template, to always saves the series number with 2 number format, the code Code:
{series_index:0>2s| - |} Code:
{series_index:| - |} Code:
{author_sort:sublist(0,1,&)} But I can live with that! Last edited by Horus68; 09-26-2019 at 08:11 AM. |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 ![]() |
![]() |
![]() |
![]() |
#7 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 143
Karma: 76596
Join Date: Feb 2015
Location: Portugal
Device: Kobo Aura HD
|
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! |
![]() |
![]() |
![]() |
#8 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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:
![]() 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 ) |
|
![]() |
![]() |
![]() |
#9 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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| - |} It works fine and the output is a proper two digits with trailing zeros Code:
- 02 - 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| - |} 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| - |} 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 Last edited by Horus68; 09-26-2019 at 12:14 PM. |
![]() |
![]() |
![]() |
#10 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 ![]() I use (but my other requirements are simpler) Code:
{series_index:0>5.2f} BTW spaces in file names should be avoided ( - ) ->(-) ![]() Code:
{title:.60| - |}/ |
![]() |
![]() |
![]() |
#11 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 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' - Format date as: %Y - Replace Space with undersores (Check) Thank you all for sharing ideas and helping in this and other posts! Last edited by Horus68; 11-04-2019 at 11:35 AM. Reason: info update |
![]() |
![]() |
![]() |
|
![]() |
||||
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 |