12-22-2013, 08:03 AM | #346 |
eBook Junkie
Posts: 1,526
Karma: 1464018
Join Date: May 2010
Location: USA
Device: Kindle Fire 2020, Kindle PW2
|
Thank you eschwartz it works perfectly.
Ok, Eschwartz: I have another challenging question for you. I have tags like "Romance/International" or "Read - Romance/International". Is there any way to shorten it with a plugboard to the first letter before the "-" and before and after the "/". In other words it would show up as "R - R/I" or "R/I". I know you are thinking why do I need all this crap, but it is the tags, purchased and series info that goes into collections, and this helps with the PW2 update debacle. Last edited by nynaevelan; 12-22-2013 at 09:35 AM. Reason: More info added |
12-22-2013, 12:58 PM | #347 |
Groupie
Posts: 180
Karma: 299
Join Date: Jul 2010
Location: Brampton ON
Device: Kobo, Kindle3
|
ESchwartz hit the proverbial answer on the nailhead and you will probably be good to go with the changing of the text to the field name and then adding the the :.3 modifier. And the suggestion to accommodate empty #purchase1 fields was also something to consider.
I have a similar situation but I DO use a shortened created column for the field that I want to be two characters long ... I have a #genre column created from my #tagesgm column that I want to be two characters long: {#tagsgm:re( *(.[^\,]?)[^\,]*?(\,|$),\1\2)} I believe adding a \3 behind the two and substituting your base created column of #purchase1 would work. I then use the following plugboard: [{#readrank:ifempty(9)}{#genre:ifempty(SF)}] {#stripped_series:lookup(.\s,#initials,.,#shortene d,series)}{series_index:|-|-}{title} As you can see, I use {#genre:ifempty(SF)} to create a default value so that it's never EMPTY, which MIGHT be something you want to consider. However, I think the earlier answer is PROBABLY what you were looking for and I only offer up my solution as another way to approach the possibility of handling a blank #purchase1. Again, all of this stuff from me is actually only regurgitated Chaley. Any added errors are all mine. |
Advert | |
|
12-22-2013, 01:22 PM | #348 |
Groupie
Posts: 180
Karma: 299
Join Date: Jul 2010
Location: Brampton ON
Device: Kobo, Kindle3
|
My #tagsGM is MY way of handling the issue you are trying to approach with very intelligent plugboards/created column solutions. Here's what I have done:
As I said, I have a #tagsGM column that is a list column with maybe 30 possibilities in it. One of which is Uncat (for Uncategorized). When books get added, they get tagged as Uncat. I have created saved searches that look for #tagsGM = Uncat and for tags to be equal to a set of possibilities that covers MOST of the variations I might be interested in for that particular saved search. i.e. #tagsgm:"=Uncat" and (tags:"=Mystery" or tags:"=Mysteries and Detectives" or tags:"=Crime Fiction" or tags:"=Crime" or tags:"=Mystery Fiction") I classify all of them as Mysteries in #tagsgm. Soooo, what I do is open the tag browser. The saved searches are at the bottom and I give them names like __400NewMysteries (note that's a double underscore for sorting purposes). I click the search, wait for a second or two, and then I get all the uncategorized books that I 'THINK' are mysteries. I do a quick look to see if somehow they should be categorized elsewhere (such as Non-Fiction, although I use my own ranking system to make Non-Fiction searches come before Mysteries in the searching sequence), then I Select all (ctrl-A in Windows) and press e to bulk edit. I then add Mysteries to the #tagsgm and check the box to remove all other contents from that field. Press OK and all the searched for books disappear as they are no longer Uncat books. This sounds REALLY, REALLY complicated but it's not. I can zoom through re-classifying in about five minutes. I manually look at all #tagsgm:"=Uncat" afterwards and do a guesstimation on what the #tagsgm should be from the book description and any tags extant. I make a note of whatever in the tags that aren't in my system that I think should be in it. And Bob's you uncle. By the way, when I was setting up these searches, I had the whole list in a notepad file. I then ran through my already categorized books and looked at the universal tag field I had gotten filled during metadata updates. By copying and pasting a section of the search, I could then easily type in the variation that I was looking for. I then copied the newly updated line into the Search editor and that way, I keep pace with the 'ingenuity' of the tag creators out there. I've had to update Mysteries and Thrillers several times, trying to create JUST the right smarts to make sure I get the division between the two correct. Your willingness to go crazy with the search parameters (including nots and all that) is up to you. I suspect you might want to search for things you think might be a little more erotically-rated BEFORE doing the search for Romance. And how you decide the order will put Romance before OR after Thriller. Again, up to you. It would be nice to get super bright AI from the calibre column creator and plugboards, but sometimes a little manual elbow grease works out better. But I could be wrong. |
12-22-2013, 03:14 PM | #349 | ||
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Quote:
I will start working on it -- it's all right, I find it fun, and I've been wanting experience with regex-creation anyway, so any excuse is good. To clarify: You want to take anything in the format Quote:
|
||
12-22-2013, 03:19 PM | #350 | |
eBook Junkie
Posts: 1,526
Karma: 1464018
Join Date: May 2010
Location: USA
Device: Kindle Fire 2020, Kindle PW2
|
Quote:
|
|
Advert | |
|
12-22-2013, 03:21 PM | #351 | |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Quote:
Code:
{tags:re((([^-/])*( - ))?([^-/])*(/)([^-/])*,\2\3\4\5\6)} |
|
12-22-2013, 03:34 PM | #352 |
eBook Junkie
Posts: 1,526
Karma: 1464018
Join Date: May 2010
Location: USA
Device: Kindle Fire 2020, Kindle PW2
|
It didn't work. It took Read - Romance/International and turned it into Read - Romance nternational. It removed "/I".
|
12-22-2013, 03:53 PM | #353 | |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Quote:
Dang it. .... Hmm, and having tested it, I get "d - e/l" I will have to think about this. Gotta go now, though. Sometime today I think I may figure it out, in the meantime anyone else is free to steal my thunder. All for the cause. |
|
12-22-2013, 04:09 PM | #354 | |
eBook Junkie
Posts: 1,526
Karma: 1464018
Join Date: May 2010
Location: USA
Device: Kindle Fire 2020, Kindle PW2
|
Quote:
|
|
12-22-2013, 04:19 PM | #355 |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Well, I figured it out in my head while I was doing something else, so I decided to come back.
It turns out capturing groups that are repeated with the star return only the last found match , so I doubled the capture group and captured only the first part -- which doesn't have to mean anything to you. Here is a new template, which works in my custom column I use for testing new bit in red, in case anyone cares: Code:
{tags:re((([^-/])[^-/]*( - ))?([^-/])[^-/]*(/)([^-/])[^-/]*,\2\3\4\5\6)} Also, I had discovered as of last time, this should get away with matching spaces as well, just so long as you always use "-" and "/" exclusively as the separators, and only "-" the first time, and "/" the second time. For a total of three parts. If you wish more, I will have to construct a new regex. EDIT: And yes, this is actually a good thing that we got so confused, because now I learned something cool about regex! Last edited by eschwartz; 12-22-2013 at 05:25 PM. |
12-22-2013, 11:35 PM | #356 | |
eBook Junkie
Posts: 1,526
Karma: 1464018
Join Date: May 2010
Location: USA
Device: Kindle Fire 2020, Kindle PW2
|
Quote:
|
|
12-22-2013, 11:45 PM | #357 |
eBook Junkie
Posts: 1,526
Karma: 1464018
Join Date: May 2010
Location: USA
Device: Kindle Fire 2020, Kindle PW2
|
We are making progress, it works for those in the format xx - xx/xx. But for those that are xx - xx, it gives the full unabbreviated name or xx without either the - or /, I get a PLUGBOARD TEMPLATE ERROR.
|
12-22-2013, 11:47 PM | #358 | |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Quote:
|
|
12-22-2013, 11:50 PM | #359 | |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Quote:
Edit: No of course that won't work. It's still the same thing. How to make it optionally replace... I will have to think about that.... Last edited by eschwartz; 12-23-2013 at 12:02 AM. |
|
12-23-2013, 01:15 AM | #360 |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Well, I had to create a full-blown program to do it, but here we are.
Tested with one row holding "Read - Romance/International" and the other holding "Romance/International", so it should finally work: Code:
program: #save stuff before " - " (optional) start=list_item(field('tags'),-2, ' - '); #save stuff after it (mandatory) end=list_item(field('tags'),-1, ' - '); #strip var 'end' to first letter of each side of the "/" end=re(end,'([^-/])[^-/]*(/)([^-/])[^-/]*','\1\2\3'); #return a value strcat( #returns first letter of start, if it exists shorten(start,1,'',0), #test for start, if present, return " - " test(start,' - ',''), #return (stripped) end end ) Code:
program:start=list_item(field('tags'),-2, ' - ');end=list_item(field('tags'),-1, ' - ');end=re(end,'([^-/])[^-/]*(/)([^-/])[^-/]*','\1\2\3');strcat(shorten(start,1,'',0),test(start,' - ',''),end) Last edited by eschwartz; 12-23-2013 at 01:21 AM. |
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 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 |