AppStream.ContentRating

g AppStream.ContentRating AppStream.ContentRating GObject.Object GObject.Object GObject.Object->AppStream.ContentRating

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

attribute_from_csm_age (id, age)

class

attribute_get_description (id, value)

class

attribute_to_csm_age (id, value)

class

get_all_rating_ids ()

class

new ()

add_attribute (id, value)

get_kind ()

get_minimum_age ()

get_rating_ids ()

get_value (id)

set_kind (kind)

set_value (id, value)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

None

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

GObject.Object

r

Class Details

class AppStream.ContentRating(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

AppStream.ContentRatingClass

classmethod attribute_from_csm_age(id, age)
Parameters:
  • id (str) – the subsection ID e.g. violence-cartoon

  • age (int) – the CSM age

Returns:

the AppStream.ContentRatingValue, or AppStream.ContentRatingValue.UNKNOWN if unknown

Return type:

AppStream.ContentRatingValue

Gets the highest AppStream.ContentRatingValue which is allowed to be seen by the given Common Sense Media age for the given subsection id.

For example, if the CSM age mappings for violence-bloodshed are:

New in version 0.12.12.

classmethod attribute_get_description(id, value)
Parameters:
Returns:

a human-readable description of id and value

Return type:

str

Get a human-readable description of what content would be expected to require the content rating attribute given by id and value.

New in version 0.12.12.

classmethod attribute_to_csm_age(id, value)
Parameters:
Returns:

The age in years, or 0 for no details.

Return type:

int

Gets the Common Sense Media approved age for a specific rating level.

New in version 0.12.10.

classmethod get_all_rating_ids()
Returns:

a None-terminated array of IDs, to be freed with GLib.free() (the element values are owned by libappstream and must not be freed)

Return type:

[str]

Returns a list of all the valid OARS content rating attribute IDs as could be passed to AppStream.ContentRating.add_attribute() or AppStream.ContentRating.attribute_to_csm_age().

New in version 0.12.10.

classmethod new()
Returns:

a AppStream.ContentRating

Return type:

AppStream.ContentRating

Creates a new AppStream.ContentRating.

New in version 0.11.0.

add_attribute(id, value)
Parameters:

Adds an attribute value to the content rating.

New in version 0.14.0.

get_kind()
Returns:

a string, e.g. “oars-1.0”, or None

Return type:

str

Gets the content_rating kind.

New in version 0.11.0.

get_minimum_age()
Returns:

The age in years, 0 for no rating, or GObject.G_MAXUINT for no details.

Return type:

int

Gets the lowest Common Sense Media approved age for the content_rating block. NOTE: these numbers are based on the data and descriptions available from https://www.commonsensemedia.org/about-us/our-mission/about-our-ratings and you may disagree with them.

You’re free to disagree with these, and of course you should use your own brain to work our if your child is able to cope with the concepts enumerated here. Some 13 year olds may be fine with the concept of mutilation of body parts; others may get nightmares.

New in version 0.11.0.

get_rating_ids()
Returns:

None-terminated array of ratings IDs; each ratings ID is owned by the AppStream.ContentRating and must not be freed, but the container must be freed with GLib.free()

Return type:

[str]

Gets the set of ratings IDs which are present in this self. An example of a ratings ID is violence-bloodshed.

The IDs are returned in lexicographical order.

New in version 0.12.10.

get_value(id)
Parameters:

id (str) – A ratings ID, e.g. violence-bloodshed.

Returns:

the AppStream.ContentRatingValue, or AppStream.ContentRatingValue.UNKNOWN

Return type:

AppStream.ContentRatingValue

Gets the value of a content rating key.

New in version 0.11.0.

set_kind(kind)
Parameters:

kind (str) – the rating kind, e.g. “oars-1.0”

Sets the content rating kind.

New in version 0.11.0.

set_value(id, value)
Parameters:

Sets the value of a content rating key.

New in version 0.11.0.