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 06-05-2024, 12:55 PM   #1
algernonramone
Member
algernonramone began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Feb 2015
Device: None
Series template not working send to device

I have the following setup to conditionally add the series and series index to a book's path/filename when sending to a device:

books/{#genre:subitems(1,2)}/{series:||/}{series_index:0>3s|| -}{title} ({authors})

If a book has genre A.B, series C, and series index I, this should save the book file to:

books/B/C/I - title (authors).ext

If there is no series, it should be:

books/B/title (authors).ext

This works fine sending books w/o series info, and it works in the template editor sample results. It will also properly populate a custom column if I create one called series_and_number and give it this template as the value:

{series:||/}{series_index:0>3s|| -}

However, when I actually go to send books that have series info to the device, it names them "G_C-EXCEPTION! Unknown format code '_' for object of type 'str'".ext and dumps them in the root directory of the device. (I presume that's because it builds the path in the same operation as the filename.) This happens regardless of whether or not I directly use the template string above, or the custom column built from the template string, in the "send to device" dialog.

This has been tried on Calibre 7.10 and Calibre 7.12.

What am I doing wrong?

Thanks

Last edited by algernonramone; 06-05-2024 at 02:38 PM.
algernonramone is offline   Reply With Quote
Old 06-05-2024, 12:58 PM   #2
algernonramone
Member
algernonramone began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Feb 2015
Device: None
Oops - it should say "sending to device" instead of "saving to disk" in the subject. Any way to change that?
algernonramone is offline   Reply With Quote
Old 06-05-2024, 01:01 PM   #3
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: 30,442
Karma: 58055868
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 algernonramone View Post
Oops - it should say "sending to device" instead of "saving to disk" in the subject. Any way to change that?
Done
theducks is offline   Reply With Quote
Old 06-05-2024, 02:48 PM   #4
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: 12,029
Karma: 7257323
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by algernonramone View Post
I have the following setup to conditionally add the series and series index to a book's path/filename when sending to a device:
Are you changing this in the send to device dialog or the device configuration dialog? It should be the device dialog because the template is copied there on the first send. You get to the device configuration dialog via Preferences / Plugins / Device interface. I suspect you must restart calibre for any changes to be taken into account.
Quote:
books/{#genre:subitems(1,2)}/{series:||/}{series_index:0>3s|| -}{title} ({authors})

If a book has genre A.B, series C, and series index I, this should save the book file to:

books/B/C/I - title (authors).ext
Note you will get two slashes in a row if the genre doesn't have a second component, the 'B' in your example. I suspect you are missing a space before the closing } in
Code:
{series_index:0>3.0f|| -}
Quote:
...
What am I doing wrong?

Thanks
My guess is that you aren't using the template you think you are because of the "copy" mentioned above.

If you are editing the template in the device configuration then I don't see a reason it shouldn't work. In that case please supply a sample empty book with metadata that isn't stored properly so I can test it with real data.
chaley is offline   Reply With Quote
Old 06-05-2024, 03:46 PM   #5
algernonramone
Member
algernonramone began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Feb 2015
Device: None
It worked! Thanks!

Here is the final version of the template string:

books/{#genre:subitems(1,2)||/}{series:||/}{series_index:0>3s|| - }{title} ({authors})

Exactly what I wanted, thanks again!
algernonramone is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Send to Device Template not working dkperez Library Management 3 12-01-2016 09:36 PM
Send to device - Template help Snow Sciles Library Management 12 05-26-2014 06:16 PM
Issue with Send to Device template BookJunkieLI Library Management 5 02-14-2014 02:16 AM
Template Help - Send to device Snow Sciles Library Management 4 10-08-2013 08:54 AM
Send to device template rockeh Calibre 6 08-17-2010 06:28 PM


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


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