Exemple #1
0
class LZA:
    def __init__(self, filename, mimetype=""):
        self.item = None
        self.filename = filename

        if filename.lower().endswith(".pdf"):
            self.item = PDFDocument(filename)
        elif filename.lower().endswith(".tiff") or filename.lower().endswith(
                ".tif"):
            self.item = TIFFImage(filename)
        elif filename.lower().endswith(".jpg") or filename.lower().endswith(
                ".jpeg"):
            self.item = JPEGImage(filename)
        elif filename.lower().endswith(".lza"):
            if mimetype == "image/tiff":
                self.item = TIFFImage(filename)
            elif mimetype == "image/jpeg":
                self.item = JPEGImage(filename)
            elif mimetype == "application/pdf":
                self.item = PDFDocument(filename)
        else:
            raise FiletypeNotSupported()

    def buildLZAName(self):
        return self.filename[:self.filename.rfind(".")] + ".lza"

    def writeMediatumData(self, data, outputfile=""):
        if outputfile == "":
            outputfile = self.buildLZAName()
        self.item.writeMetaData(str(data), outputfile)

    def getMediatumData(self):
        meta = self.item.getMetaData()
        if meta.lzaData():
            return meta
        else:
            return ""

    def getOriginal(self, outputfile=""):
        self.item.getOriginal(outputfile)
Exemple #2
0
class LZA:

    def __init__(self, filename, mimetype=""):
        self.item = None
        self.filename = filename

        if filename.lower().endswith(".pdf"):
            self.item = PDFDocument(filename)
        elif filename.lower().endswith(".tiff") or filename.lower().endswith(".tif"):
            self.item = TIFFImage(filename)
        elif filename.lower().endswith(".jpg") or filename.lower().endswith(".jpeg"):
            self.item = JPEGImage(filename)
        elif filename.lower().endswith(".lza"):
            if mimetype == "image/tiff":
                self.item = TIFFImage(filename)
            elif mimetype == "image/jpeg":
                self.item = JPEGImage(filename)
            elif mimetype == "application/pdf":
                self.item = PDFDocument(filename)
        else:
            raise FiletypeNotSupported()

    def buildLZAName(self):
        return self.filename[:self.filename.rfind(".")] + ".lza"

    def writeMediatumData(self, data, outputfile=""):
        if outputfile == "":
            outputfile = self.buildLZAName()
        self.item.writeMetaData(str(data), outputfile)

    def getMediatumData(self):
        meta = self.item.getMetaData()
        if meta.lzaData():
            return meta
        else:
            return ""

    def getOriginal(self, outputfile=""):
        self.item.getOriginal(outputfile)
Exemple #3
0
    def __init__(self, filename, mimetype=""):
        self.item = None
        self.filename = filename

        if filename.lower().endswith(".pdf"):
            self.item = PDFDocument(filename)
        elif filename.lower().endswith(".tiff") or filename.lower().endswith(
                ".tif"):
            self.item = TIFFImage(filename)
        elif filename.lower().endswith(".jpg") or filename.lower().endswith(
                ".jpeg"):
            self.item = JPEGImage(filename)
        elif filename.lower().endswith(".lza"):
            if mimetype == "image/tiff":
                self.item = TIFFImage(filename)
            elif mimetype == "image/jpeg":
                self.item = JPEGImage(filename)
            elif mimetype == "application/pdf":
                self.item = PDFDocument(filename)
        else:
            raise FiletypeNotSupported()
Exemple #4
0
    def __init__(self, filename, mimetype=""):
        self.item = None
        self.filename = filename

        if filename.lower().endswith(".pdf"):
            self.item = PDFDocument(filename)
        elif filename.lower().endswith(".tiff") or filename.lower().endswith(".tif"):
            self.item = TIFFImage(filename)
        elif filename.lower().endswith(".jpg") or filename.lower().endswith(".jpeg"):
            self.item = JPEGImage(filename)
        elif filename.lower().endswith(".lza"):
            if mimetype == "image/tiff":
                self.item = TIFFImage(filename)
            elif mimetype == "image/jpeg":
                self.item = JPEGImage(filename)
            elif mimetype == "application/pdf":
                self.item = PDFDocument(filename)
        else:
            raise FiletypeNotSupported()