Add options to lrf-meta to set creator, producer, publisher, classification. Remove --page option as it was useless.

This commit is contained in:
Kovid Goyal 2008-12-31 12:09:29 -08:00
parent c25e6e6cbb
commit 8fe381e502

View File

@ -603,12 +603,18 @@ Show/edit the metadata in an LRF file.\n\n'''),
parser.add_option("--get-thumbnail", action="store_true", \ parser.add_option("--get-thumbnail", action="store_true", \
dest="get_thumbnail", default=False, \ dest="get_thumbnail", default=False, \
help=_("Extract thumbnail from LRF file")) help=_("Extract thumbnail from LRF file"))
parser.add_option('--publisher', default=None, help=_('Set the publisher'))
parser.add_option('--classification', default=None, help=_('Set the book classification'))
parser.add_option('--creator', default=None, help=_('Set the book creator'))
parser.add_option('--producer', default=None, help=_('Set the book producer'))
parser.add_option('--get-cover', action='store_true', default=False, parser.add_option('--get-cover', action='store_true', default=False,
help=_('Extract cover from LRF file. Note that the LRF format has no defined cover, so we use some heuristics to guess the cover.')) help=_('Extract cover from LRF file. Note that the LRF format has no defined cover, so we use some heuristics to guess the cover.'))
parser.add_option('--bookid', action='store', type='string', default=None, parser.add_option('--bookid', action='store', type='string', default=None,
dest='book_id', help=_('Set book ID')) dest='book_id', help=_('Set book ID'))
parser.add_option("-p", "--page", action="store", type="string", \ # The SumPage element specifies the number of "View"s (visible pages for the BookSetting element conditions) of the content.
dest="page", help=_("Don't know what this is for")) # Basically, the total pages per the page size, font size, etc. when the LRF is first created. Since this will change as the book is reflowed, it is probably not worth using.
#parser.add_option("-p", "--page", action="store", type="string", \
# dest="page", help=_("Don't know what this is for"))
return parser return parser
@ -624,6 +630,8 @@ def set_metadata(stream, mi):
lrf.free_text = mi.comments lrf.free_text = mi.comments
if mi.author_sort: if mi.author_sort:
lrf.author_reading = mi.author_sort lrf.author_reading = mi.author_sort
if mi.publisher:
lrf.publisher = mi.publisher
def main(args=sys.argv): def main(args=sys.argv):
@ -644,10 +652,16 @@ def main(args=sys.argv):
lrf.author_reading = options.author_reading lrf.author_reading = options.author_reading
if options.author: if options.author:
lrf.author = options.author lrf.author = options.author
if options.publisher:
lrf.publisher = options.publisher
if options.classification:
lrf.classification = options.classification
if options.category: if options.category:
lrf.category = options.category lrf.category = options.category
if options.page: if options.creator:
lrf.page = options.page lrf.creator = options.creator
if options.producer:
lrf.producer = options.producer
if options.thumbnail: if options.thumbnail:
path = os.path.expanduser(os.path.expandvars(options.thumbnail)) path = os.path.expanduser(os.path.expandvars(options.thumbnail))
f = open(path, "rb") f = open(path, "rb")