Ejemplo n.º 1
0
def db_readmeta():
	metadata = Metadata()
	db = Db()
	calibreid = db.get_id(metadata.id)

	if calibreid is None:
		return 1, 'Book not found in Calibre: %s' % options.dir

	c = Calibre()
	c.write_metadata_file(calibreid, metadata.xmlfilename)

	return 0, 'Finished reading metadata from Calibre for %s.' % options.dir
Ejemplo n.º 2
0
def db_meta_pull():
	metadata = Metadata()
	db = Db()
	calibreid = db.get_id(metadata.id)

	if calibreid is None:
		return 1, 'Book not found in Calibre: %s' % options.dir

	# save metadata from Calibre to metadata.opf
	c = Calibre()
	c.write_metadata_file(calibreid, metadata.xmlfilename)

	# reload metadata from metadata.opf
	metadata = Metadata()
	metadata.write_to_book()

	# push book file with new metadata to Calibre
	c.update_content(calibreid, metadata.bookfile)

	return 0, "Finished updating content and metadata file from Calibre's metadata for %s." % options.dir