11-04-2014, 01:41 PM | #1 |
♫
Posts: 660
Karma: 506380
Join Date: Aug 2010
Location: Germany
Device: Kobo Aura / PB Lux 2 / Bookeen Frontlight / Kobo Mini / Nook Color
|
Author/Title sort
I wrote a little plugin that reads the metadata of books using self.db.get_metadata, then changes the values of the author and/or the title and writes the data back using self.db.set_metadata.
Everything works. What I don't get to work, how do I set author_sort and/or title_sort of my changed values? Is there a function that I can use to calculate and write them back? One more question, I also use QProgressDialog, it works, but it always shows "libprs500" in the header of the progress window. How do i get rid of this? |
11-04-2014, 09:02 PM | #2 |
creator of calibre
Posts: 43,871
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
dont use get/set metadata, they are very ineeficient if all you want to do is change a couple of fields. Use db.new_api.field_for('title', book_id) and db.new_api.field_for('authors') and to change,
db.new_api.set_field('title', {book_id:value}) db.new_api.set_field('authors', {book_id:value}) Then use 'title_sort' and 'author_sort' to work with those fields. ANd to set the window title use self.setWindowTitle('whatever') |
Advert | |
|
11-05-2014, 06:56 AM | #3 |
♫
Posts: 660
Karma: 506380
Join Date: Aug 2010
Location: Germany
Device: Kobo Aura / PB Lux 2 / Bookeen Frontlight / Kobo Mini / Nook Color
|
Thanks, I changed to the new_api method.
Seems that using that one authors_sort and title_sort are automatically updated? Much better than get/set metadata. But self.setWindowTitle('whatever') does not work. It is actually the window of the progressbar that shows the libprs500 text, no matter if I use self.setWindowTitle('whatever') or progressbarname.setWindowTitle('whatever')... |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Title and Author Sort | jgt1942 | Library Management | 5 | 05-26-2014 03:59 AM |
Caibre - Fails to sort by Author, Title, etc | LesWilk | Devices | 1 | 03-17-2012 06:41 AM |
Sort by author then title | richardwarriner | Library Management | 3 | 11-16-2011 01:00 PM |
Author then title sort | Gary Young | Calibre | 4 | 08-30-2010 10:03 PM |
Sort by author AND title | bookends | Calibre | 2 | 05-09-2010 01:55 PM |