10-11-2011, 06:01 PM | #1 |
Addict
Posts: 320
Karma: 56788
Join Date: Jun 2011
Device: Kindle
|
Custom Column as Input for Plugboard?
I was recently told off by a certain kiwidude for including series information in the title field (eg. HGTTG 01 - Hitchhiker's Guide to the Galaxy). Part of my reason for doing this has been to change the way it is displayed on my Kindle. kiwidude, however, kindly informed me that plugboards were the way to achieve that end without turning the Title field into alphabet soup.
Here's the rub: it's not as simple as taking one of the plugboards recipes stickied above which simply extracts series data and inserts it into the Title field upon transfer to the Kindle. This is what I have now: Code:
Title: Series: Hitchhiker's Guide to the Galaxy Hitchhiker's Guide to the Galaxy [1] Code:
HGTTG 01 - Hitchhiker's Guide to the Galaxy (PS - as per my example, is it possible to make the series number have a leading 0 in the tens place (i.e. display "01, 02, 03,... 10, 11, 12" instead of "1, 2, 3,... 10, 11, 12"?) |
10-11-2011, 06:17 PM | #2 |
Grand Sorcerer
Posts: 12,166
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
|
I am using the following:
Code:
Format: ePub Device: Kobo Source Template: {series:re(([^\s])[^\s]+(\s|$),\1)}{series_index:0>2s| - | - }{title} Destination Field: title With this Title: The Hitchhiker's Guide to the Galaxy Series: The Hitchhiker's Guide to the Galaxy Number: 1.0 Author: Douglas Adams gets mapped to Title: THGttG - 01 - The Hitchhiker's Guide to the Galaxy on my Kobo. |
Advert | |
|
10-11-2011, 07:07 PM | #3 |
Addict
Posts: 320
Karma: 56788
Join Date: Jun 2011
Device: Kindle
|
Thanks for the response! Still, it's not exactly what I'm looking for. Sometimes my abbreviated Series title is just the first letter of every word (as in HGTTG), but more frequently, it's not -- sometimes it's the full name, sometimes it's one word from the series, sometimes it's a combination of numbers and letters... the point is it varies based on my own crazy whims. So what I really need is an expression that extracts the data from the custom column I mentioned, and maps it in the format I gave in the first post.
|
10-11-2011, 08:11 PM | #4 | |
US Navy, Retired
Posts: 9,864
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
|
Quote:
|
|
10-11-2011, 11:38 PM | #5 | |
Addict
Posts: 320
Karma: 56788
Join Date: Jun 2011
Device: Kindle
|
Quote:
|
|
Advert | |
|
10-11-2011, 11:48 PM | #6 | |
US Navy, Retired
Posts: 9,864
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
|
Quote:
It is as close to what you describe as you may get. You don't like brackets, you want hyphens then change the brackets to hyphens. {series_index:0>2s| [|] } {series_index:0>2s| - | - } Good Luck with your search. |
|
10-12-2011, 12:02 AM | #7 |
Grand Sorcerer
Posts: 11,740
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Also note that the extra columns are not strictly necessary. It is possible to do all of the steps in the plugboard if you use general program mode, which didn't exist when that recipe/solution was built.
|
10-12-2011, 12:10 AM | #8 |
Addict
Posts: 320
Karma: 56788
Join Date: Jun 2011
Device: Kindle
|
I'm sorry. Maybe I'm either being obtuse or unclear.
Can someone give me the exact expression that will take series data out of a custom column (Abbr Series (#abbrseries)) and map it to a title so that Code:
Title: Abbr Series: Series: Hitchhiker's Guide to the Galaxy HGTTG [1] Hitchhiker's Guide to the Galaxy [1] Persuader Reacher [7] Jack Reacher [7] Code:
HGTTG 01 - Hitchhiker's Guide to the Galaxy Reacher 07 - Persuader Last edited by ElMiko; 10-12-2011 at 12:20 AM. |
10-12-2011, 12:22 AM | #9 |
Grand Sorcerer
Posts: 12,166
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
|
Is the [1] actually IN the Abbr Series column, or do you have 1 in the existing field Number?
|
10-12-2011, 12:34 AM | #10 | |
Grand Sorcerer
Posts: 11,740
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Here is a plugboard template that does something like what you want. If it isn't exactly what you want, then I leave it as an exercise for the reader to change it. This template requires no extra custom columns. Code:
program: # First remove any leading articles from the series name stripped = re(field('series'), '^(A|The|An)\s+', ''); # If the series is very long, shorten it. This will be used if the series is one word. shortened = shorten(stripped, 4, '-', 4); # Grab the first letter of each word initials = uppercase(re(stripped, '([^\s])[^\s]+(\s|$)', '\1')); # compute a title with the series and series index in it. Use initials if the series has a space, otherwise use # the shortened value. Format the series to 2 digits, and add some separation characters. full = strcat( switch(stripped, '.\s' , initials, shortened), ' ', format_number(field('series_index'), '{0:0>2d}'), ' - ', field('title') ); # Select the full value computed above if there is a series, otherwise use only the title. first_non_empty( test(field('series'), full, ''), field('title') ) Last edited by chaley; 10-12-2011 at 12:52 AM. Reason: Minor text corrections |
|
10-12-2011, 12:37 AM | #11 | |
Addict
Posts: 320
Karma: 56788
Join Date: Jun 2011
Device: Kindle
|
Quote:
@chaley - My mistake on your handle. As I've explained, my series abbreviation are not sufficiently consistent to be generated automatically. I need to designate the abbreviation manually. This is why, in part, the General Metadata plugboard that PeterT referenced in his first post (and then dwanthny reference again in his first post) doesn't quite accomplish what I'm trying to do. As for making an exercise out of adapting these almost solutions to fit my goal, I am simply insufficiently knowledgeable to do adapt these expressions myself (as I have tried time and time again to make clear). So, if what I am asking for is impossible, then I'd appreciate it if someone would say so. But telling me how to only sort of accomplish what I'm asking for is unproductive for both of us: it wastes your time by making you write code that I'm in no position to utilize, and it stresses me out because I can only say "I'm ignorant" so many times. Last edited by ElMiko; 10-12-2011 at 01:02 AM. |
|
10-12-2011, 01:16 AM | #12 |
Grand Sorcerer
Posts: 11,740
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
I provided an 'almost' solution because you haven't given enough information to provide a finished solution. Well then, lets get precise.
1) The lookup name of your custom column containing the manually-entered information is #abbrseries? 2) Your #abbrseries column is a series-type column containing the text and the series index you wish unconditionally to put into the title? 3) What do you want to happen if there is nothing in #abbrseries for a book? 4) What do you want to happen if #abbrseries_index is zero for a book? 5) What do you want to happen if #abbrseries_index has a decimal point in it? 6) Do you want to see this extended title on the library view, or only use it in a plugboard? 7) Are there any other special cases? |
10-12-2011, 01:47 AM | #13 |
Addict
Posts: 320
Karma: 56788
Join Date: Jun 2011
Device: Kindle
|
Thank you! If someone had told me earlier that my question was incomplete, I know I could've saved you all a lot of grief.
1)Yes 2)Yes 3)If there's no series, then I want it to simply display the title in my Kindle exactly as it is in the Calibre Title field. 4)If the index is zero, then I'd like it to display the #abbrseries value as usual, with a leading 0 in the tens place (eg "HGTTG 00 - ...") 5)If it has a decimal point, then I'd like the new title to reflect that (eg "HGTTG 05.1 - ...") 6)Just the plugboard is fine. This whole thing started because kiwidude recommended that i unclutter the Title field in Calibre (ie, strip out the series info that I'd input). 7)Not that I can think of. Again, thanks for breaking it down for me. Last edited by ElMiko; 10-12-2011 at 02:10 AM. Reason: clarified Answer#3 |
10-12-2011, 02:15 AM | #14 |
Grand Sorcerer
Posts: 11,740
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Use the following for the plugboard template.
Code:
program: # Grab a copy of the series text s = field('#abbrseries'); # Work out if the series index has a decimal point. If so, format it nn.n, otherwise format it nn i = field('#abbrseries_index'); index = switch(i, '\.', format_number(i, '{0:04.1f}'), format_number(i, '{0:02d}')); # Construct the full title containing the series & index full = strcat( s, ' ', index, ' - ', field('title') ); # Select the full value computed above if there is something in #abbrseries, otherwise use only the title. first_non_empty( test(s, full, ''), field('title') ) |
10-12-2011, 01:55 PM | #15 |
Addict
Posts: 320
Karma: 56788
Join Date: Jun 2011
Device: Kindle
|
I haven't yet had the opportunity to see how this works with the ereader, but as per your suggestion, I created a test column. The program looks like it runs wonderfully. I'm very grateful. This'll really help me clean up my library. Thank you!
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Plugboard, template, and custom composite column recipes | chaley | Library Management | 976 | 04-22-2024 06:29 PM |
Can custom book data be displayed in a custom column? | kiwidude | Development | 9 | 03-02-2011 05:35 AM |
Need help with this custom Column. | Rie142 | Library Management | 2 | 02-20-2011 09:51 AM |
custom column input - needs mouse click | cybmole | Library Management | 6 | 01-27-2011 11:24 AM |
custom column i need a little help | shinken | Calibre | 3 | 09-15-2010 03:41 AM |