Tepl.MetadataManager¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class Tepl.MetadataManager(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
- classmethod get_singleton()¶
- Returns:
the
Tepl.MetadataManager
singleton instance.- Return type:
New in version 5.0.
- copy_from(for_location, to_metadata)¶
- Parameters:
to_metadata (
Tepl.Metadata
) – aTepl.Metadata
.
Copies the metadata stored in self for for_location into to_metadata.
If to_metadata already contains a key that is also present in self, the value in to_metadata is overwritten.
If to_metadata already contains a key that is not present in self, the key/value pair is kept in to_metadata, it is not erased.
New in version 5.0.
- load_from_disk(from_file)¶
- Parameters:
- Raises:
- Returns:
whether the operation was successful.
- Return type:
Loads synchronously all the metadata from from_file into self.
A good moment to call this function is on application startup, see the
Gio.Application
::startup
signal.New in version 5.0.
- merge_into(for_location, from_metadata)¶
- Parameters:
from_metadata (
Tepl.Metadata
) – aTepl.Metadata
.
Merges the metadata from from_metadata into self for for_location.
If a key from from_metadata has been set to
None
, the key/value pair is removed from self. In other words that key/value pair will not be saved at all when callingTepl.MetadataManager.save_to_disk
().If self already contains a key that is not present in from_metadata, the key/value pair is kept in self, it is not erased.
New in version 5.0.
- save_to_disk(to_file, trim)¶
- Parameters:
trim (
bool
) – ifTrue
,Tepl.MetadataManager.trim
() is called with -1.
- Raises:
- Returns:
whether the operation was successful.
- Return type:
Saves synchronously all the metadata from self to to_file. The parent directories of to_file are created if needed.
A good moment to call this function is on application shutdown, see the
Gio.Application
::shutdown
signal.New in version 5.0.
- trim(max_number_of_locations)¶
- Parameters:
max_number_of_locations (
int
) – the maximum size, or -1 for the default value.
The purpose of having a maximum size is to avoid that the file on disk grows indefinitely.
max_number_of_locations is the maximum number of
Gio.File
locations for which metadata are kept. This function discards the least recently accessed metadata if needed.If max_number_of_locations is -1, a default internal value is used that should fit most applications’ needs.
New in version 5.0.