def upgrade_metadata(root): data = Data() data.prefixes = read_prefixes(root) data.refines = read_refines(root) upgrade_identifiers(root, data) upgrade_title(root, data) upgrade_languages(root, data) upgrade_authors(root, data) upgrade_timestamp(root, data) upgrade_date(root, data) upgrade_rating(root, data) upgrade_series(root, data) upgrade_custom(root, data) upgrade_meta(root, data) upgrade_cover(root, data) remove_invalid_attrs_in_dc_metadata(root, data) set_last_modified(root, data.prefixes, data.refines) pretty_print_opf(root)