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 10-11-2011, 06:01 PM   #1
ElMiko
Addict
ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.
 
ElMiko's Avatar
 
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]
What I want is for the Title field on the Kindle to display:
Code:
HGTTG 01 - Hitchhiker's Guide to the Galaxy
What I'm thinking is that I need to create an additional column (let's say, "Abbr Series" (#abbrseries)) and refer to it in the plugboard instead of the regular Series column. I just don't know how to do this. If anybody with more than my two functional brain cells could help me out, I'd be most grateful.

(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"?)
ElMiko is offline   Reply With Quote
Old 10-11-2011, 06:17 PM   #2
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
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
This is based on a technique found in https://www.mobileread.com/forums/sho...d.php?t=118563 under General Metadata.

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.
PeterT is offline   Reply With Quote
Advert
Old 10-11-2011, 07:07 PM   #3
ElMiko
Addict
ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.
 
ElMiko's Avatar
 
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.
ElMiko is offline   Reply With Quote
Old 10-11-2011, 08:11 PM   #4
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,864
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
Quote:
Originally Posted by ElMiko View Post
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.
If you look at the General Metadata section of the Sticky post above you should be close to exactly what you want.
DoctorOhh is offline   Reply With Quote
Old 10-11-2011, 11:38 PM   #5
ElMiko
Addict
ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.
 
ElMiko's Avatar
 
Posts: 320
Karma: 56788
Join Date: Jun 2011
Device: Kindle
Quote:
Originally Posted by dwanthny View Post
If you look at the General Metadata section of the Sticky post above you should be close to exactly what you want.
Yeah, I know. I looked at that after PeterT's post. And that's what precipitated my second post. As you note, that sticky has elements of what I'm looking for, but not exactly what I'm looking for: there are brackets around the series, there's no hyphen, the plugboard itself seems to be an amalgam of the three example columns. Because my own grasp of regex is so meager, even if it were close to what I was looking for, I lack the technical knowledge to turn that into what I'm actually looking for. So what I'd really appreciate is if someone who does know regex and is more familiar with Calibre than I could tell me how to do what I'm trying to do.
ElMiko is offline   Reply With Quote
Advert
Old 10-11-2011, 11:48 PM   #6
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,864
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
Quote:
Originally Posted by ElMiko View Post
As you note, that sticky has elements of what I'm looking for, but not exactly what I'm looking for: there are brackets around the series, there's no hyphen, the plugboard itself seems to be an amalgam of the three example columns.
Yes you have to create the custom columns as the instructions indicate.

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.
DoctorOhh is offline   Reply With Quote
Old 10-12-2011, 12:02 AM   #7
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: 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.
chaley is offline   Reply With Quote
Old 10-12-2011, 12:10 AM   #8
ElMiko
Addict
ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.
 
ElMiko's Avatar
 
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]
yields title displays in my Kindle that look exactly like this:

Code:
HGTTG 01 - Hitchhiker's Guide to the Galaxy
Reacher 07 - Persuader
@charley - I'm getting tired of apologizing for my ignorance, but it looks like there's no end to it (my apologies and my ignorance). I don't understand what your post means, much less how to apply it to my problem. If what you're proposing would yield the results I'm looking for above, could you provide me with some additional color on how to do so?

Last edited by ElMiko; 10-12-2011 at 12:20 AM.
ElMiko is offline   Reply With Quote
Old 10-12-2011, 12:22 AM   #9
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
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?
PeterT is offline   Reply With Quote
Old 10-12-2011, 12:34 AM   #10
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: 11,740
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ElMiko View Post
@charley - I'm getting tired of apologizing for my ignorance, but it looks like there's no end to it (my apologies and my ignorance). I don't understand what your post means, much less how to apply it to my problem. If what you're proposing would yield the results I'm looking for above, could you provide me with some additional color on how to do so?
chaley, not charley.

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')
)
The easiest way to put the above into a plugboard is to right-click on the template box and choose 'Open template editor'. Paste the above into the upper box and press OK. Change the template the same way, using the template editor.

Last edited by chaley; 10-12-2011 at 12:52 AM. Reason: Minor text corrections
chaley is offline   Reply With Quote
Old 10-12-2011, 12:37 AM   #11
ElMiko
Addict
ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.
 
ElMiko's Avatar
 
Posts: 320
Karma: 56788
Join Date: Jun 2011
Device: Kindle
Quote:
Originally Posted by PeterT View Post
Is the [1] actually IN the Abbr Series column, or do you have 1 in the existing field Number?
If I understand your question correctly, it's in the existing field number. That is to say, it's generated --and, I would imagine, stored-- in exactly the same manner as the default Series column. When I created the custom column "Abbr Series" (#abbrseries), I selected "Text column for keeping series-like information" in the drop-down menu for "Column Type".

@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.
ElMiko is offline   Reply With Quote
Old 10-12-2011, 01:16 AM   #12
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: 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?
chaley is offline   Reply With Quote
Old 10-12-2011, 01:47 AM   #13
ElMiko
Addict
ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.
 
ElMiko's Avatar
 
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
ElMiko is offline   Reply With Quote
Old 10-12-2011, 02:15 AM   #14
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: 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')
)
Note that you can also use this template in a custom column 'built from other columns'. Sometimes that is useful for debugging and changing things, as you see the results immediately instead of after a send to your kindle.
chaley is offline   Reply With Quote
Old 10-12-2011, 01:55 PM   #15
ElMiko
Addict
ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.ElMiko actually enjoys Vogon poetry.
 
ElMiko's Avatar
 
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!
ElMiko is offline   Reply With Quote
Reply


Forum Jump

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


All times are GMT -4. The time now is 12:52 AM.


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