Tepl.MetadataManager

g GObject.Object GObject.Object Tepl.MetadataManager Tepl.MetadataManager GObject.Object->Tepl.MetadataManager

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

get_singleton ()

copy_from (for_location, to_metadata)

load_from_disk (from_file)

merge_into (for_location, from_metadata)

save_to_disk (to_file, trim)

trim (max_number_of_locations)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

None

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class Tepl.MetadataManager(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Tepl.MetadataManagerClass

classmethod get_singleton()
Returns:

the Tepl.MetadataManager singleton instance.

Return type:

Tepl.MetadataManager

New in version 5.0.

copy_from(for_location, to_metadata)
Parameters:

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:

from_file (Gio.File) – the Gio.File to load metadata from.

Raises:

GLib.Error

Returns:

whether the operation was successful.

Return type:

bool

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:

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 calling Tepl.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:
Raises:

GLib.Error

Returns:

whether the operation was successful.

Return type:

bool

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.