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 03-06-2011, 03:23 PM   #61
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,843
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
This is what I get:

Code:
calibre-debug -c "from calibre.ebooks.metadata.sources.base import Source; s = Source(None); print list(s.get_author_tokens(['J. R. R. Tolkien']))"

['Tolkien']
Don't worry about the None it's meaningless (see customize.__init__ for the None)
kovidgoyal is online now   Reply With Quote
Old 03-06-2011, 03:33 PM   #62
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
Weird - alright - I'll play around with it some more and see where mine is going wrong.

Found the problem - User error - which was what I was starting to suspect when the print statements weren't working. Development environment variable was screwed up in the CLI instance I was debugging from.

Last edited by ldolse; 03-06-2011 at 03:45 PM.
ldolse is offline   Reply With Quote
Advert
Old 03-21-2011, 05:20 AM   #63
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
Just got back into developing this plugin. I've got the plugin working pretty well for social metadata/cover download, but I'd like to move it to the discovery phase as discussed previously, as right now the has_cover lookup (pretty sure it's this function) bombards Overdrive with potentially dozens of simultaneous requests for book title variations and ISBNs - since this is done simultaneously it's done too late to cache the results properly and avoid abusing the server.

I've got the plugin using the new set_identifier function to set the id for Overdrive in the identifiers table, but right now that's not something that's available for use in fetch.py or covers.py, both still rely on calling ISBN the old fashioned way, and it wasn't readily apparent to me how to change either of those to check for the existence of some other type of identifier.

I know a lot of this stuff using identifiers isn't quite ready for prime-time use and is tied to the larger metadata enhancements targeted for a later release. Is there something simple that can be done with the current code easily, or is this something I should wait for a while longer?

Ideally I'd like the logic to be something like this:
  1. Check Overdrive during the discovery phase with the configured Title/Author (overdrive Identifier is optional if found in the metadata)
  2. Populate the basic metadata available from this initial lookup (currently Title/Subtitle, Authors, Series/Series Index, Publisher, Cover URL, social metadata URL, Overdrive Identifier) - some of this would just go into a cache based on Overdrive Identifier (vs. ISBN which is used today).
  3. Get the Cover URL from the cache if Overdrive is configured for covers.
  4. Get Social Metadata from the url in the cache if configured for Social Metadata (tags, description, pub date, ebook ISBN, language)
ldolse is offline   Reply With Quote
Old 03-21-2011, 11:50 AM   #64
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,843
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
This is exactly how the new plugins work. I've completed the google and amazon plugins with caches for cover url and isbn to identifier mappings, have a look.

There isn't really a way to accomplish this cleanly in the current framework
kovidgoyal is online now   Reply With Quote
Old 03-21-2011, 12:25 PM   #65
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
I saw that you've been doing a lot of work on those plugins lately, but they're still not used by default, correct? It looked to me like prep work for a later switchover to the new framework. I don't mind waiting longer, just checking.
ldolse is offline   Reply With Quote
Advert
Old 03-21-2011, 12:27 PM   #66
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,843
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
No they aren't used yet.
kovidgoyal is online now   Reply With Quote
Old 03-21-2011, 12:33 PM   #67
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
Cool, I'll mimic the logic in those plugins a little more closely and check it in with the new sources. I've been tweaking the author/title token functions as well.
ldolse is offline   Reply With Quote
Old 04-16-2011, 07:09 AM   #68
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
Getting around to porting this now that the new framework is usable enough for general testing.

Does the new framework differentiate between 'identify' and social metadata? Just asking because thus far all the plugins list only 'identify' and/or 'cover' in the capabilities.

capabilities = frozenset(['identify', 'cover'])

The way Overdrive works there are three ways to get data:
'identify' - Search overdrive and get a list object back with various metadata.
'cover' - comes from the same search as above, but use a separate function to populate the cover url cache from those results.
'social metadata' - Or whatever it's equivalent might be considered in the new framework - go to the actual book page and scrape for further details not included in the identify results.

I would think that for many metadata providers this might be the way things work, even if it requires scraping - fuzzy search returns a list of results which already contain some metadata, full metadata by going to the book identifier's actual page.

Scraping the book details page is actually the slowest in the case of Overdrive, so I was thinking to make it optional and disabled by default. Not sure if the listed capabilities is the way this will be managed or if I should configure similar to .7.x metadata plugins.


The other way to do it, based on reviewing the new GUI, is to default disable the specific fields that require the book record to be loaded. This looks like the 'touched_fields' configuration in the plugin, but that only adds them to the list - will it be possible to default disable them?

Last edited by ldolse; 04-16-2011 at 07:11 AM.
ldolse is offline   Reply With Quote
Old 04-16-2011, 08:51 AM   #69
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,843
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
There's no social metadata anymore. The identify method should return all fields the source knows about. You can default disable fields by overriding the __init__ method in your plugin like this

Code:
def __init__(self, *args, **kwargs):
   SourcePlugin.__init__(self, *args, **kwargs)
   self.prefs.defaults['ignore_fields'] =[list of fields from touched_fields]
Though I would suggest using threading to make the detailed queries, see the Amazon plugin for an example.
kovidgoyal is online now   Reply With Quote
Old 04-18-2011, 09:56 AM   #70
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
Quote:
Originally Posted by kovidgoyal View Post
There's no social metadata anymore. The identify method should return all fields the source knows about. You can default disable fields by overriding the __init__ method in your plugin like this

Code:
def __init__(self, *args, **kwargs):
   SourcePlugin.__init__(self, *args, **kwargs)
   self.prefs.defaults['ignore_fields'] =[list of fields from touched_fields]
global name 'SourcePlugin' is not defined... Not sure where it's supposed to be defined, but I'm pretty sure you meant for me to use that specific string.

Is the list of field's the user is actually requesting available for testing inside of identify?
ldolse is offline   Reply With Quote
Old 04-18-2011, 10:17 AM   #71
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,636
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
I think that was meant to be "Source" not "SourcePlugin" - as this __init__ method would be on your own plugin inheriting from Source.
kiwidude is online now   Reply With Quote
Old 04-18-2011, 11:00 AM   #72
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
Cool, 'Source' worked. The relevant fields are disabled by default now. Not sure if I have the ability to test whether they're enabled/disabled at the time the plugin is called though, which might make the exercise moot.

Last edited by ldolse; 04-18-2011 at 11:02 AM.
ldolse is offline   Reply With Quote
Old 04-26-2011, 12:39 PM   #73
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,896
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Overdrive uses the wrong aspect ratio for covers. So using Overdrive for covers is a bad idea. They use 510x680 which is too wide.
JSWolf is offline   Reply With Quote
Old 04-26-2011, 01:31 PM   #74
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
I think we've been over this - Cover download is configurable, you can configure Calibre to not use Overdrive, or to make the Overdrive cover download the lowest priority.

I personally have no problem with the aspect ratio, and I suspect the majority of users probably feel similarly. 510 x 680 is often the highest resolution out there for a lot of covers. If I scale that up linearly it's 600 x 770 pixels on an actual screen 800x600 screen, not sure I'm that fussed about 15 pixels of empty space on the top and bottom for users who force the existing aspect ratio, I'd much rather have the increased resolution.

On top of this Calibre's default settings for epub don't use the cover's actual aspect ratio - instead it sticks it in an SVG which will force it to fill the reader's screen. I realize you don't use this default setting, but the majority of Calibre users do, since the majority of them don't know how to change it.

On a side note, I don't see any issue whatsoever around aspect ratio for the thumbnails Calibre uploads to my Sony, so it may be fixing the aspect ratio using it's image libraries on the fly for many scenarios, someone else may be able to provide more detail on that.
ldolse is offline   Reply With Quote
Old 04-26-2011, 02:52 PM   #75
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,733
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ldolse View Post
On a side note, I don't see any issue whatsoever around aspect ratio for the thumbnails Calibre uploads to my Sony, so it may be fixing the aspect ratio using it's image libraries on the fly for many scenarios, someone else may be able to provide more detail on that.
The sony driver has an option to either preserve the existing aspect ratio in a container 217 high, or to convert it to the sony 'standard' of 217x168. The option is default True: preserve aspect ratio.
chaley is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Covers Plugin] Goodreads Covers **Deprecated** kiwidude Plugins 13 04-17-2011 05:09 PM
Is all Overdrive the same? CWatkinsNash General Discussions 3 12-28-2010 04:01 PM
Covers, covers and damn statistics (wait, I got that wrong). Moejoe Writers' Corner 86 11-29-2010 08:34 PM
Stop Using Overdrive Fat Abe General Discussions 19 09-11-2010 08:30 PM
Overdrive Overseas Honch Which one should I buy? 3 12-08-2009 08:21 AM


All times are GMT -4. The time now is 09:21 AM.


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