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 01-03-2009, 12:21 PM   #1
junkml
Addict
junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.
 
junkml's Avatar
 
Posts: 277
Karma: 1004969
Join Date: Mar 2007
Device: Sony Reader
Plugins

Hello, I thought I'd start a new thread about the Plugins.

I've finally been able to create a plugin that will work with the Windows Command Line. However, I'm running into one thing.

If I modify the Hello World plugin to work on_import agains .lit files, I get the following error when loading a file:

Loading plugin from C:\Users\Owner\AppData\Roaming\calibre\plugins\Hel lo World Plugin.zip
Traceback (most recent call last):
File "C:\Program Files\calibre\library.zip\calibre\customize\ui.py" , line 146,
in _run_filetype_plugins
File "<string>", line 20, in run
File "calibre\ebooks\metadata\meta.pyo", line 87, in set_metadata
AttributeError: 'MetaInformation' object has no attribute 'lower'
junkml is offline   Reply With Quote
Old 01-03-2009, 01:27 PM   #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: 44,509
Karma: 24495778
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
oops small typo in the hello world plugin:

change
Code:
set_metadata(file, ext, mi)

to
set_metadata(file, mi, ext)
But you should be aware that calibre can't set the metadata in lit files. Setting only works for rtf, lrf and epub
kovidgoyal is offline   Reply With Quote
Advert
Old 01-03-2009, 01:56 PM   #3
junkml
Addict
junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.
 
junkml's Avatar
 
Posts: 277
Karma: 1004969
Join Date: Mar 2007
Device: Sony Reader
Quote:
Originally Posted by kovidgoyal View Post
oops small typo in the hello world plugin:

change
Code:
set_metadata(file, ext, mi)

to
set_metadata(file, mi, ext)
But you should be aware that calibre can't set the metadata in lit files. Setting only works for rtf, lrf and epub
Cool thanks.

Another question, though. Is there any way to have Calibre re-read the metadata from the file within the plugin?
junkml is offline   Reply With Quote
Old 01-03-2009, 02:33 PM   #4
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: 44,509
Karma: 24495778
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by junkml View Post
Cool thanks.

Another question, though. Is there any way to have Calibre re-read the metadata from the file within the plugin?
If you want to change the way calibre reads metadata from files, you have to create a metadata reader plugin. Its in the documentation.
kovidgoyal is offline   Reply With Quote
Old 01-03-2009, 02:42 PM   #5
junkml
Addict
junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.
 
junkml's Avatar
 
Posts: 277
Karma: 1004969
Join Date: Mar 2007
Device: Sony Reader
Quote:
Originally Posted by kovidgoyal View Post
If you want to change the way calibre reads metadata from files, you have to create a metadata reader plugin. Its in the documentation.
My bad. I didn't delve into the Metadata section of your documentation.

I do appreciate your patience with all this!
junkml is offline   Reply With Quote
Advert
Old 01-03-2009, 11:21 PM   #6
junkml
Addict
junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.
 
junkml's Avatar
 
Posts: 277
Karma: 1004969
Join Date: Mar 2007
Device: Sony Reader
Ok. I have to admit that I'm stumped again.

I've got a metadata reader that shows up and appears to run when adding a file to calibre, but it isn't picking up the metadata from the file (a non-drm lit file).

I'm afraid I need to ask for some pointers again.
Attached Files
File Type: zip LitMeta_plugin.zip (488 Bytes, 1124 views)
junkml is offline   Reply With Quote
Old 01-04-2009, 12:25 AM   #7
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: 44,509
Karma: 24495778
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
This plugin is identical to the built in lit metadata plugin. If that is failing to pick up metadata, this will too.
kovidgoyal is offline   Reply With Quote
Old 01-04-2009, 09:59 AM   #8
junkml
Addict
junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.
 
junkml's Avatar
 
Posts: 277
Karma: 1004969
Join Date: Mar 2007
Device: Sony Reader
Quote:
Originally Posted by kovidgoyal View Post
This plugin is identical to the built in lit metadata plugin. If that is failing to pick up metadata, this will too.
The problem is, the built in lit plugin will get the metadata from my file, but if I disable it, and add this one, nothing happens. There's no error when adding at the command line, but no metadata come through.

I deliberately started with the same setup as your current lit metadata code. I figured once I can get that running as my own plugin, then I can work on customizing it. My first step was just to make sure I could get the plugin running at all.

