12-11-2015, 04:49 PM | #1 |
Member
Posts: 11
Karma: 10
Join Date: Dec 2015
Device: Amazon Kindle 4
|
Metadata update.
Hi.
I've figured out that if i wanted to change a particular metadata field i would do that like this. Code:
self.db.new_api.set_field('title',{book_id:'new_title'}) I am guessing that calibre is storing my changes in some cache and i need to tell calibre to refresh itself. I just don't know how. I would be grateful for any help. |
12-12-2015, 12:27 AM | #2 |
creator of calibre
Posts: 43,926
Karma: 22669820
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You have to explicitly refresh the GUI when you make changes to the db. You can do it simply via
self.gui.iactions['Edit Metadata'].refresh_books_after_metadata_edit({book_id}) |
Advert | |
|
12-12-2015, 06:32 AM | #3 |
Member
Posts: 11
Karma: 10
Join Date: Dec 2015
Device: Amazon Kindle 4
|
Sorry, but it doesn't work for me. Maybe i am not using it right.
Code:
calibre 2.5 isfrozen: False is64bit: True Linux-3.16.0-4-amd64-x86_64-with-debian-8.1 Linux ('64bit', 'ELF') ('Linux', '3.16.0-4-amd64', '#1 SMP Debian 3.16.7-ckt11-1 (2015-05-24)') Python 2.7.9 Linux: ('debian', '8.1', '') Successfully initialized third party plugins: CalibreBookBrainzPlugin && CalibreBookBrainzPluginBBID Traceback (most recent call last): File "calibre_plugins.CalibreBookBrainzPluginBBID.main", line 88, in metadataUpdate AttributeError: 'EditMetadataAction' object has no attribute 'refresh_books_after_metadata_edit' |
12-12-2015, 06:50 AM | #4 |
creator of calibre
Posts: 43,926
Karma: 22669820
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Your version of calibre is ancient. I dont recall if that API existed in 2.5. But you can easily find that function in the current calibre source code and do what it does manually.
|
12-12-2015, 07:25 AM | #5 |
Member
Posts: 11
Karma: 10
Join Date: Dec 2015
Device: Amazon Kindle 4
|
Ok, I thought that the latest version was 2.4.6 not 2.46.
Now i have calibre v.2.46 and suddenly requests stopped working. Code:
Plugin removed Plugin updated: CalibreBookBrainzPluginBBID (0, 0, 1) calibre 2.46 isfrozen: True is64bit: True Linux-3.16.0-4-amd64-x86_64-with-debian-8.1 Linux ('64bit', 'ELF') ('Linux', '3.16.0-4-amd64', '#1 SMP Debian 3.16.7-ckt11-1 (2015-05-24)') Python 2.7.9 Linux: ('debian', '8.1', '') Successfully initialized third party plugins: CalibreBookBrainzPluginBBID Starting up... Traceback (most recent call last): File "site-packages/calibre/gui2/ui.py", line 152, in __init__ File "site-packages/calibre/gui2/ui.py", line 166, in init_iaction File "site-packages/calibre/customize/__init__.py", line 582, in load_actual_plugin File "importlib/__init__.py", line 37, in import_module File "site-packages/calibre/customize/zipplugin.py", line 179, in load_module File "calibre_plugins.CalibreBookBrainzPluginBBID.ui", line 11, in <module> File "site-packages/calibre/customize/zipplugin.py", line 179, in load_module File "calibre_plugins.CalibreBookBrainzPluginBBID.main", line 11, in <module> ImportError: No module named requests Key u'S' for shortcut Zapisz na dysku is already used by Połącz wpisy książki, ignoring Started up in 2.17 seconds with 14 books I've installed requests for python and python3. |
Advert | |
|
12-12-2015, 08:25 AM | #6 |
creator of calibre
Posts: 43,926
Karma: 22669820
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
If you run the binary then it does not use the system python. For that, you have to add the system site-packages path to sys.path manually.
|
12-12-2015, 08:58 AM | #7 |
Member
Posts: 11
Karma: 10
Join Date: Dec 2015
Device: Amazon Kindle 4
|
Ok, thanks - now everything launches fine.
But still gui doesn't change. Code:
mi = self.gui.library_view.model().db.get_metadata(rows[0].row()) print(self.db.new_api.field_for('title', book_id)) self.db.new_api.set_field('title',{book_id:'STH'}) self.gui.iactions['Edit Metadata'].refresh_books_after_metadata_edit({book_id}) Last edited by stanislas; 12-12-2015 at 09:23 AM. |
12-12-2015, 09:24 AM | #8 |
Member
Posts: 11
Karma: 10
Join Date: Dec 2015
Device: Amazon Kindle 4
|
Am i using
Code:
self.gui.iactions['Edit Metadata'].refresh_books_after_metadata_edit |
12-12-2015, 09:38 AM | #9 |
Member
Posts: 11
Karma: 10
Join Date: Dec 2015
Device: Amazon Kindle 4
|
Maybe i am using bad book_id ? I am using book_id from :
Code:
rows = self.gui.current_view().selectionModel().selectedRows() book_id=rows[0].row() |
12-12-2015, 12:31 PM | #10 |
Grand Sorcerer
Posts: 11,757
Karma: 7029857
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
The row is position in the list of books, not the book_id.
One way to get the book id from the row is Code:
book_id = self.gui.library_view.model().id(rows[0]) Last edited by chaley; 12-12-2015 at 12:34 PM. Reason: make getting the book id an assignment |
12-12-2015, 04:12 PM | #11 |
Member
Posts: 11
Karma: 10
Join Date: Dec 2015
Device: Amazon Kindle 4
|
Finally, it works
Great thanks to both of you chaley and kavidgoyal |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Is there a way to automatically update metadata? | dmunson | Library Management | 5 | 04-28-2015 06:59 PM |
Metadata update | simmybear | Devices | 1 | 09-01-2014 01:36 PM |
Calibre Metadata does not update | Amalthia | Calibre | 5 | 09-03-2013 06:42 AM |
Metadata update not working since latest update... | Rickkins | Library Management | 4 | 10-04-2011 03:12 AM |
Update metadata without re-converting? | TheD0ct0r | Library Management | 15 | 06-20-2011 10:22 PM |