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

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 10-11-2018, 01:45 PM   #1
Vortex
Groupie
Vortex began at the beginning.
 
Vortex's Avatar
 
Posts: 171
Karma: 10
Join Date: Dec 2008
Device: Likebook Mars
Save to Disk Template with series in brackets

I'm trying to write a Save-to-disk template to save books with the filenames like:

Authors Name - [Series 3] - The Title.ext

or if there's no series:

Authors Name - The Title.ext

But I can't see any way to avoid getting a pair of empty brackets if there is no series:

Authors Name - [] - The Title.ext

Is it possible?
Vortex is offline   Reply With Quote
Old 10-11-2018, 02:26 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: 29,689
Karma: 54369090
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
https://manual.calibre-ebook.com/template_lang.html
Look at the beginning of the section on Advanced Formatting

You will be using those |
theducks is offline   Reply With Quote
Advert
Old 10-11-2018, 03:03 PM   #3
Vortex
Groupie
Vortex began at the beginning.
 
Vortex's Avatar
 
Posts: 171
Karma: 10
Join Date: Dec 2008
Device: Likebook Mars
I already read that. It works so you only have one " - " between the author and title if there is no series, but I tried all sorts and could not get it to work with brackets in it.

Edit: After re-reading it 4 more time and another 8 attempts, I finally got it to work.

Code:
{authors} {series:| - [|} {series_index:||]} {title:| - |}
I'm sure it could me made easier to understand.

Last edited by Vortex; 10-11-2018 at 05:44 PM.
Vortex is offline   Reply With Quote
Old 10-11-2018, 04:42 PM   #4
ilovejedd
hopeless n00b
ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.
 
ilovejedd's Avatar
 
Posts: 5,111
Karma: 19597086
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PW4, PW3, Libra H2O, iPad 10.5, iPad 11, iPad 12.9
Code:
{authors:|| - }{series:|[|}{series_index:| |] - }{title}
I think... Alas, this results in:

