ocrd_models.ocrd_file module¶
API to mets:file
- class ocrd_models.ocrd_file.OcrdFile(el, mimetype=None, pageId=None, local_filename=None, mets=None, url=None, ID=None, loctype=None)[source]¶
 Bases:
objectRepresents a single
mets:file/mets:FLocat(METS file entry).- Parameters:
 el (LxmlElement) – etree Element of the
mets:filethis represents. Create new if not provided- Keyword Arguments:
 mets (OcrdMets) – Containing
ocrd_models.ocrd_mets.OcrdMets.mimetype (string) –
@MIMETYPEof thismets:filepageId (string) –
@IDof the physicalmets:structMapentry corresponding to thismets:fileurl (string) – original
@xlink:hrefof thismets:filelocal_filename (string) –
@xlink:hrefpointing to the locally cached version of the file in the workspaceID (string) –
@IDof thismets:fileloctype (string) – DEPRECATED do not use
- property basename: str¶
 Get the
.nameof the local file
- property extension: str¶
 
- property basename_without_extension: str¶
 Get the
os.path.basenameof the local file, if any, with extension removed.
- property ID: str¶
 Get the
@IDof themets:file.
- property pageId: str¶
 Get the
@IDof the physicalmets:structMapentry corresponding to thismets:file(physical page manifestation).
- property loctypes: List[str]¶
 Get the
@LOCTYPE``s of the ``mets:file.
- property mimetype: str¶
 Get the
@MIMETYPEof themets:file.
- property fileGrp: str¶
 The
@USEof the containingmets:fileGrp
- property url: str¶
 Get the remote/original URL
@xlink:hrefof thismets:file.
- property local_filename: str | None¶
 Get the local/cached
@xlink:hrefof thismets:file.
- class ocrd_models.ocrd_file.ClientSideOcrdFile(el, mimetype: str = '', pageId: str = '', loctype: str = 'OTHER', local_filename: str | None = None, mets: Any | None = None, url: str = '', ID: str = '', fileGrp: str = '')[source]¶
 Bases:
objectProvides the same interface as
ocrd_models.ocrd_file.OcrdFilebut without attachment toocrd_models.ocrd_mets.OcrdMetssince this represents the response of theocrd.mets_server.OcrdMetsServer.- Parameters:
 () (el) – ignored
- Keyword Arguments:
 () (local_filename) – ignored
mimetype (string) –
@MIMETYPEof thismets:filepageId (string) –
@IDof the physicalmets:structMapentry corresponding to thismets:fileloctype (string) –
@LOCTYPEof thismets:fileurl (string) – ignored XXX the remote/original file once we have proper mets:FLocat bookkeeping
() –
@xlink:hrefof thismets:file- XXX the local file once we have proper mets:FLocat bookkeepingID (string) –
@IDof thismets:file