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

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 01-04-2011, 06:25 AM   #121
chaley
"chaley", not "charley"
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: 5,193
Karma: 821512
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by stevehaley View Post
also I suspect it is all case sensitive - you have {#Genre} there not {#genre}
I changed calibre' template processing to use case-insensitive matching on keys. This change was less intrusive than changing the history dialog to be case-sensitive.

Should be in the next release.

(BTW: save/send templates were already case sensitive, as were some parts of composite column templates.)
chaley is offline   Reply With Quote
Old 01-04-2011, 06:57 AM   #122
chaley
"chaley", not "charley"
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: 5,193
Karma: 821512
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by stevehaley View Post
Many thanks to all who have lead the way on this - I thought I would add my two-pennyworth and findings.

My problem was the normal kindle/series/collection title format problem but I wasnt happy that any one derived format fixed the problem as I could see having collections with one series where just the series number would be ok and others with more than one where I would want to show the series name or a shortened version of this as well.
Nice job. Two small points:
1: The line
Code:
str_title5 = template('{title}');
would be better written
Code:
str_title5 = field('title');
Although they produce the same result, the second will have much better performance because it avoids all the kerfuffle of setting up a recursive template evaluation.

2: Instead of
Code:
str_input = lowercase(field('#kindle_title_fmt'));
switch(str_input,
You might consider using
Code:
switch(lowercase(field('#kindle_title_fmt')),
Reason: performance and (matter of taste) readability. The template language is double-interpreted (an interpreter written in python) and not in byte code, making reducing the amount of executed code a worthwhile endeavor. The assignment requires execution of an 'assign' function that stores the value in the variable table, while using the lowercase function directly in the switch does avoids that work.

Another option that has even better performance takes advantage of the fact that the match-value parameters in switch are really regexps. This lets you use case-insensitive matching by writing the switch as:
Code:
switch(field('#kindle_title_fmt'),
           '(?i)series and num',str_title1,
           '(?i)alt and num',str_title2,
           '(?i)short and num',str_title3,
           '(?i)num only',str_title4,
           '(?i)no series info',str_title5,
           str_default);
The matter of taste can be ignored.
Quote:
3) Was easiest to just put any old text into the 3rd column when creating it then use the f2 edit later to put the actual code in.
I have considered changing the creation dialog to use the same multi-line editor that F2 uses. This would make entering complex templates during creation much easier, at the expense of making entering simple templates take another click or two. Opinions?
chaley is offline   Reply With Quote
 
Enthusiast
Old 01-04-2011, 06:23 PM   #123
stevehaley
Junior Member
stevehaley began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Nov 2010
Device: Kindle
Quote:
Originally Posted by chaley View Post
A note on your notes:
It is documented correctly. Switch and several other functions are used in single-function mode, and they do not have the field parameter. It is implied. When these functions are used in template program mode or general program mode, the parameter is required. The documentation says this, but in text. I have made changes that I hope makes the text clearer.
Sort of follow it now - some examples would definitely help us less gifted
Fraid I am one of those that learns by piecing together others code snippits

Quote:
Also, I found a problem yesterday with general program mode composite columns used in plugboards/templates. The program itself was substituted, not the evaluation of the program. Have you verified that your plugboard {#kindle_title} puts the values you expect into the book?
No problems here - appears to work fine for me thanks. Have just reloaded the Kindle and everything went through fine.

Thanks for the code suggestions - will try them.
Performance doesnt appear to have been a problem hence the laziness but I only have 2000 books in the system and am running a quad core.
I am absolutely useless at regexp as it is not something I have ever used.
My coding style has always been to lay everything out and pre-process as much as possible in logical chunks as find it easier to read when things get really complex and I find it more flexible. In real life it allows me to export chunks into external compiled functions easily.

Did a minor mod so that if I put a short title in then it used that as a default
ie
str_default =test(field('#alt_series_name'),str_title2, str_title1);

Quote:
I have considered changing the creation dialog to use the same multi-line editor that F2 uses. This would make entering complex templates during creation much easier, at the expense of making entering simple templates take another click or two. Opinions?
Personally - would leave as is - wasnt a biggie for me walking in as a newbie and most people are just going for simple expressions I would guess.

thanks for all the work on this - seriously appreciated
stevehaley is offline   Reply With Quote
Old 01-06-2011, 08:53 PM   #124
nynaevelan
eBook Junkie
nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.
 
nynaevelan's Avatar
 
Posts: 1,347
Karma: 1459924
Join Date: May 2010
Location: USA
Device: Kindle Fire HD 2012, Kindle PW2, Galaxy Tab 10.1
Hi:

I was wondering if someone can help me create a plugboard. I am trying to create one that will send the books to my k2 and put them in folders based on their tags, here is what I have but it is not putting them in the folders, what am I doing wrong?

Code:
{tags}/{title} - {series} - {series_index:0>2s| - | - }
nynaevelan is offline   Reply With Quote
Old 01-07-2011, 03:04 AM   #125
chaley
"chaley", not "charley"
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: 5,193
Karma: 821512
Join Date: Jan 2010
Location: France
Device: Many android devices
There is nothing wrong with the template in your post. My guess is that the problem is -where- you are putting it.

To set the destination name/path, you should put that template in either the box on preferences -> send to device or in preferences -> plugins -> device plugins -> Kindle 2/3. Whatever is in the box in the device plugin takes precedence over whatever is in the box in the send-to-device preference.

If you are putting it in the send-to-device preferences, then check the plugin to see if it has a different value.
chaley is offline   Reply With Quote
Old 01-07-2011, 04:19 AM   #126
Sweetpea
Grand Sorcerer
Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.
 
Sweetpea's Avatar
 
Posts: 7,974
Karma: 22622174
Join Date: Dec 2008
Location: Krewerd
Device: HTC Flyer; BBMini; Sony PRS650; Onyx Boox T68
Quote:
Originally Posted by chaley View Post
If you are putting it in the send-to-device preferences, then check the plugin to see if it has a different value.
Yes, that's where I got confused at the start as well... I had put this awesome template in the send-to-device preference, only to see the same values over and over (the original ones). Until I found out, you can also set them at the device settings...
Sweetpea is offline   Reply With Quote
Old 01-07-2011, 06:51 AM   #127
nynaevelan
eBook Junkie
nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.
 
nynaevelan's Avatar
 
Posts: 1,347
Karma: 1459924
Join Date: May 2010
Location: USA
Device: Kindle Fire HD 2012, Kindle PW2, Galaxy Tab 10.1
Ok, I had it in the wrong spot, when I moved it to the settings for the send to device area it worked correctly. Now I have one more question, is there a way to have it go to the folder of the first tag if multiple tags exist?
nynaevelan is offline   Reply With Quote
Old 01-07-2011, 07:04 AM   #128
chaley
"chaley", not "charley"
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: 5,193
Karma: 821512
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by nynaevelan View Post
Now I have one more question, is there a way to have it go to the folder of the first tag if multiple tags exist?
This can be done. However, until 0.7.38, calibre and you might disagree on what the first tag is. Until that release, the order of tags in templates is not necessarily alphabetic.

The template expression is {tags:re((.*?)(\,|$).*,\1)}.

This problem comes up so many times that I think I will add functions to the template processor specifically for manipulating comma-separated lists.
chaley is offline   Reply With Quote
Old 01-07-2011, 07:19 AM   #129
nynaevelan
eBook Junkie
nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.
 
nynaevelan's Avatar
 
Posts: 1,347
Karma: 1459924
Join Date: May 2010
Location: USA
Device: Kindle Fire HD 2012, Kindle PW2, Galaxy Tab 10.1
Thanks I will use this until the update.
nynaevelan is offline   Reply With Quote
Old 01-08-2011, 11:06 AM   #130
nynaevelan
eBook Junkie
nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.
 
nynaevelan's Avatar
 
Posts: 1,347
Karma: 1459924
Join Date: May 2010
Location: USA
Device: Kindle Fire HD 2012, Kindle PW2, Galaxy Tab 10.1
Chaley:

Now that the update is out how do I adjust the template to select which tag should be considered first??

Nyn
nynaevelan is offline   Reply With Quote
Old 01-09-2011, 05:12 AM   #131
chaley
"chaley", not "charley"
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: 5,193
Karma: 821512
Join Date: Jan 2010
Location: France
Device: Many android devices
The first tag is the one in the front of the list, in alphabetic (case-insensitive) order.

What scenario are you thinking of?
chaley is offline   Reply With Quote
Old 01-09-2011, 01:39 PM   #132
nynaevelan
eBook Junkie
nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.
 
nynaevelan's Avatar
 
Posts: 1,347
Karma: 1459924
Join Date: May 2010
Location: USA
Device: Kindle Fire HD 2012, Kindle PW2, Galaxy Tab 10.1
Quote:
Originally Posted by chaley View Post
The first tag is the one in the front of the list, in alphabetic (case-insensitive) order.

What scenario are you thinking of?
I am not sure, in most cases it is not the the first one that I want but the second but how would you tell it to pick the second one if more than one exist but the first one if only one exists?? But if that is not doable, it can stay as it is.
nynaevelan is offline   Reply With Quote
Old 01-09-2011, 01:49 PM   #133
chaley
"chaley", not "charley"
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: 5,193
Karma: 821512
Join Date: Jan 2010
Location: France
Device: Many android devices
{tags:'switch(count($, ','), 1, $, list_item($, 1, ','))'}

Last edited by chaley; 01-10-2011 at 03:14 AM. Reason: Remove extra quote marks
chaley is offline   Reply With Quote
Old 01-09-2011, 02:33 PM   #134
nynaevelan
eBook Junkie
nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.nynaevelan ought to be getting tired of karma fortunes by now.
 
nynaevelan's Avatar
 
Posts: 1,347
Karma: 1459924
Join Date: May 2010
Location: USA
Device: Kindle Fire HD 2012, Kindle PW2, Galaxy Tab 10.1
Thank you for all your help.
nynaevelan is offline   Reply With Quote
Old 01-16-2011, 06:36 PM   #135
ThePage
Connoisseur
ThePage has a spectacular aura aboutThePage has a spectacular aura aboutThePage has a spectacular aura aboutThePage has a spectacular aura aboutThePage has a spectacular aura aboutThePage has a spectacular aura aboutThePage has a spectacular aura aboutThePage has a spectacular aura aboutThePage has a spectacular aura aboutThePage has a spectacular aura aboutThePage has a spectacular aura about
 
ThePage's Avatar
 
Posts: 74
Karma: 4430
Join Date: Jan 2009
Location: Chicagoland
Device: Kindle 4, eBookwise & Literati
GUI Columns

I've been working exclusively with the GUI, as my only reader at the moment is an Ebookwise with it's own limited conversion/Library software elsewhere on my PC.

My previous efforts at cataloging my Library were on the AZZ Cardfile program, where I've also kept a list of my Custom Columns for Calibre.

Several of these had to be redone because I had chosen them originally as non-comma'd versions. I therefore recommend using the commas unless you are absolutely certain that they will never be needed!

With one exception these are all being filled in by "hand" w/o any {}.

Not sure whether these would count as recipes, but they are hereby offered below as some may find the examples useful:

Column type/{} if any/search designation in lower case/column Heading

Column built from other columns/{format}/format/eFormats
showing all the formats present that are recognized by Calibre for each book, previously discussed in FAQ


Ratings, shown with stars/myrate/My Rating
as opposed to those supplied by others

Floating point numbers/price/Retail recording cover price or equivalent


Text, but with a fixed set of permitted values/drm/DRM
Notes the original Encrypted Format purchased, if any.

Comma separated text, like tags, shown in the tag browser/award/Awards
citing both Wins and Nominations

Comma separated text, like tags, shown in the tag browser/genre/Genres
not as yet used

Comma separated text, like tags, shown in the tag browser/length/Length
includes both Fictionwise VS/S/M/L/VL (coded below as L1 thru L5) as well as "Named" Lengths: Flash & Micro-Fiction, Shortstories vs. Short for Non-fiction, and Novelet(te)s vs. Novellas vs. Novels & Omnibus Volumes

Comma separated text, like tags, shown in the tag browser/line/Lines
such as Romance lines: Intrigue, Blaze, Desire, etc., with or without line #'s

Comma separated text, like tags, shown in the tag browser/myseries/My Series

Comma separated text, like tags, shown in the tag browser/otherfmt/Other Formats
as Paper, Trade, Hardcover, Leatherbound, Stageplay & Audio

Comma separated text, like tags, shown in the tag browser/note/Notes
such Signed, First Edition, as well as corrections needed, Etc.

Comma separated text, like tags, shown in the tag browser/setting/Settings such as Ireland, Scotland, name of town, etc.

Comma separated text, like tags, shown in the tag browser/subject/Subjects

Long text, like comments, not shown in tag browser/com2/My Comments

Long text, like comments, not shown in tag browser/comm/Other Comments

Text,column shown in the tag browser/cat/Catalog
personal catalog # in previous use matching cover art in separate folder

This was originally intended to get rid of idiosyncratic file names and allow me to locate and view the covers, which the cardfile couldn't readily handle, but still has secondary benefits, as I can store multiple covers here, and change them off if desired, as well as copying the best of them to folders accessed by my screensaver for a slideshow, and can break the latter down by style such as vintage pulp, watercolor, etc. The screensaver runs more smoothly using the catalog #'s than it did when they had regular titles attached.

Text,column shown in the tag browser/code/Code
is a personal alpha-numeric code based on the Word-Length of Books -
for example, L3aj includes a 2.4H (hour) reading time for a mid-length book described by some as a novella.

Text,column shown in the tag browser/issue/Issue
such as Magazine, Webscription or other Issue data

Text,column shown in the tag browser/time/Time
Reading time in Decimal Hours as 2.4H, Etc. rounded up
from the high end Fictionwise Reading time in minutes

Yes/No/coll/ACMO for Anthologies, Collections, Magazines & Omnibi
a yes shows that there will be further information in other columns


Yes/No/classic/Classic

Yes/No/mark/Mark as recomendation for or against for my brother at home who actually reads

Yes/No/read/Read (by me)

Last edited by ThePage; 01-17-2011 at 12:36 AM. Reason: afterthoughts
ThePage is offline   Reply With Quote
Reply

Tags
custom column

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
custom column i need a little help shinken Calibre 3 09-15-2010 03:41 AM
Using Custom Metadata in Save Template EJvdH Calibre 1 07-02-2010 06:06 AM
Accessories Decalgirl Kindle 2 custom skin template srmalloy Amazon Kindle 6 04-09-2010 09:55 PM
Donations for Custom Recipes ddavtian Calibre 5 01-23-2010 04:54 PM
Help understanding custom recipes andersent Calibre 0 12-17-2009 02:37 PM


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


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