Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Development

Notices

Reply
 
Thread Tools Search this Thread
Old 12-20-2021, 04:34 PM   #1
plazma
Member
plazma began at the beginning.
 
Posts: 15
Karma: 10
Join Date: Feb 2014
Device: kindle paperwhite
Help with extra metadata columns from metadata download plugin

Hi, I wanted to add extra metadata columns, when I'm downloading information in my metadata plugin, so that you can use that data in the book overview as a new column.

However, it is not working for me. Example. The extra data is 'original title', if you have translation in other language. So, what I did, I added it touched fields:

```
touched_fields = frozenset(['title', 'authors', 'identifier:martinussk',
'identifier:isbn', 'rating', 'comments', 'publisher', 'pubdate',
'series', 'tags', 'languages', '#original_title'])
```

Then I added the user's metadata information to the Metadata object, and set the value:

```
mi = Metadata(showing_title, authors)
parsed_original_title = self.parse_original_title(root)
mi.set_user_metadata('#original_title', {'datatype': 'text',
'name': 'original_title',
'is_multiple': False,
'#value#': None})
mi.set('#original_title', parses_original_title)
```

So far so good, however, when the download is running, I'm getting this error:

```
calibre, version 5.34.0
CHYBA: Sťahovanie zlyhalo: Stiahnutie metadát zlyhalo. Detaily zobrazíte kliknutím na Zobraziť podrobnosti

Traceback (most recent call last):
File "calibre\utils\ipc\simple_worker.py", line 304, in main
File "calibre\ebooks\metadata\sources\worker.py", line 107, in single_identify
File "calibre\ebooks\metadata\sources\identify.py", line 498, in identify
File "calibre\ebooks\metadata\sources\identify.py", line 366, in merge_identify_results
File "calibre\ebooks\metadata\sources\identify.py", line 154, in finalize
File "calibre\ebooks\metadata\sources\identify.py", line 248, in merge_isbn_results
File "calibre\ebooks\metadata\sources\identify.py", line 350, in merge
File "calibre\ebooks\metadata\book\base.py", line 163, in __getattribute__
AttributeError: Metadata object has no attribute named: '#original_title'
```

Looking at the base.py class, the merge does not merge any user_metadata. It has trouble doing that, as it tries to get the null value from the localy created Metadata object --> https://github.com/kovidgoyal/calibr...entify.py#L346

If I don't include the '#original_title' in 'touched_fields', then the download works, but the fields are not reflected inside the table. Where in the Settings->Add your own column-> I added a field with a lookup name: "#original_title".

How is this supposed to work? If at all? Is it possible for metadata download plugin define custom columns that can be looked up in the 'Add your own columns' section?

I saw several plugins just add this information to the 'comments' section. But is it possible in some way to have this as the actual column in overview?
plazma is offline   Reply With Quote
Old 12-20-2021, 04:43 PM   #2
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 6,498
Karma: 84420419
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
Some of your questions may be answered in this thread: Questions about my first metadata plugin
jhowell is offline   Reply With Quote
Reply

Tags
custom column, metadata, metadata download


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to metadata download plugin to custom columns. cdecaf Development 1 09-21-2020 01:04 PM
LibraryThing metadata download plugin rtype Plugins 30 09-08-2015 07:24 PM
Regarding using metadata objects in identify method of metadata download plugin api aprekates Development 1 07-06-2014 03:35 AM
[Metadata Download Plugin] Goodreads Metadata **Deprecated** kiwidude Plugins 30 04-23-2011 02:10 PM


All times are GMT -4. The time now is 07:16 PM.


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