(self, fmt, id, **kwargs)
Serves files, covers, thumbnails, metadata from the calibre database
Serves files, covers, thumbnails, metadata from the calibre database
Serves files covers thumbnails metadata from the calibre database
def get_data(self, fmt, id, **kwargs):
        "Serves files, covers, thumbnails, metadata from the calibre database"
        try:
            id = int(id)
        except ValueError:
            id = id.rpartition("_")[-1].partition(".")[0]
            match = re.search(r"\d+", id)
            if not match:
                raise web.HTTPError(404, "id:%s not an integer" % id)
            id = int(match.group())
        if not self.db.has_id(id):
            raise web.HTTPError(404, "id:%d does not exist in database" % id)
        if fmt == "thumb" or fmt.startswith("thumb_"):
            try:
                width, height = map(int, fmt.split("_")[1:])
            except:
                width, height = 60, 80
            return self.get_cover(
                id, thumbnail=True, thumb_width=width, thumb_height=height
            )
        if fmt == "cover":
            return self.get_cover(id)
        if fmt == "opf":
            return self.get_metadata_as_opf(id)
        raise web.HTTPError(404, "bad url")
def get_data ( self , fmt , id , * * kwargs ) : try : id = int ( id ) except ValueError : id = id . rpartition ( "_" ) [ - 1 ] . partition ( "." ) [ 0 ] match = re . search ( r"\d+" , id ) if not match : raise web . HTTPError ( 404 , "id:%s not an integer" % id ) id = int ( match . group ( ) ) if not self . db . has_id ( id ) : raise web . HTTPError ( 404 , "id:%d does not exist in database" % id ) if fmt == "thumb" or fmt . startswith ( "thumb_" ) : try : width , height = map ( int , fmt . split ( "_" ) [ 1 : ] ) except : width , height = 60 , 80 return self . get_cover ( id , thumbnail = True , thumb_width = width , thumb_height = height ) if fmt == "cover" : return self . get_cover ( id ) if fmt == "opf" : return self . get_metadata_as_opf ( id ) raise web . HTTPError ( 404 , "bad url" )