comparison documentViewer.py @ 562:60f5a636bc57

bugfixes for stability.
author casties
date Tue, 02 Oct 2012 15:22:11 +0200
parents 9255acc4518d
children 31f562fa7214
comparison
equal deleted inserted replaced
561:9255acc4518d 562:60f5a636bc57
556 elif mode=="imagepath": 556 elif mode=="imagepath":
557 # url points to folder with images, index.meta optional 557 # url points to folder with images, index.meta optional
558 # asssume index.meta in parent dir 558 # asssume index.meta in parent dir
559 docUrl = getParentPath(url) 559 docUrl = getParentPath(url)
560 metaDom = self.metadataService.getDomFromPathOrUrl(docUrl) 560 metaDom = self.metadataService.getDomFromPathOrUrl(docUrl)
561 docinfo['imagePath'] = url.replace('/mpiwg/online/', '', 1)
561 562
562 elif mode=="filepath": 563 elif mode=="filepath":
563 # url points to image file, index.meta optional 564 # url points to image file, index.meta optional
564 docinfo['imagePath'] = url
565 docinfo['imageURL'] = self.digilibBaseUrl + "/servlet/Scaler?fn=" + url 565 docinfo['imageURL'] = self.digilibBaseUrl + "/servlet/Scaler?fn=" + url
566 docinfo['numPages'] = 1 566 docinfo['numPages'] = 1
567 # asssume index.meta is two path segments up 567 # asssume index.meta is two path segments up
568 docUrl = getParentPath(url, 2) 568 docUrl = getParentPath(url, 2)
569 metaDom = self.metadataService.getDomFromPathOrUrl(docUrl) 569 metaDom = self.metadataService.getDomFromPathOrUrl(docUrl)
633 633
634 # check numPages 634 # check numPages
635 if docinfo.get('numPages', 0) == 0: 635 if docinfo.get('numPages', 0) == 0:
636 # number of images from digilib 636 # number of images from digilib
637 if docinfo.get('imagePath', None): 637 if docinfo.get('imagePath', None):
638 docinfo['imageURL'] = self.digilibBaseUrl + "/servlet/Scaler?fn=" + docinfo['imagePath'] 638 imgpath = docinfo['imagePath'].replace('/mpiwg/online/', '', 1)
639 docinfo = self.getDocinfoFromDigilib(docinfo, docinfo['imagePath']) 639 docinfo['imageURL'] = self.digilibBaseUrl + "/servlet/Scaler?fn=" + imgpath
640 docinfo = self.getDocinfoFromDigilib(docinfo, imgpath)
640 else: 641 else:
641 # imagePath still missing? try "./pageimg" 642 # imagePath still missing? try "./pageimg"
642 imgPath = os.path.join(docUrl, 'pageimg') 643 imgPath = os.path.join(docUrl, 'pageimg')
643 docinfo = self.getDocinfoFromDigilib(docinfo, imgPath) 644 docinfo = self.getDocinfoFromDigilib(docinfo, imgPath)
644 if docinfo.get('numPages', 0) > 0: 645 if docinfo.get('numPages', 0) > 0:
693 694
694 # image dir 695 # image dir
695 imageDir = getMDText(texttool.get('image', None)) 696 imageDir = getMDText(texttool.get('image', None))
696 docPath = getMDText(docinfo.get('documentPath', None)) 697 docPath = getMDText(docinfo.get('documentPath', None))
697 if imageDir and docPath: 698 if imageDir and docPath:
698 #print "image: ", imageDir, " archivepath: ", archivePath
699 imageDir = os.path.join(docPath, imageDir) 699 imageDir = os.path.join(docPath, imageDir)
700 imageDir = imageDir.replace('/mpiwg/online', '', 1) 700 imageDir = imageDir.replace('/mpiwg/online', '', 1)
701 docinfo['imagePath'] = imageDir 701 docinfo['imagePath'] = imageDir
702 702
703 # old style text URL 703 # old style text URL