@kovidgoyal
Maybe I can ask you two more small question also, if you have time for it. Otherwise do not mind about answering at all, because the extension is working fine already.
1. I did not know from where to get the calibre library path unambiguously. For example it could be possible that a foreign user, like me, has accidently two calibre folders (two different languages) in his home directory.
I figured out that probably I get the correct used library path from the global.py file in the .config/calibre folder. I am hoping that this file always contains the correct in use calibre library path (in general).
2. I did not find an easy way to use some AND operator in sqlite. I want to be able to enter two query words that are contained either in the title or in the author_sort columns (I could not find simply an author column).
I ended up using a subquery as follows:
results = c.execute('select title, author_sort, path from books where (title like "%{}%" or author_sort like "%{}%") and id in (select id from books where title like "%{}%" or author_sort like "%{}%")'.format(queries[1], queries[1], queries[0], queries[0]))
I was hoping you remember how you would nicely execute a query like this in sqlite. Sorry I am only learning things by myself from the internet.
Again do not mind about answering if it costs too much time. I just assume you must be quite an expert and you can answer these question by heart.
In any case... thanks again!
|