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:
object
Represents a single
mets:file/mets:FLocat
(METS file entry).- Parameters:
el (LxmlElement) – etree Element of the
mets:file
this represents. Create new if not provided- Keyword Arguments:
mets (OcrdMets) – Containing
ocrd_models.ocrd_mets.OcrdMets
.mimetype (string) –
@MIMETYPE
of thismets:file
pageId (string) –
@ID
of the physicalmets:structMap
entry corresponding to thismets:file
url (string) – original
@xlink:href
of thismets:file
local_filename (string) –
@xlink:href
pointing to the locally cached version of the file in the workspaceID (string) –
@ID
of thismets:file
loctype (string) – DEPRECATED do not use
- property basename: str¶
Get the
.name
of the local file
- property extension: str¶
- property basename_without_extension: str¶
Get the
os.path.basename
of the local file, if any, with extension removed.
- property ID: str¶
Get the
@ID
of themets:file
.
- property pageId: str¶
Get the
@ID
of the physicalmets:structMap
entry corresponding to thismets:file
(physical page manifestation).
- property loctypes: List[str]¶
Get the
@LOCTYPE``s of the ``mets:file
.
- property mimetype: str¶
Get the
@MIMETYPE
of themets:file
.
- property fileGrp: str¶
The
@USE
of the containingmets:fileGrp
- property url: str¶
Get the remote/original URL
@xlink:href
of thismets:file
.
- property local_filename: str | None¶
Get the local/cached
@xlink:href
of 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:
object
Provides the same interface as
ocrd_models.ocrd_file.OcrdFile
but without attachment toocrd_models.ocrd_mets.OcrdMets
since this represents the response of theocrd.mets_server.OcrdMetsServer
.- Parameters:
() (el) – ignored
- Keyword Arguments:
() (local_filename) – ignored
mimetype (string) –
@MIMETYPE
of thismets:file
pageId (string) –
@ID
of the physicalmets:structMap
entry corresponding to thismets:file
loctype (string) –
@LOCTYPE
of thismets:file
url (string) – ignored XXX the remote/original file once we have proper mets:FLocat bookkeeping
() –
@xlink:href
of thismets:file
- XXX the local file once we have proper mets:FLocat bookkeepingID (string) –
@ID
of thismets:file