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 03-20-2011, 11:13 AM   #16
arspr
Dead account. Bye
arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.
 
Posts: 587
Karma: 668244
Join Date: Mar 2011
Device: none
Quote:
Originally Posted by Manichean View Post
Hide the composite column, not the original one.


I'm fully dumb. Of course this is the solution. Original column in table view, composite column in Tag Browser.

arspr is offline   Reply With Quote
Old 03-20-2011, 12:33 PM   #17
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: 12,339
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by arspr View Post
Unless you can give a really, REALLY good hint, I feel the template coding can be really painful because you have to:
Here is a hint.

Go to preferences -> template functions. Enter:

Function: names_to_sort
Arg count: 1
Documentation: Given an author-like string, return the author-sort for it.
Program code:
Code:
def evaluate(self, formatter, kwargs, mi, locals, names):
    from calibre.ebooks.metadata import authors_to_sort_string, string_to_authors

    return authors_to_sort_string(string_to_authors(names))
Press the Create button, then the Apply icon. Now create a custom column that you want to contain the sort string for an author-like field and enter the template. For 'authors' the template would be:
Code:
{authors:names_to_sort()}
Change 'authors' to the lookup name for your translator column.

Last edited by chaley; 03-20-2011 at 04:15 PM. Reason: Correct the function name
chaley is offline   Reply With Quote
Advert
Old 03-20-2011, 12:58 PM   #18
arspr
Dead account. Bye
arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.
 
Posts: 587
Karma: 668244
Join Date: Mar 2011
Device: none


Thank you, chaley. I'll test later.

Any hint about the & feature?
arspr is offline   Reply With Quote
Old 03-20-2011, 01:06 PM   #19
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: 12,339
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by arspr View Post


Thank you, chaley. I'll test later.

Any hint about the & feature?
What I gave you replicates exactly calibre's building author_sort from authors, including multiple authors. Is the & feature something else?
chaley is offline   Reply With Quote
Old 03-20-2011, 02:06 PM   #20
Manichean
Wizard
Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.
 
Manichean's Avatar
 
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
Quote:
Originally Posted by chaley View Post
Here is a hint.

Go to preferences -> template functions. Enter:

Function: name_to_sort
[...]

For 'authors' the template would be:
Code:
{authors:names_to_sort()}
Change 'authors' to the lookup name for your translator column.
Shouldn't the function in the template be "name_to_sort()"?
Manichean is offline   Reply With Quote
Advert
Old 03-20-2011, 02:28 PM   #21
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: 12,339
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Manichean View Post
Shouldn't the function in the template be "name_to_sort()"?
No. The input is a string containing 1 or more author's names. For example, assuming no tweaks are set, "A B" returns "B, A", and "A B & C D" returns B, A & D, C".

The inner function call, string_to_authors, breaks apart the input author string into a list of authors. The outer function, authors_to_author_sort, accepts a list of authors (the result of the inner function) and produces an author_sort string, which is the result of the template function.
chaley is offline   Reply With Quote
Old 03-20-2011, 02:51 PM   #22
Manichean
Wizard
Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.
 
Manichean's Avatar
 
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
Quote:
Originally Posted by chaley View Post
No. The input is a string containing 1 or more author's names. For example, assuming no tweaks are set, "A B" returns "B, A", and "A B & C D" returns B, A & D, C".

The inner function call, string_to_authors, breaks apart the input author string into a list of authors. The outer function, authors_to_author_sort, accepts a list of authors (the result of the inner function) and produces an author_sort string, which is the result of the template function.
What I meant is that you called the function "name_to_sort" in your definition and "names_to_sort" in the template. I think one of those is a typo.
Manichean is offline   Reply With Quote
Old 03-20-2011, 04:16 PM   #23
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: 12,339
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Manichean View Post
What I meant is that you called the function "name_to_sort" in your definition and "names_to_sort" in the template. I think one of those is a typo.
You are, of course, correct. I fixed the definition.

Thank you for pointing this out!
chaley is offline   Reply With Quote
Old 03-21-2011, 10:49 AM   #24
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: 12,339
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by arspr View Post
Any hint about the & feature?
I have reread the pertinent posts, and I now think I understand what you mean by "the & feature".

To summarize, you want a column that contains names of people, mimicking the author column, including separate sort values. Such a column would be used for editors, translators, friends, and what-have-you, and would have several characteristics:
  1. It would be 'multiple', possibly containing more than one name.
  2. It would be separated by &, not comma. Commas would not be significant.
  3. Completion would use author-like rules, including the tweaks.
  4. It would sort using author_sort rules, including the tweaks.
  5. It would display using author rules, including the tweaks.
  6. The author_sort value can be set independently of the name.
Of these, the first 5 are probably doable because none of the 5 radically break existing database and code 'rules'. The last one, the separate column for the sort value, would require changing the database, which is more problematic.

