Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 01-10-2014, 04:18 AM   #466
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,704
Karma: 6658935
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Gary_M_Mugford View Post
Gawd, does THIS feel familiar. Me pie in the skying and you coming to the battle.
Quote:
Okay, since YOU ASKED .... I'm faced with this situation. I add a rather large number of books. I then select the newly added ones and change the new books to have an Uncat value in the my #gmtags column. It's not a complex column, just one that allows for my small tag sub-set, Mysteries, Thrillers, SF, NF, Sports, Biographies, Sports Biographies, Bridge, Writing and Young Adult. Then, I ctrl-D and download the metadata from the internet. I then run a series of saved searches that looks for #gmtags=Uncat added to a series of search terms in a bracketed OR clause for the tags field. One that covers, for the most part, each of the gmtags categories. After it finds the uncategorized books that fit, I select all and go into group edit. I check off delete all gmtags and then add that particular gmtag. Click OK and the books all disappear. I then move on to the next saved search. Repeat rinse cycle.

...

That's WHAT I am doing. I would like to shorten the steps down to one really smart super search (that would change the other column), because wrapping it up IN a created column definition might slow things down during normal use of the library I have created in Calibre. I'm sure there are bigger libraries out there. But given the inclusion of academic papers and my own writings and acquired books, mine is sizable.
Given that you don't want to use a composite custom column (what you called a created column), I don't see any better way to do it than you are already using. The difficulty: you really want some form of scripting or automation that permits you to change values in "normal" columns on demand based on some conditions. Calibre does not have a embedded scripting language that can do this. Composite columns come close, but they are computed on every use (display) and not on demand as you want.

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.
chaley is offline   Reply With Quote
Old 01-30-2014, 09:38 PM   #467
hockeyjod
Junior Member
hockeyjod began at the beginning.
 
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?
hockeyjod is offline   Reply With Quote
Old 01-30-2014, 09:58 PM   #468
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
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)
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"))'}
eschwartz is offline   Reply With Quote
Old 01-31-2014, 05:16 AM   #469
hockeyjod
Junior Member
hockeyjod began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Nov 2013
Device: Kindle Paperwhite 2013
Quote:
Originally Posted by eschwartz View Post
So basically, you want to use {title_sort} instead of {title}, but ONLY if there is no series?
Yes, exactly. That would have been a much more efficient way to ask my question, if I had thought of it. Thanks for the suggestion, and I will try it!
hockeyjod is offline   Reply With Quote
Old 02-24-2014, 02:54 PM   #470
sheygetz
Connoisseur
sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.
 
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
sheygetz is offline   Reply With Quote
Old 02-24-2014, 09:54 PM   #471
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
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)
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.
eschwartz is offline   Reply With Quote
Old 02-25-2014, 06:16 AM   #472
sheygetz
Connoisseur
sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.
 
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?
sheygetz is offline   Reply With Quote
Old 02-25-2014, 06:27 AM   #473
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,704
Karma: 6658935
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by sheygetz View Post
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.)

...

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.
This is correct behavior. There is one template for the entire column.
Quote:
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?
My guess is that you are using a "like tags" column for your testing. In this column type commas are significant, telling calibre that one tag has ended and another started. In your Hollinghurst example, one tag is "Hollinghurst" and another is "Alan: The Line of Beauty". These two tags are then sorted into alpha order, putting "Hollinghurst" after "Alan...". Douglas Adams comes out right because Adams sorts before Douglas.
chaley is offline   Reply With Quote
Old 02-25-2014, 06:41 AM   #474
sheygetz
Connoisseur
sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.
 
Posts: 89
Karma: 14894
Join Date: Oct 2007
Location: Germany
Device: KPW G2 , 10" tablet
Quote:
Originally Posted by chaley View Post
This is correct behavior. There is one template for the entire column.
Yesyes, I do not doubt that. But isn't it odd, that with a "direct" template edit you do not need a restart to apply. But if I go thru the right-click column head, add column etc routine I have to restart?

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
sheygetz is offline   Reply With Quote
Old 02-25-2014, 06:45 AM   #475
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,704
Karma: 6658935
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by sheygetz View Post
Yesyes, I do not doubt that. But isn't it odd, that with a "direct" template edit you do not need a restart to apply. But if I go thru the right-click column head, add column etc routine I have to restart?
Avoiding the restart was the reason direct editing of the template was added. If you hit F2 (or its equivalent for you) then you get a template editor that doesn't force restart.
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
In this case, "text, shown in the tag browser", or "long text ...". If you have a lot of books in your library then I would pick "long text" so that there is no performance penalty when rebuilding the tag browser information.
chaley is offline   Reply With Quote
Old 02-25-2014, 07:34 AM   #476
sheygetz
Connoisseur
sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.
 
Posts: 89
Karma: 14894
Join Date: Oct 2007
Location: Germany
Device: KPW G2 , 10" tablet
Quote:
Originally Posted by chaley View Post
In this case, "text, shown in the tag browser", or "long text ...". If you have a lot of books in your library then I would pick "long text" ...
Sorry, I don't quite follow: creating a "text ..." column does not allow me to enter the plugboard expressions, that I want to test--at least I don't see where and how.

And "long text ..." is not shown, but doesn't that refute the whole idea of testing, not being able to see the result?
sheygetz is offline   Reply With Quote
Old 02-25-2014, 07:36 AM   #477
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,704
Karma: 6658935
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by sheygetz View Post
Sorry, I don't quite follow: creating a "text ..." column does not allow me to enter the plugboard expressions, that I want to test--at least I don't see where and how.

And "long text ..." is not shown, but doesn't that refute the whole idea of testing, not being able to see the result?
Ahhh, the senior moments. I lost track of the context.

You are right. You should use "Columns built from columns", not "Columns built from columns, behaves like tags".
chaley is offline   Reply With Quote
Old 02-25-2014, 08:25 AM   #478
sheygetz
Connoisseur
sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.
 
Posts: 89
Karma: 14894
Join Date: Oct 2007
Location: Germany
Device: KPW G2 , 10" tablet
Quote:
Originally Posted by chaley View Post
Ahhh, the senior moments.
Had to look that up

sheygetz is offline   Reply With Quote
Old 02-25-2014, 08:33 AM   #479
sheygetz
Connoisseur
sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.
 
Posts: 89
Karma: 14894
Join Date: Oct 2007
Location: Germany
Device: KPW G2 , 10" tablet
But further to eschwartz suggestion ...
Quote:
Originally Posted by eschwartz View Post
use these plugboard entries:
Source template:{author_sort}: {title}
Destination field:title
Source template:{tags}
Destination field:author_sort
... I tested it with two dozen books transferred to PeeWee2.
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?
sheygetz is offline   Reply With Quote
Old 02-25-2014, 10:35 AM   #480
sheygetz
Connoisseur
sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.sheygetz is less competitive than you.
 
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
does the trick.


How can I truncate the author_sort here
Code:
Source template:{author_sort}: {title}
Destination field:title
to the first author's surname, please?

I found this somewhere
Code:
{author_sort:re(([^\,]+)(\,|$)(.*),\1)}
would it do the trick, and do I really need all of these brackets. I can't find explanations for them in the online help.
sheygetz is offline   Reply With Quote
Reply

Tags
custom column, tag, tags

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

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


All times are GMT -4. The time now is 01:13 AM.


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