authors - [series title

if there's no series_index. Too lazy to check the template documentation how to properly handle series without series_index.
ilovejedd is offline   Reply With Quote
Old 10-11-2018, 05:26 PM   #5
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,703
Karma: 6658935
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ilovejedd View Post
Code:
{authors:|| - }{series:|[|}{series_index:| |] - }{title}
I think... Alas, this results in:

authors - [series title

if there's no series_index. Too lazy to check the template documentation how to properly handle series without series_index.
It should not be possible to have a series without a series_index. What do you see if you edit metadata for a book in that state? What happens if you run calibre's database check?
chaley is offline   Reply With Quote
Advert
Old 10-11-2018, 05:39 PM   #6
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,458
Karma: 26645808
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by chaley View Post
It should not be possible to have a series without a series_index. What do you see if you edit metadata for a book in that state? What happens if you run calibre's database check?
How would you get a book into that state, other than by poking the database into which you shouldn't even be peeking

BR
BetterRed is offline   Reply With Quote
Old 10-11-2018, 05:41 PM   #7
Vortex
Groupie
Vortex began at the beginning.
 
Vortex's Avatar
 
Posts: 171
Karma: 10
Join Date: Dec 2008
Device: Likebook Mars
Just noticed that the template is moving the series article to the end after a comma. How do I stop it doing that?

For example in Calibre my series name displays as:

The Series [3]
A Series [2]
An Awful Series [1]

(I think I turned appending the article off in Tweaks once long ago)
But the template above saves as:

- [Awful Series, An 1] -
Vortex is offline   Reply With Quote
Old 10-11-2018, 05:55 PM   #8
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,458
Karma: 26645808
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by Vortex View Post
(I think I turned appending the article off in Tweaks once long ago)
Set this Save as tweak to 'strictly_alphabetic'

Click image for larger version

Name:	1.jpg
Views:	296
Size:	186.8 KB
ID:	166862

You maybe thinking of the Title/Series sorting tweak relating to articles

BR
BetterRed is offline   Reply With Quote
Old 10-11-2018, 06:31 PM   #9
Vortex
Groupie
Vortex began at the beginning.
 
Vortex's Avatar
 
Posts: 171
Karma: 10
Join Date: Dec 2008
Device: Likebook Mars
Thanks BR, Oddly It's still exporting with the series articles at the ends.

After making the change to the tweak I restarted calibre, and went back in to make sure it had stayed changed. Double checked that I had changed the correct tweak and re-tried it several times, but it's still exporting with appended series articles.

Last edited by Vortex; 10-11-2018 at 06:50 PM.
Vortex is offline   Reply With Quote
Old 10-11-2018, 06:59 PM   #10
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,458
Karma: 26645808
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Hmmm

Using library_order and strictly_alphabetical with this template

Code:
{authors} {series:| - [|} {series_index:||]} {title:| - |}
I get following when I save Epub to Disk:

Click image for larger version

Name:	1.jpg
Views:	466
Size:	83.3 KB
ID:	166865

BR

Last edited by BetterRed; 10-11-2018 at 07:34 PM. Reason: attach uncropped image
BetterRed is offline   Reply With Quote
Old 10-11-2018, 07:02 PM   #11
ilovejedd
hopeless n00b
ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.
 
ilovejedd's Avatar
 
Posts: 5,111
Karma: 19597086
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PW4, PW3, Libra H2O, iPad 10.5, iPad 11, iPad 12.9
Quote:
Originally Posted by chaley View Post
It should not be possible to have a series without a series_index. What do you see if you edit metadata for a book in that state? What happens if you run calibre's database check?
That was just a theoretical example. I've forgotten Calibre automatically assigns series_index. Been a while since I dealt with series.
ilovejedd is offline   Reply With Quote
Old 10-12-2018, 06:15 AM   #12
Vortex
Groupie
Vortex began at the beginning.
 
Vortex's Avatar
 
Posts: 171
Karma: 10
Join Date: Dec 2008
Device: Likebook Mars
Quote:
Originally Posted by BetterRed View Post
Hmmm

Using library_order and strictly_alphabetical with this template

Code:
{authors} {series:| - [|} {series_index:||]} {title:| - |}
I get following when I save Epub to Disk:

Attachment 166865

BR
I take it by 'library_order' you mean:

Code:
# Control sorting of titles and series in the library display

title_series_sorting = 'library_order'
That's how it's set.

Also is it 'strictly_alphabetical' or as you said yesterday 'strictly_alphabetic' ?

Neither makes any difference though.

Kovid Goyal - The Calibre Documents 1 - DOCX Demo.epub

saves as:

Kovid Goyal - [Calibre Documents, The 1] - DOCX Demo.epub
Vortex is offline   Reply With Quote
Old 10-12-2018, 06:25 AM   #13
JimmyR
ɴₐɴ
JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.JimmyR ought to be getting tired of karma fortunes by now.
 
JimmyR's Avatar
 
Posts: 421
Karma: 2507940
Join Date: Jun 2011
Location: 37.2N 93.3W
Device: KV PW4 PW3 PW2
Code:
# Control formatting of title and series when used in templates

save_template_title_series_sorting = 'strictly_alphabetic'


Edit: BR already posted this...

Make sure you are changing save_template_title_series_sorting

Last edited by JimmyR; 10-12-2018 at 06:30 AM. Reason: Add Info
JimmyR is offline   Reply With Quote
Old 10-12-2018, 07:01 AM   #14
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,458
Karma: 26645808
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by JimmyR View Post
Code:
# Control formatting of title and series when used in templates

save_template_title_series_sorting = 'strictly_alphabetic'


Edit: BR already posted this...

Make sure you are changing save_template_title_series_sorting
✔️

Click image for larger version

Name:	1.jpg
Views:	241
Size:	231.3 KB
ID:	166866

BR
BetterRed is offline   Reply With Quote
Old 10-12-2018, 10:16 AM   #15
Vortex
Groupie
Vortex began at the beginning.
 
Vortex's Avatar
 
Posts: 171
Karma: 10
Join Date: Dec 2008
Device: Likebook Mars
Quote:
Originally Posted by BetterRed View Post
Hmmm

Using library_order and strictly_alphabetical with this template

Code:
{authors} {series:| - [|} {series_index:||]} {title:| - |}
I get following when I save Epub to Disk:

Attachment 166865

BR
You asked if I was using 'library_order' and 'strictly_alphabetical', but you didn't specify which tweak 'library_order' referred to, so I was trying to clarify.

These are my settings for those 2 Tweaks:





Still saving to disk with the appended articles in the filenames.

Last edited by Vortex; 10-12-2018 at 10:21 AM.
Vortex 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
Problem with template and save to disk elfnor Library Management 10 07-30-2023 10:09 PM
Need help - Save to Disk template Gallips Calibre 8 06-28-2016 01:46 PM
Please help on a Save to Disk template Dammie Library Management 15 12-16-2013 09:51 AM
Need help on a Save to Disk template fidvo Library Management 2 08-12-2012 03:34 PM
save to disk template speakingtohe Calibre 9 05-29-2010 06:02 AM


All times are GMT -4. The time now is 08:59 PM.


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