Use Calibre's "ebook-meta" command line tool to get ebook metadata.