Functions¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- AppStreamCompose.build_component_global_id(component_id, checksum)¶
- Parameters:
- Raises:
- Returns:
The new global ID, or
Noneon error.- Return type:
Builds a global component ID from a component-id and a checksum (usually Blake3) generated from the component data.
The global-id is used as a global, unique identifier for a component. (while the component-ID is local, e.g. for one source). Its primary usecase is to identify a media directory on the filesystem which is associated with this component.
Since the result is used to construct filesystem paths, this function will refuse to build a global ID unless every segment it is made of - the pieces of the component-ID as well as checksum - is safe to use as a directory name. The error that is set in that case names the offending piece, and is meant to be shown to whoever wrote the metadata.
Added in version 0.13.0.
- AppStreamCompose.component_get_source_icon(cpt)¶
- Parameters:
cpt (
AppStream.Component) – anAppStream.Componentinstance.- Returns:
The source
AppStream.Icon, orNoneif the component has none.- Return type:
Find the unprocessed icon that a component was created with, that is the icon reference that came straight from its metainfo or desktop-entry file. A stock icon is preferred, but a local one is accepted as well to accommodate for applications that used the “local” icon type wrong.
This is the icon that appstream-compose renders its icon set from. If
AppStreamCompose.ComposeFlags.IGNORE_ICONSis set, it is left on the component untouched, so that the caller can run its own icon processing on it.Added in version 1.2.0.
- AppStreamCompose.compose_error_quark()¶
- Returns:
An error quark.
- Return type:
Added in version 0.13.0.
- AppStreamCompose.compute_content_checksum_for_data(data, length)¶
- Parameters:
- Returns:
The hash as hexadecimal string. Free with
GLib.free- Return type:
Compute a checksum for the given content.
The output of this function is intended to be used with
AppStreamCompose.build_component_global_idto form a unique global ID. The generated checksum is intended to be used as content-ID. Do not assume it is cryptographically secure or has a certain length!Added in version 1.1.3.
- AppStreamCompose.globals_add_hint_tag(tag, severity, explanation, override_existing)¶
- Parameters:
tag (
str) – the tag-ID to addseverity (
AppStream.IssueSeverity) – the tag severity asAppStream.IssueSeverityexplanation (
str) – the tag explanatory messageoverride_existing (
bool) – whether an existing tag should be replaced
- Returns:
Trueif the tag was registered and did not exist previously.- Return type:
Register a new hint tag. If a previous tag with the given name already existed, the existing tag will not be replaced unless override_existing is set to
True. Please be careful when overriding tags! Tag severities can not be lowered by overriding a tag.Added in version 0.14.0.
- AppStreamCompose.globals_fetch_hint_tags()¶
- Returns:
A list of valid hint tags. Free with
GLib.strfreev- Return type:
[
str]
Retrieve all hint tags that we know.
Added in version 0.14.0.
- AppStreamCompose.globals_get_ffprobe_binary()¶
- Returns:
The binary path, or
Noneif ffprobe was not found. The string is owned by the global state and is valid until the setting is changed, which is prohibited once composing metadata has started.- Return type:
Get path to the “ffprobe” binary we should use.
Added in version 0.14.6.
- AppStreamCompose.globals_get_optipng_binary()¶
- Returns:
The binary path, or
Noneif optipng was not found. The string is owned by the global state and is valid until the setting is changed, which is prohibited once composing metadata has started.- Return type:
Get path to the “optipng” binary we should use.
Added in version 0.13.0.
- AppStreamCompose.globals_get_tmp_dir()¶
- Returns:
The temporary directory. The string is owned by the global state and is valid until the setting is changed, which is prohibited once composing metadata has started.
- Return type:
Get temporary directory used by appstream-compose.
Added in version 0.13.0.
- AppStreamCompose.globals_get_use_optipng()¶
-
Get whether images should be optimized using optipng.
Added in version 0.13.0.
- AppStreamCompose.globals_hint_tag_exists(tag)¶
-
Check whether a hint tag with the given name is registered.
Added in version 1.2.0.
- AppStreamCompose.globals_hint_tag_explanation(tag)¶
- Parameters:
tag (
str)- Returns:
An explanation template, or
Noneif the tag was not found.- Return type:
Retrieve the explanation template of the given hint tag.
Added in version 0.14.0.
- AppStreamCompose.globals_hint_tag_severity(tag)¶
- Parameters:
tag (
str)- Returns:
An
AppStream.IssueSeverityorAppStream.IssueSeverity.UNKNOWNif the tag did not exist or has an unknown severity.- Return type:
Retrieve the severity of the given hint tag.
Added in version 0.14.0.
- AppStreamCompose.globals_set_ffprobe_binary(path)¶
-
Set path to the “ffprobe” binary we should use.
This has to be done before composing metadata starts. Once work has begun, changing any global setting is forbidden.
Added in version 0.14.6.
- AppStreamCompose.globals_set_optipng_binary(path)¶
-
Set path to the “optipng” binary we should use.
This has to be done before composing metadata starts. Once work has begun, changing any global setting is forbidden.
Added in version 0.13.0.
- AppStreamCompose.globals_set_tmp_dir(path)¶
- Parameters:
path (
str) – the new temporary directory.
Set temporary directory used by appstream-compose.
This has to be done before composing metadata starts. Once work has begun, changing any global setting is forbidden.
Added in version 0.13.0.
- AppStreamCompose.globals_set_use_optipng(enabled)¶
-
Set whether images should be optimized using optipng.
This has to be done before composing metadata starts. Once work has begun, changing any global setting is forbidden.
Added in version 0.13.0.
- AppStreamCompose.icon_state_from_string(state_str)¶
- Parameters:
state_str (
str) – the string.- Returns:
- Return type:
Converts the text representation to an enumerated value.
Added in version 1.0.2.
- AppStreamCompose.icon_state_to_string(istate)¶
- Parameters:
istate (
AppStreamCompose.IconState) – theAppStreamCompose.IconState.- Returns:
string version of istate
- Return type:
Converts the enumerated value to an text representation.
Added in version 1.0.2.
- AppStreamCompose.image_format_from_filename(fname)¶
- Parameters:
fname (
str) – the filename.- Returns:
a
AppStreamCompose.ImageFormatorAppStreamCompose.ImageFormat.UNKNOWNfor unknown- Return type:
Returns the image format type based on the given file’s filename.
Added in version 0.13.0.
- AppStreamCompose.image_format_from_string(str)¶
- Parameters:
str (
str) – the string.- Returns:
a
AppStreamCompose.ImageFormatorAppStreamCompose.ImageFormat.UNKNOWNfor unknown- Return type:
Converts the text representation to an enumerated value.
Added in version 0.13.0.
- AppStreamCompose.image_format_to_string(format)¶
- Parameters:
format (
AppStreamCompose.ImageFormat) – theAppStreamCompose.ImageFormat.- Returns:
string version of format
- Return type:
Converts the enumerated value to an text representation.
Added in version 0.13.0.
- AppStreamCompose.media_error_is_worker_failure(error)¶
- Parameters:
error (
GLib.ErrororNone) – AGLib.Errorreturned by a media operation.- Returns:
Trueif the worker misbehaved.- Return type:
Check whether the given error indicates that the media worker itself malfunctioned, as opposed to the processed media simply being broken. Only the former should be reported to users as a worker problem.
Added in version 1.2.0.