File Interface
- class korus.database.interface.file.FileInterface(backend: TableBackend, storage: StorageInterface)[source]
Bases:
TableInterfaceDefines the interface of the File Table.
- add(row: dict)[source]
Add an entry to the table.
- Args:
- row: dict
Input data in the form of a dict, where the keys are the field names and the values are the values to be added to the database.
- get_absolute_path(indices: int | list[int]) list[str][source]
Get the absolute paths to the audio files.
- Args:
- indices: int | list[int]
The indices of the entries to be returned. If None, all entries in the table are returned.
- Returns:
- : list[str]
Absolute file paths.
- get_duration(indices: int | list[int]) list[float][source]
Get file duration.
- Args:
- indices: int | list[int]
The indices of the entries to be returned. If None, all entries in the table are returned.
- Returns:
- : list[float]
File duration(s) in seconds.
- get_id(deployment_id: int | list[int], filename: str | list[str]) list[int][source]
Given the deployment ID and the file names, get the file IDs
- Args:
- deployment_id: int | list[int]
Deployment ID
- filename: str | list[str]
File name(s)
- Returns:
- indices: list[int]
File IDs. If a filename is not found in the database, its ID is set to None.