Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 08-16-2010, 03:01 PM   #1
rockeh
Junior Member
rockeh began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Aug 2010
Device: iriver Story
Send to device template

Hi guys,

Sorry if this has been posted before (I've searched but found nothing relevant), but I have the following issue: I want to create a template that will add the book series and index to the filename, but only if they exist. I mean someting like:

J Random Author - Single Book
J Random Author - Unrelated Book
J Random Author - Amazing Series 1 - I'm Doing a Trilogy, You Guys
J Random Author - Amazing Series 2 - It's Gonna Be Awesome
J Random Author - I Lost All My Inspiration

The bolded bits are what give me trouble. See, I've looked at the Python templating, and came up with these two options:


{authors} - {: $series - $series_index - }{title}
{authors} - {: %series - %series_index - }{title}


since that's what that page suggested. However, Calibre doesn't like either option, and my Python-fu is weak.

So, can anyone give me a pointer?

Thanks in advance

Last edited by rockeh; 08-16-2010 at 03:08 PM.
rockeh is offline   Reply With Quote
Old 08-16-2010, 03:11 PM   #2
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by rockeh View Post
I want to create a template that will add the book series and index to the filename, but only if they exist.
You can't.

Quote:
So, can anyone give me a pointer?
Try this:
Code:
{series} {series_index} {authors} - {title}
It puts a couple of spaces at the front of the name when {series} and {series_index} are empty, and the OS strips them off.
Starson17 is offline   Reply With Quote
Advert
Old 08-16-2010, 03:22 PM   #3
rockeh
Junior Member
rockeh began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Aug 2010
Device: iriver Story
Quote:
Originally Posted by Starson17 View Post
You can't.
Aww

Quote:
Originally Posted by Starson17 View Post
Try this:
Code:
{series} {series_index} {authors} - {title}
It puts a couple of spaces at the front of the name when {series} and {series_index} are empty, and the OS strips them off.
The OS stripping extra spaces is great, and solved my problem -- I put in
Code:
{authors} - {series} {series_index} {title}
and it's done the trick.

Thank you

[edit] Spelling.
rockeh is offline   Reply With Quote
Old 08-16-2010, 03:39 PM   #4
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by rockeh View Post
The OS stripping extra spaces is great, and solved my problem -- I put in
Code:
{authors} - {series} {series_index} {title}
and it's done the trick.
Thank you
OS stripping of spaces only works at the beginning of the filename. I see you put it in the middle, so you don't get OS stripping, just multiple spaces, but it's better than random multiple hyphens. I put my author name in the folder/directory name, then put all my series together, followed by the title.
Starson17 is offline   Reply With Quote
Old 08-17-2010, 04:03 PM   #5
rockeh
Junior Member
rockeh began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Aug 2010
Device: iriver Story
Actually, that's worked as expected (ie, it removed the extra spaces in the filename). If it's relevant in any way, I'm using v 0.7.14 on Win 7 (64 bit version).
rockeh is offline   Reply With Quote
Advert
Old 08-17-2010, 05:23 PM   #6
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
Please ignore (fat fingers)
jackie_w is offline   Reply With Quote
Old 08-17-2010, 05:28 PM   #7
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
Quote:
Originally Posted by rockeh View Post
Actually, that's worked as expected (ie, it removed the extra spaces in the filename). If it's relevant in any way, I'm using v 0.7.14 on Win 7 (64 bit version).
...try again. It's a bug fix introduced in v7.13. Here is quote from calibre "What's New"

Code:
Save to disk/send to device templates: Always render {series_index} as an empty string when the book has no series.
Closes tickets: 6409
jackie_w is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
send to device without conversion? jacktanner Calibre 29 08-27-2010 03:35 PM
Send to Device (structure) mgmueller Calibre 1 02-21-2010 01:54 PM
template for "send to device" customization sbin Calibre 8 01-07-2010 07:22 AM
Non-destructive send to device? caphector Calibre 6 07-31-2009 12:40 PM
Send to device? Please don't kill me :) macthekitten Calibre 11 12-27-2008 07:35 PM


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


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