version 1.1, 2004/11/29 09:48:07
|
version 1.2, 2004/12/23 08:30:56
|
Line 3 import os.path
|
Line 3 import os.path
|
from types import * |
from types import * |
import xml.dom.minidom |
import xml.dom.minidom |
|
|
OSASObjectTypes=['OSAS_metaDataFile','OSAS_dir','OSAS_file','OSAS_imageFolder'] |
OSASObjectTypes=['OSAS_metaDataFile','OSAS_dir','OSAS_file','OSAS_imageFolder','OSAS_dir_archive','OSAS_file_archive'] |
OSASExcludedFiles=['TheVolumeSettingsFolder','TheFindByContentFolder'] |
OSASExcludedFiles=['TheVolumeSettingsFolder','TheFindByContentFolder'] |
|
|
|
|
def getText(nodelist): |
def getText(nodelist): |
"""gibt text aus nodelist""" |
"""gibt text aus nodelist""" |
rc = "" |
rc = "" |
Line 14 def getText(nodelist):
|
Line 15 def getText(nodelist):
|
rc = rc + node.data |
rc = rc + node.data |
return rc |
return rc |
|
|
def getMetaFile(path): |
def getMetaInfoFromXML(path,xmlInfo): |
"""get index.meta and translate it to HTML""" |
"""get index.meta and translate it to HTML""" |
html=[] |
html=[] |
if not os.path.exists(path+"/index.meta"): |
|
|
|
return "NO_METADATA" |
dom = xml.dom.minidom.parseString(xmlInfo) |
|
try: |
|
name=getText(dom.getElementsByTagName("name")[0].childNodes) |
|
except: |
|
name="NOT_DEFINED!!!" |
|
try: |
|
creator=getText(dom.getElementsByTagName("creator")[0].childNodes) |
|
except: |
|
creator="NOT_DEFINED!!!" |
|
|
|
try: |
|
creation_date=getText(dom.getElementsByTagName("archive-creation-date")[0].childNodes) |
|
except: |
|
creation_date="NOT_DEFINED!!!" |
|
|
|
try: |
|
description=getText(dom.getElementsByTagName("description")[0].childNodes) |
|
except: |
|
description="NOT_DEFINED!!!" |
|
|
|
try: |
|
type=getText(dom.getElementsByTagName("content-type")[0].childNodes) |
|
except: |
|
type="" |
|
if type=="scanned document": |
|
html="<h3>Document: "+name+"</h3>" |
|
elif type=="folder": |
|
html="<h3>Folder: "+name+"</h3>" |
|
else: |
|
html="<h3>Document: "+name+"</h3>" |
|
|
|
html=html+"<p><i>created by: "+creator+" at: "+creation_date+"</i></p>" |
|
html=html+"<h4>Description</h4><p>"+description+"</p>" |
|
try: |
|
bib = dom.getElementsByTagName("meta")[0].getElementsByTagName("bib")[0] |
|
if bib.attributes.has_key('type'): |
|
html=html+"<h4>Info ("+bib.attributes['type'].value+")</h4>" |
|
else: |
|
html=html+"<h4>Info</h4>" |
|
html=html+getBib(bib.childNodes) |
|
|
|
except: |
|
"""none""" |
|
|
|
# html=html.encode('utf-8','replace')+getBib(bib.childNodes).encode('utf-8','replace') |
|
|
|
return html.encode('utf-8') |
|
|
|
def getMetaFile(self,path): |
|
"""get index.meta and translate it to HTML""" |
|
html=[] |
|
if not os.path.exists(path+"/index.meta"): |
|
return self.getMetaInfoFromIndexMeta(path) |
|
#return "NO_METADATA" |
else: |
else: |
f = os.popen("cat "+path+"/index.meta","r") |
f = os.popen("cat "+path+"/index.meta","r") |
lines = f.read() |
lines = f.read() |