10-14-2010, 07:36 AM | #46 |
Grand Sorcerer
Posts: 9,707
Karma: 32763414
Join Date: Dec 2008
Location: Krewerd
Device: Pocketbook Inkpad 4 Color; Samsung Galaxy Tab S6
|
|
10-14-2010, 07:45 AM | #47 |
Wizard
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
|
|
Advert | |
|
10-15-2010, 12:07 PM | #48 |
Grand Sorcerer
Posts: 9,707
Karma: 32763414
Join Date: Dec 2008
Location: Krewerd
Device: Pocketbook Inkpad 4 Color; Samsung Galaxy Tab S6
|
Question:
I have a yes/no/unknown custom column ({#read}). I want to use this column in a collection. But simplying adding {#read} doesn't work, as I'll get a collection "Yes" and "No". Which doesn't make any sense, naturally. So, I'd like to make a new custom column {#collection_read} which will transform the "Yes", "No" and "" into a value with actual visible meaning But {#column:switch(Yes, Read, No, Reading, Unread)} doesn't work... It'll give me either "Read" or "Unread", the "Reading" is never shown... |
10-15-2010, 12:32 PM | #49 | ||
Grand Sorcerer
Posts: 12,043
Karma: 7548549
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Quote:
{#column:switch(Yes,Read,No,Reading,Unread)} |
||
10-15-2010, 12:50 PM | #50 | |
Grand Sorcerer
Posts: 9,707
Karma: 32763414
Join Date: Dec 2008
Location: Krewerd
Device: Pocketbook Inkpad 4 Color; Samsung Galaxy Tab S6
|
Never tried the spaces! I'm not used to having spaces actually meaning anything
Quote:
Nope, I didn't change any naming rules and I got a nice category "Yes"... |
|
Advert | |
|
10-15-2010, 12:59 PM | #51 | ||
Grand Sorcerer
Posts: 12,043
Karma: 7548549
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Quote:
|
||
10-16-2010, 02:32 PM | #52 | |
Groupie
Posts: 180
Karma: 299
Join Date: Jul 2010
Location: Brampton ON
Device: Kobo, Kindle3
|
Quote:
Thanks for providing me with the initialism code. Very much appreciated. GM EDIT: Guess I'm not much of a programmer. Had spaces>0 originally. The pseudocode should be if spaces=0 then shorten else regex. Not that it matters, since Charles is going above and beyond. Looking forward to next week's release, afterwhich I will be making the composite columns outlined below end enjoying the best of all worlds. Last edited by Gary_M_Mugford; 10-20-2010 at 02:08 AM. |
|
10-16-2010, 11:48 PM | #53 | |
Wizard
Posts: 4,812
Karma: 26912940
Join Date: Apr 2010
Device: sony PRS-T1 and T3, Kobo Mini and Aura HD, Tablet
|
Quote:
Meg Langslow Mysteries - ... Donna Andrews becomes Meg Langslow Mysteries - 03 - Revenge of the Wrought-Iron Flamingos No author but I have the collections by author so I can still see the author on the line above. Helen |
|
10-17-2010, 02:16 AM | #54 | |
Grand Sorcerer
Posts: 12,043
Karma: 7548549
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
First, while working through this example I found that my implementation of the lookup function wasn't optimal. It suffered from the same problems that sweetpea found with test etc. I changed lookup, and the changes will appear in the next release (tomorrow, possibly). The examples uses the new functionality, so they won't work at home until release/upgrade. OK, how to do it. The full solution requires creating three composite columns. The first column is used to remove the leading articles. The second is used to compute the 'shorten' form. The third is to compute the 'initials' form. Once you have these columns, the plugboard selects between them. First column: Code:
Name: #stripped_series. Template: {series:re(^(A|The|An)\s+,)||}
Code:
Name: #shortened. Template: {#stripped_series:shorten(4,-,4)}
Code:
Name: #initials. Template: {#stripped_series:re(([^\s])[^\s]+(\s|$),\1)}
Code:
Template:{#composite:lookup(.\s,#initials,.,#shortened,series)}{series_index:0>2s| [|] }{title}
Destination field: title
Series: The Lord of the Rings Series index: 2 Title: The Two Towers Output: LotR [02] The Two Towers Series: Dahak Series index: 1 Title: Mutineers Moon Output: Dahak [01] Mutineers Moon Series: Berserkers Series Index: 4 Title: Berserker Throne Output: Bers-kers [04] Berserker Throne Series: Meg Langslow Mysteries Series Index: 3 Title: Revenge of the Wrought-Iron Flamingos Output: MLM [03] Revenge of the Wrought-Iron Flamingos Of course, the plugboard template can easily be changed to require 2, 3, or however-many-you-want spaces before initials are used. For example, the following checks for 3 spaces. Plugboard expression: Code:
Template:{#composite:lookup(\s.*\s.*\s,#initials,.,#shortened,series)}{series_index:0>2s| [|] }{title}
Destination field: title
Series: Meg Langslow Mysteries Series Index: 3 Title: Revenge of the Wrought-Iron Flamingos Output: Meg -ries [03] Revenge of the Wrought-Iron Flamingos All the others would remain the same. Last edited by chaley; 10-17-2010 at 05:22 PM. Reason: Fix wrong names in template |
|
10-17-2010, 03:42 AM | #55 |
Wizard
Posts: 4,812
Karma: 26912940
Join Date: Apr 2010
Device: sony PRS-T1 and T3, Kobo Mini and Aura HD, Tablet
|
So once again I am really confused. My post was informational (I thought) in that the kindle 3 will display a pretty comprehensive title on more than one line if you leave the cursor on it. (kindle cursor when browsing kindle) I have actually got it all quite reasoable in my mind at least on my mother's kindle.
Not that the Kindle agrees with me of course but I shall persevere. Or give my mother my Sony if she likes that better |
10-17-2010, 06:21 AM | #56 | |
Grand Sorcerer
Posts: 12,043
Karma: 7548549
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
I was responding to the post ahead of yours. I did use your example, because it was handy and the right number of words. |
|
10-17-2010, 01:00 PM | #57 |
Addict
Posts: 254
Karma: 59872
Join Date: Dec 2009
Location: New York, USA
Device: Kindle 3 (wifi) + nokia n900 tablet phone
|
EDIT: Editing out the whole post, I noticed too late I'd only read 3 pages of the thread, not 4 and what I wanted was already being discussed.
Sorry! Last edited by Gwen Morse; 10-17-2010 at 01:10 PM. |
10-18-2010, 05:11 PM | #58 |
Grand Sorcerer
Posts: 9,707
Karma: 32763414
Join Date: Dec 2008
Location: Krewerd
Device: Pocketbook Inkpad 4 Color; Samsung Galaxy Tab S6
|
I finished my save-template for my non-meta-data-reading devices (I've got two).
I had several hurdles to take. First of all: a folder structure. In order to not create one huge list of authors, I wanted to sort my authors in an alphabetic structure. Code:
[A - D]/Adams, Douglas/Hitchhiker's Guide to the Galaxy/01 - The Hitchhiker's Guide to the Galaxy v1.epub Code:
{author_sort:switch(^[A-D],[A - D],^[E-J],[E - J],^[K-O],[K - O],^[P-T],[P - T],^[U-Z],[U - Z],[Other])} The next part was easier, simply {author_sort} Then {series}, but not all books have series, so, {series:|/|} The next part is a bit more difficult. Let me explain: My books have the following meta-data: Author: Douglas Adams Author Sort: Adams, Douglas Title: HggtG - 01 - The Hitchhiker's Guide to the Galaxy Series: The Hitchhiker's Guide Series Index: 1 The reason why I have the series in the title is simply because I think that series info belongs to the title. But that does make it a bit harder in this case, as I'll need to strip it. {#collection_title} did the job: Code:
{title:re(.*? - .*? - (.*?),\1)} My final field: {#folder_name}/{author_sort}{series:|/|}/{series_index:0>2s|| - }{#collection_title} - v{#version:ifempty(0)} Now, there's one oddity. When I make a custom column in my Library, with this template, I'll get: Code:
[A - D]/Adams, Douglas/Hitchhiker's Guide to the Galaxy/01 - The Hitchhiker's Guide to the Galaxy v1 Code:
[A - D]/Adams, Douglas/Hitchhiker's Guide to the Galaxy/01 - The Hitchhiker's Guide to the Galaxy v#version.epub there's something weird going on with that #version anyway, as I had it as floating point before. It refused to do anything with it then! Not even in a custom template... |
10-18-2010, 05:30 PM | #59 | |
Grand Sorcerer
Posts: 12,043
Karma: 7548549
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
I know the text types work, as do series types. Float and int now work (but not released). I need to check the other odd type: date. |
|
10-19-2010, 03:04 AM | #60 |
Grand Sorcerer
Posts: 9,707
Karma: 32763414
Join Date: Dec 2008
Location: Krewerd
Device: Pocketbook Inkpad 4 Color; Samsung Galaxy Tab S6
|
Naturally, again, I try something that's not implemented yet
|
Tags |
custom column, tag, tags |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
custom column i need a little help | shinken | Calibre | 3 | 09-15-2010 04:41 AM |
Using Custom Metadata in Save Template | EJvdH | Calibre | 1 | 07-02-2010 07:06 AM |
Accessories Decalgirl Kindle 2 custom skin template | srmalloy | Amazon Kindle | 6 | 04-09-2010 10:55 PM |
Donations for Custom Recipes | ddavtian | Calibre | 5 | 01-23-2010 05:54 PM |
Help understanding custom recipes | andersent | Calibre | 0 | 12-17-2009 03:37 PM |