Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 12-08-2015, 04:28 AM   #1
vasyl
Junior Member
vasyl began at the beginning.
 
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).
vasyl is offline   Reply With Quote
Old 12-08-2015, 04:42 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,859
Karma: 22666666
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
kovidgoyal is offline   Reply With Quote
Old 12-09-2015, 12:03 AM   #3
vasyl
Junior Member
vasyl began at the beginning.
 
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
vasyl is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 12:34 PM.


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