Tool fuer Metadaten OO.org-Dateien

21/04/2011 - 13:38 von Ralph Mueller | Report spam
Gibt es, àhnlich wie "pdfinfo" für PDF-Dateien, für mit
OpenOffice.org erstellte Dateien ein command line tool,
das mir deren Metadaten anzeigt?

TIA
 

Lesen sie die antworten

#1 Thomas PointedEars Lahn
21/04/2011 - 17:17 | Warnen spam
Ralph Mueller wrote:

Gibt es, àhnlich wie "pdfinfo" für PDF-Dateien, für mit
OpenOffice.org erstellte Dateien ein command line tool,
das mir deren Metadaten anzeigt?



$ cat > odfinfo
#!/usr/bin/python

# odfinfo 0.1 -- Retrieves meta information of Open Document Format files
#
# Copyright (c) 2011 Thomas Lahn
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from sys import argv
from zipfile import ZipFile
from xml.dom.minidom import parseString

tmpdir = '/tmp'
metafile = 'meta.xml'

oofile = ZipFile(argv[1], 'r')
oofile.extract(metafile, tmpdir)
meta = open("%s/%s" % (tmpdir, metafile), 'r')
metadata = meta.read()
meta.close()

doc = parseString(metadata)

for node in doc.firstChild.childNodes[0].childNodes:
print "%s: %s" % (
node.tagName,
node.firstChild.nodeValue if node.firstChild else '')

if node.attributes.length > 0:
print "".join(
["%s: %s" % (k, v.nodeValue)
for k, v in dict(node.attributes).items()])

^D

$ chmod +x odfinfo

$ ./odfinfo Paper.odt
meta:creation-date: 2011-04-02T00:18:16
dc:date: 2011-04-02T16:25:10
meta:editing-duration: PT3H14S
meta:editing-cycles: 121
meta:generator: LibreOffice/3.3$Linux LibreOffice_project/330m19$Build-202
meta:document-statistic:
meta:word-count: 647
meta:image-count: 0
meta:object-count: 0
meta:page-count: 3
meta:character-count: 5067
meta:paragraph-count: 48
meta:table-count: 0


Jetzt gibt es mindestens eins :)

HTH
PointedEars

Ähnliche fragen