My thought is that such a column would be similar to a tags-like custom column (already multiple), but with the behavior indicated by lines 2-5. The required changes touch a large number of bits of code, but as I said above, probably doable.

It is worth noting that such a column would create a new pool of names. This matters if a person is both an editor and an author. The standard searches would be role-based (author, editor, ???). A grouped search term could be made to amalgamate all the fields together for searching, but that isn't a perfect solution. For example, renaming the person in one role would not rename the same person in another role.

The question: Is this work worth doing without the separate column and given the role-based behavior?
chaley is offline   Reply With Quote
Old 03-21-2011, 02:15 PM   #25
arspr
Dead account. Bye
arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.
 
Posts: 587
Karma: 668244
Join Date: Mar 2011
Device: none
Yes chaley, that's what I wanted: A tag like field but using & instead of comma and with all the associated author sorting stuff.

And also like in a brainstorm, you've pointed something I hadn't thought of: Creating just one people pool, it doesn't matter their "jobs". As you point out, the same person being an author AND a translator (or an editor, or whatever) at the same time can be quite possible.

I think it would be really nice that Calibre only had this single "people-database", no matter in which field the name is used (canon Author or any other additional author-like custom column).

But as you say I cannot tell if this improvement is worth the effort. (Maybe you can make a poll between Calibre coders).

As a less radical change, maybe Author-like columns could be fully implemented but not making a single "people database", so "Christopher Tolkien" in Authors would be different from "Christopher Tolkien" as editor. I mean, if you rename the author "Christopher Tolkien" to "Tolkien junior", the editor would continue being "Christopher Tolkien". But again, I cannot tell if this improvement is worth the effort...
arspr is offline   Reply With Quote
Old 03-22-2011, 04:11 PM   #26
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: 12,339
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Items 1-5, with separate people-pools per column are now available in calibre's source trunk, and will be in the next release.
chaley is offline   Reply With Quote
Old 03-23-2011, 10:14 PM   #27
collin8579
Member
collin8579 began at the beginning.
 
Posts: 21
Karma: 10
Join Date: Mar 2011
Device: Kindle
I am new to this type of,,, programming?... for lack of a better term atm,,

I was pointed to this thread to help me with a similar issue,
Comparing series and author to find some duplicates I inadvertently created by copying author to series on a lot of books,,,

I have been working to use the techniques in this thread to create a custom column that indicates this,, but I seem to be lacking,,

I am trying the method using template functions, with this information

Function: series_Sort
Arg count: 1
Program code:
def evaluate(self, formatter, kwargs, mi, locals, names):
from calibre.ebooks.metadata import series_sort_string, author_series_sort

return series_sort_string(author_series_sort(names))


The custom column is {test:series_sort()}
and I get the error
Exception file"<String>",line 5, in evaluate:importError: cannot import name series_sort_string

Now,, I basically understand when I copied over from the example above and just subbed in series and author I messed it up,,

Can someone help me fix this, or point me to where I can find the correct arguments/syntax,,

This thread when it starts assumes a level of knowledge within the template functions/syntax/arguments,, that I don't currently have,, I will work on this but in the mean time I will just bug you all :P

Thanks,
Collin
collin8579 is offline   Reply With Quote
Old 03-24-2011, 08:57 AM   #28
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: 12,339
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
You should follow the example in post 8, substituting series and authors for the two fields in that template.
chaley is offline   Reply With Quote
Old 03-24-2011, 10:47 PM   #29
collin8579
Member
collin8579 began at the beginning.
 
Posts: 21
Karma: 10
Join Date: Mar 2011
Device: Kindle
Well,, I did that,, and it only gave me "yes" responses,, here is the syntax

column lookup name and heading are test,,
made from other column, yes/no answers with show checkmarks,,

{#test:'strcmp(field('#series'), field('#author'), 'No', 'Yes', 'No')'}

tried {#test:'strcmp(field('#series'), field('#authors'), 'No', 'Yes', 'No')'} too,,, didn't know if it had an s,,

did I do something wrong?
collin8579 is offline   Reply With Quote
Old 03-25-2011, 02:53 AM   #30
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: 12,339
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
The lookup names for series & authors do not have # in front of them. That character is used to indicate that the item is a a custom column.
chaley is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Borders - Select books for $5 each jbcohen Deals and Resources (No Self-Promotion or Affiliate Links) 8 12-25-2010 05:53 PM
25% off on select books @ Kobo Books eric11210 Deals and Resources (No Self-Promotion or Affiliate Links) 16 10-31-2010 11:33 AM
Opus ask me to select the language everytime I turn it on tokio2 Bookeen 2 09-17-2010 11:11 AM
Kobo Books: $2 Off Select Titles Acreo Aeneas Deals and Resources (No Self-Promotion or Affiliate Links) 6 09-02-2010 09:35 AM
Sync only select books Carenza Calibre 2 08-10-2010 05:16 PM


All times are GMT -4. The time now is 11:26 PM.


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