Last edited by junkml; 01-04-2009 at 10:07 AM.
junkml is offline   Reply With Quote
Old 01-04-2009, 01:49 PM   #9
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: 44,509
Karma: 24495778
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Ah ok, now I understand. I'm somewhat swamped in work at the moment. Could you opena aticket and attach your plugin and I'll get around to figuring out why it doesn't work in the next couple of days.
kovidgoyal is offline   Reply With Quote
Old 01-04-2009, 02:27 PM   #10
junkml
Addict
junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.
 
junkml's Avatar
 
Posts: 277
Karma: 1004969
Join Date: Mar 2007
Device: Sony Reader
Quote:
Originally Posted by kovidgoyal View Post
Ah ok, now I understand. I'm somewhat swamped in work at the moment. Could you opena aticket and attach your plugin and I'll get around to figuring out why it doesn't work in the next couple of days.
No problem. I figured it was something simple I was missing. I'll open a ticket in a little while.

Thanks again!
junkml is offline   Reply With Quote
Old 01-05-2009, 08:45 PM   #11
junkml
Addict
junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.
 
junkml's Avatar
 
Posts: 277
Karma: 1004969
Join Date: Mar 2007
Device: Sony Reader
Kovid, noticed that version 4.126 is out, and says the status for the ticket on the metadata plugin is closed.

Is there something else that has to be changed with the .py file attached to the ticket, in order for it to work?

I use that script, but there is still nothing coming in for the metadata, even though the built-in plugin for .lit metadata works.

Sorry to keep pestering you, but this is the last little piece I need to get working.

Thanks.
junkml is offline   Reply With Quote
Old 01-05-2009, 09:06 PM   #12
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: 44,509
Karma: 24495778
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Yeah the problem should have been fixed in 126. At least your plugin was working for me. Try insering a print statement at the start of the run method and see if you get any output when running calibredb add
kovidgoyal is offline   Reply With Quote
Old 01-05-2009, 10:08 PM   #13
junkml
Addict
junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.
 
junkml's Avatar
 
Posts: 277
Karma: 1004969
Join Date: Mar 2007
Device: Sony Reader
Quote:
Originally Posted by kovidgoyal View Post
Yeah the problem should have been fixed in 126. At least your plugin was working for me. Try insering a print statement at the start of the run method and see if you get any output when running calibredb add
put a print statement before the "return" statement, and it showed up when running on the command line, but still no metadata.

I did a print on ftype, stream, and get_metadata(stream, ftype), and this is what it output:

C:\Users\Owner\Documents\My Library>calibredb add "c:\users\owner\documents\my library\open.lit"

Loading plugin from C:\Users\Owner\AppData\Roaming\calibre\plugins\New LIT metadata.zip

lit

<open file u'c:\\users\\owner\\documents\\my library\\open.lit', mode 'rb' at 0x03622480>

<open file u'c:\\users\\owner\\documents\\my library\\open.lit', mode 'r+b' at 0x03622CA0>


If I enable the built-in lit metadata reader, it still brings in the metadata.
junkml is offline   Reply With Quote
Old 01-05-2009, 10:18 PM   #14
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: 44,509
Karma: 24495778
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Add a

print mi

where mi is the result of the get_metadata call
kovidgoyal is offline   Reply With Quote
Old 01-05-2009, 10:44 PM   #15
junkml
Addict
junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.junkml ought to be getting tired of karma fortunes by now.
 
junkml's Avatar
 
Posts: 277
Karma: 1004969
Join Date: Mar 2007
Device: Sony Reader
Quote:
Originally Posted by kovidgoyal View Post
Add a

print mi

where mi is the result of the get_metadata call
Interesting. There is absolutely nothing. The print statement after "print mi" shows up, but there is nothing for "print mi". No error, nothing.

edit: I take that back. Looking at the output again, the print statement BEFORE "print mi" shows up, but then nothing. So the print statement after "print mi" never happened. But, there was no error showing at the command line.

Last edited by junkml; 01-05-2009 at 10:53 PM.
junkml 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 01:32 AM
DRM plugins jjansen Plugins 9 12-01-2012 07:22 PM
Metadata download plugins newbino Plugins 3 08-01-2010 12:25 AM
Download Plugins turdette Plugins 1 01-07-2010 07:25 PM
Plugins? Mitchll Plugins 0 12-27-2008 03:36 PM


All times are GMT -4. The time now is 03:35 PM.


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