![]() |
#1 |
Junior Member
![]() Posts: 5
Karma: 10
Join Date: Dec 2015
Device: none
|
Issue with metadata plugins
I've been trying to adapt a metadata plugin for DJVU files (found on https://github.com/aroig/metadata-readers if anybody's interested) but ran into an odd issue. The plugin does not work as is so I tried to debug and here's what I've found. The stream.name in get_metadata() is just the file name without the actual path. The original plugin is using os.path.abspath() which only makes things worse, applying the actual Calibre install folder instead of the actual file path.
I could not find any way to get the right path to the stream file, nothing in the API docs helps, and there seem to be no good examples of metadata plugins. So, am I missing something or is it just a bug? For reference, I am using Win64 build version 2.45. The bug was there in 2.37 (updated in the process of investigating). |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,144
Karma: 27110892
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
There is no guarantee that the stream points to an actual file on the filesystem. If you need to use a file on the filesystem, copy the stream to a temporary file, then run your plugin, then copy it back. See for example metadata/pdf.py
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Junior Member
![]() Posts: 5
Karma: 10
Join Date: Dec 2015
Device: none
|
Ah, thanks! Got it to work. Unfortunately, not a production quality plugin with multiple external dependencies (djvulibre, netpbm) but still better than nothing
![]() |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Metadata Download Plugins | TogTogTogTog | Plugins | 5 | 11-25-2018 12:32 AM |
Metadata issue with 0.8.30 on OS X | dpeace | Calibre | 2 | 12-10-2011 09:40 AM |
Ratings Not Being Pulled From All Plugins (Metadata Download) | clambert | Plugins | 13 | 10-27-2010 07:29 AM |
Metadata download plugins | newbino | Plugins | 3 | 07-31-2010 11:25 PM |
Strange MetaData Issue | Sirkit | Calibre | 6 | 01-02-2010 06:30 PM |