def save_to_disk(db, ids, root, opts=None, callback=None):
 (root, opts, length) = sanitize_args(root, opts)
 failures = []
 for x in ids:
  tb = ''
  try:
   (failed, id, title) = save_book_to_disk(x, db, root, opts, length)
   tb = _('Requested formats not available')
  except:
   (failed, id, title) = (True, x, db.title(x, index_is_id=True))
   tb = traceback.format_exc()
  if failed:
   failures.append((id, title, tb))
  if callable(callback):
   if (not callback(int(id), title, failed, tb)):
    break
 return failures

def save_to_disk ( db , ids , root , opts = None , callback = None ) : ( root , opts , length ) = sanitize_args ( root , opts ) failures = [ ] for x in ids : tb = '' try : ( failed , id , title ) = save_book_to_disk ( x , db , root , opts , length ) tb = _ ( 'Requested formats not available' ) except : ( failed , id , title ) = ( True , x , db . title ( x , index_is_id = True ) ) tb = traceback . format_exc ( ) if failed : failures . append ( ( id , title , tb ) ) if callable ( callback ) : if ( not callback ( int ( id ) , title , failed , tb ) ) : break return failures
save books from the database db to the path specified by root .