01-10-2014, 04:18 AM | #466 | ||
Grand Sorcerer
Posts: 11,962
Karma: 7225107
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Quote:
You could do what you want using calibre's command line tools as a scripting language, but it is probably not worth the effort. You would write a program that creates scripts. It would do something like: Search for books with Uncat. For each book found: 1) Get the tags for that book 2) Analyze the tags (this is the interesting part. Depending on the language, it could be easy or hard.) 3) produce a calibre command line "script" that sets #gmtags to the appropriate value 4) run that produced script If you feel like writing in python, another way to do it would be to write a program against calibre's internal db API that does the analysis and the updating. This would run orders of magnitude faster, but requires much more specialized knowledge. |
||
01-30-2014, 09:38 PM | #467 |
Junior Member
Posts: 3
Karma: 10
Join Date: Nov 2013
Device: Kindle Paperwhite 2013
|
Plugboard for series vs non-series books...
I apologize if this question has been answered somewhere in this thread (or another), but I was not able to find it. I've been using a small variation on the "standard"...
{series}{series_index:| - | - }{title} ...plugboard for getting my books sorted when I write them to my devices. Instead of "series", though, I've been using my own "#series_sort". This is close to what I want, but not quite there. What I would like is a template that treats the actual title a little differently depending on whether or not that book is in a series. As an example, imagine a book titled "The Sample Book". If that book is a part of a series -- say, book 1 in the series "Sample Series" -- I want the plugboard to give me... Sample Series - 01 - The Sample Book However, if the book is not part of a series, I want the plugboard to give me... Sample Book, The (or just "Sample Book") How would I do this with the calibre template language, if it is possible? |
Advert | |
|
01-30-2014, 09:58 PM | #468 |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
So basically, you want to use {title_sort} instead of {title}, but ONLY if there is no series?
(Keep in mind that "a/an/the" will not be used in the sort order on (I think) any device. But if it is visual aesthetics you want, then go ahead. ) Try Code:
{#series_sort}{#series_sort_index:| - | - }{:'test(field("#series_sort"),field("title"),field("title_sort"))'} |
01-31-2014, 05:16 AM | #469 |
Junior Member
Posts: 3
Karma: 10
Join Date: Nov 2013
Device: Kindle Paperwhite 2013
|
|
02-24-2014, 02:54 PM | #470 |
Connoisseur
Posts: 89
Karma: 14894
Join Date: Oct 2007
Location: Germany
Device: KPW G2 , 10" tablet
|
Hi thread, I'm amazed at the wizzardry that goes on here. I should be--I don't understand the half of it.
Coming from a Sony T2 I would like to use a plugboard to make up for a Paperwhite 2's inability to use collections. * The Material Roughly half my books are English, the others German with the odd Dutch one. Because Calibre doesn't work so well with German articles I tweaked my title display to not use the "xxx, the" format. I tag my books with genres, usually just one, sometimes two. These are comma separated, which I believe makes them a little problematic. If needs be I could make do with just the first genre, but retaining all would be preferable. I copy author_sort back to author manually on my first edit of a new book. I just don't dig the FN LN format anywhere in the software or on a reader. So it is "Updike, John" thrughout. No series and I don't see I'll ever use that. * The Goal I never use the titel sort view on the reader, as I'm usually not quite sure of the exact title. So my idea is to employ this in a different fashion. I would like to retain the ability to sort by author, but could do with just the last name and just the first author. First name and 2nd authors etc. could be truncated. I would like to be able to sort on my genres. The PW2 has the nice feature that you can click on the page count in the "shelf view" and enter a letter (or more) where you want to jump to in the list. So, entering "ps" in "genre sort view" would take me to the Psychology section and I could then leaf thru the 3 pages of it. (If, alternatively, I would employ searching, "ps" would throw up all sorts of results. So I would have to enter all of "psychology" and then get a novel thrown in which might use that word.) Because on the PW2 the author line is smaller than the title line, my idea was to use that on the PW2 as "author: title" (meaning sort by title is to all effects a sort by author). And the genres (tags) would go on the author line (turning author sort to genre sort). Either just the first genre or possibly both w/o the comma. In the end it should ideally look like this: Updike, John: Always looking Art Essay I would be very grateful if you had some ideas and suggestions as to how I could achieve this. Thanks -- Hendrik |
Advert | |
|
02-24-2014, 09:54 PM | #471 |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
use these plugboard entries:
Source template:{author_sort}: {title} Destination field:title Source template:{tags} Destination field:author_sort This should put "Lastname, Firstname: The Book Title" into the title field, and an alphabetical (I think) list of the tags into the author field. |
02-25-2014, 06:16 AM | #472 |
Connoisseur
Posts: 89
Karma: 14894
Join Date: Oct 2007
Location: Germany
Device: KPW G2 , 10" tablet
|
Thank you eschwartz.
I seem to have an odd problem with my testing this on a separate column. (All the deleting/ copying to the PW for test runs gets a little tedious.) I set up this column appropriately named "Test" and try the {tags} bit. That produces an exact copy of my tags column, i.e. it is comma separated. Would that go down well on the actual reader? Wouldn't it get messed up by the comma? If I test the other bit , {author_sort}: {title} , this produces mixed and very odd results, I get "Pausch, Randy: The Last Lecture" which is fine, but also "Paul: Starman: David Bowie, Trynka" which isn't because Trynka is the authos's LN. Also "Adams, Douglas: The Ultimate Hitchhiker's Guide" but then "Alan: The Line of Beauty, Hollinghurst" So, some entries are correct, most are not, but come out "FN: title, LN". I haven't been able to find a pattern in this. But it gets weirder still: I then found out by chance, that instead of right-click column head, add-your-own-columns etc. I can edit the template directly by clicking on it twice. And editing one entry changes it for all of the books. Now, if I double-click the Hollinghurst example it shows the correct "template value" in the edit window, i.e. "Hollinghurst, Alan: The Line of Beauty". Again: The Edit Template window has the value right, but on closing it, the actual columns shows the wrong value as given above. I don't get this, has anyone else encountered this at all? |
02-25-2014, 06:27 AM | #473 | ||
Grand Sorcerer
Posts: 11,962
Karma: 7225107
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Quote:
|
||
02-25-2014, 06:41 AM | #474 | |
Connoisseur
Posts: 89
Karma: 14894
Join Date: Oct 2007
Location: Germany
Device: KPW G2 , 10" tablet
|
Quote:
Re column type: Yes, it is the "behaves like tags" type (I don't even recall whether I actively made it so ...). Which type should I choose for testing then, please? Hendrik |
|
02-25-2014, 06:45 AM | #475 | ||
Grand Sorcerer
Posts: 11,962
Karma: 7225107
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Quote:
|
||
02-25-2014, 07:34 AM | #476 | |
Connoisseur
Posts: 89
Karma: 14894
Join Date: Oct 2007
Location: Germany
Device: KPW G2 , 10" tablet
|
Quote:
And "long text ..." is not shown, but doesn't that refute the whole idea of testing, not being able to see the result? |
|
02-25-2014, 07:36 AM | #477 | |
Grand Sorcerer
Posts: 11,962
Karma: 7225107
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
You are right. You should use "Columns built from columns", not "Columns built from columns, behaves like tags". |
|
02-25-2014, 08:25 AM | #478 |
Connoisseur
Posts: 89
Karma: 14894
Join Date: Oct 2007
Location: Germany
Device: KPW G2 , 10" tablet
|
|
02-25-2014, 08:33 AM | #479 | |
Connoisseur
Posts: 89
Karma: 14894
Join Date: Oct 2007
Location: Germany
Device: KPW G2 , 10" tablet
|
But further to eschwartz suggestion ...
Quote:
Surprise, surprise: The first bit went down alright, even longish authors with "&" and all came out right followed by colon and title. But, yikes: {tags} > author_sort produced "author" (FN LN) on the author line. It seems to ignore "tags" altogether? |
|
02-25-2014, 10:35 AM | #480 |
Connoisseur
Posts: 89
Karma: 14894
Join Date: Oct 2007
Location: Germany
Device: KPW G2 , 10" tablet
|
OK, it seems
Code:
Source template:{tags} Destination field:authors How can I truncate the author_sort here Code:
Source template:{author_sort}: {title} Destination field:title I found this somewhere Code:
{author_sort:re(([^\,]+)(\,|$)(.*),\1)} |
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 |