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, 02:45 PM   #1
Vortex
Groupie
Vortex began at the beginning.
 
Vortex's Avatar
 
Posts: 164
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, 03: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: 22,354
Karma: 22265700
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: K4NT, Galaxy Tab A, Kobo Aura2
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, 04:03 PM   #3
Vortex
Groupie
Vortex began at the beginning.
 
Vortex's Avatar
 
Posts: 164
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 06:44 PM.
Vortex is offline   Reply With Quote
Old 10-11-2018, 05: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: 3,137
Karma: 8659152
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PW4, PW3, iPad 9.7, 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, 06:26 PM   #5
chaley
CC Android & calibre dev
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: 8,795
Karma: 2692874
Join Date: Jan 2010
Location: France
Device: Many android devices
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, 06:39 PM   #6
BetterRed
null operator
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: 11,467
Karma: 10584684
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, 06:41 PM   #7
Vortex
Groupie
Vortex began at the beginning.
 
Vortex's Avatar
 
Posts: 164
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, 06:55 PM   #8
BetterRed
null operator
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: 11,467
Karma: 10584684
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:	25
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, 07:31 PM   #9
Vortex
Groupie
Vortex began at the beginning.
 
Vortex's Avatar
 
Posts: 164
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 07:50 PM.
Vortex is offline   Reply With Quote
Old 10-11-2018, 07:59 PM   #10
BetterRed
null operator
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: 11,467
Karma: 10584684
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:	37
Size:	83.3 KB
ID:	166865

BR

Last edited by BetterRed; 10-11-2018 at 08:34 PM. Reason: attach uncropped image
BetterRed is offline   Reply With Quote
Old 10-11-2018, 08: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: 3,137
Karma: 8659152
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PW4, PW3, iPad 9.7, 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, 07:15 AM   #12
Vortex
Groupie
Vortex began at the beginning.
 
Vortex's Avatar
 
Posts: 164
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, 07:25 AM   #13
JimmyR
Happy Xmas!
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: 363
Karma: 1000002
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 07:30 AM. Reason: Add Info
JimmyR is online now   Reply With Quote
Old 10-12-2018, 08:01 AM   #14
BetterRed
null operator
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: 11,467
Karma: 10584684
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:	28
Size:	231.3 KB
ID:	166866

BR
BetterRed is offline   Reply With Quote
Old 10-12-2018, 11:16 AM   #15
Vortex
Groupie
Vortex began at the beginning.
 
Vortex's Avatar
 
Posts: 164
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 11: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 7 07-25-2018 10:59 PM
Need help - Save to Disk template Gallips Calibre 8 06-28-2016 02:46 PM
Please help on a Save to Disk template Dammie Library Management 15 12-16-2013 10:51 AM
Need help on a Save to Disk template fidvo Library Management 2 08-12-2012 04:34 PM
save to disk template speakingtohe Calibre 9 05-29-2010 07:02 AM


All times are GMT -4. The time now is 11:18 AM.


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