@endpoint(u'/interface-data/book-metadata/{book_id=0}', postprocess=json)
def book_metadata(ctx, rd, book_id):
 (library_id, db) = get_basic_query_data(ctx, rd)[:2]
 book_ids = ctx.allowed_book_ids(rd, db)
 def notfound():
  raise HTTPNotFound((_(u'No book with id: %d in library') % book_id))
 if (not book_ids):
  notfound()
 if (not book_id):
  book_id = random.choice(tuple(book_ids))
 elif (book_id not in book_ids):
  notfound()
 data = book_as_json(db, book_id)
 if (data is None):
  notfound()
 data[u'id'] = book_id
 return data

@ endpoint ( u'/interface-data/book-metadata/{book_id=0}' , postprocess = json ) def book_metadata ( ctx , rd , book_id ) : ( library_id , db ) = get_basic_query_data ( ctx , rd ) [ : 2 ] book_ids = ctx . allowed_book_ids ( rd , db ) def notfound ( ) : raise HTTPNotFound ( ( _ ( u'No book with id: %d in library' ) % book_id ) ) if ( not book_ids ) : notfound ( ) if ( not book_id ) : book_id = random . choice ( tuple ( book_ids ) ) elif ( book_id not in book_ids ) : notfound ( ) data = book_as_json ( db , book_id ) if ( data is None ) : notfound ( ) data [ u'id' ] = book_id return data
get metadata for the specified book .