View Single Post
Old 09-06-2011, 02:30 AM   #9
kacir
Wizard
kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.
 
kacir's Avatar
 
Posts: 3,463
Karma: 10684861
Join Date: May 2006
Device: PocketBook 360, before it was Sony Reader, cassiopeia A-20
Quote:
Originally Posted by kiwidude View Post
Actually there isn't a single setting. That would be nice for many reasons I have battled for in the past, but the reasons against such a thing are valid so I don't try any more
There is another solution ...
Let the user provide the string
search = ['author:"'+re.sub(r'(.*) ([^ ]*)',r'\2',a.strip().replace('|', ','))+'"' for a in authors.split(',')]
as a configuration option ;-)
Like you can define RE for book import or for "save to disk" or for plugboard.

You see, I had several reasons for creating this thread. Here they are, ordered by importance:

1. I was happy that I succeeded in creating my first meaningful private patch, and I wanted to share my joy with this wonderful community.

2. I wanted to share my hack with whomever might have the same itch that I was trying to scratch. With millions of Calibre users around the world, I am pretty sure there are [a few] users that might find this interesting.

3. I wanted to encourage people to try to have a peek at Calibre internals, because making a *small* patch wasn't nearly as difficult as I was expecting. Even if your Python programming experience is fairly limited.

4. I wanted to hear what others think about the usefulness of this (admittedly very specific) hack

5. I was thinking that it would be extremely cool to have a patch accepted into the main tree ;-).
But, now that I am up and running, I think that there will be more such little patches (especially where I can use RegularExpression to do something cool), and who knows ... perhaps one day ...
kacir is offline   Reply With Quote