View Single Post
Old 10-03-2013, 04:22 AM   #3
hakan42
Zealot
hakan42 is on a distinguished road
 
hakan42's Avatar
 
Posts: 136
Karma: 60
Join Date: Jul 2009
Location: Munich, Germany
Device: Nook Classic rooted; Galaxy S IV with Aldiko, other older devices
Quote:
Originally Posted by kovidgoyal View Post
Those functions still exist, though note that it is get_metadata.

Code:
calibre-debug -c "from calibre.library import db; db = db(); print db.series, db.get_metadata"                                                                                                      
<bound method LibraryDatabase.func of <calibre.db.legacy.LibraryDatabase object at 0x7f856b61fc10>> <bound method LibraryDatabase.get_metadata of <calibre.db.legacy.LibraryDatabase object at 0x7f856b61fc10>>
Hmmmm.... My code lives in db/backend.py, specifically in the method construct_path_name().

Code:
print("db/backend.py: self: '%s'" % (self))
print("db/backend.py: metadata: '%s'" % (self.get_metadata))
gives

Code:
db/backend.py: self: '<calibre.db.backend.DB object at 0x056FD350>'
...
  File "H:\src\calibre\calibre-github\src\calibre\db\backend.py", line 1099, in construct_path_name
AttributeError: 'DB' object has no attribute 'get_metadata'
Am I still allowed to "from calibre.library import db;" in construct_path_name() or would I somehow break caching?
hakan42 is offline   Reply With Quote