AppStreamGlib.ContentRating¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class AppStreamGlib.ContentRating(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
- classmethod attribute_from_csm_age(id, age)[source]¶
- Parameters:
- Returns:
the
AppStreamGlib.ContentRatingValue
, orAppStreamGlib.ContentRatingValue.UNKNOWN
if unknown- Return type:
Gets the highest
AppStreamGlib.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:age ≥ 0 for
AppStreamGlib.ContentRatingValue.NONE
age ≥ 9 for
AppStreamGlib.ContentRatingValue.MILD
age ≥ 11 for
AppStreamGlib.ContentRatingValue.MODERATE
age ≥ 18 for
AppStreamGlib.ContentRatingValue.INTENSE
then calling this function withviolence-bloodshed
and age set to 17 would returnAppStreamGlib.ContentRatingValue.MODERATE
. Calling it with age 18 would returnAppStreamGlib.ContentRatingValue.INTENSE
.
New in version 0.7.18.
- classmethod attribute_get_description(id, value)[source]¶
- Parameters:
id (
str
) – the subsection ID e.g.violence-cartoon
value (
AppStreamGlib.ContentRatingValue
) – theAppStreamGlib.ContentRatingValue
, e.g.AppStreamGlib.ContentRatingValue.INTENSE
- Returns:
a human-readable description of id and value
- Return type:
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.7.18.
- classmethod attribute_to_csm_age(id, value)[source]¶
- Parameters:
id (
str
) – the subsection ID e.g.violence-cartoon
value (
AppStreamGlib.ContentRatingValue
) – theAppStreamGlib.ContentRatingValue
, e.g.AppStreamGlib.ContentRatingValue.INTENSE
- Returns:
The age in years, or 0 for no details.
- Return type:
Gets the Common Sense Media approved age for a specific rating level.
New in version 0.7.15.
- classmethod get_all_rating_ids()[source]¶
- Returns:
a
None
-terminated array of IDs, to be freed withGLib.free
() (the element values are owned by libappstream-glib 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
AppStreamGlib.ContentRating.add_attribute
() orAppStreamGlib.ContentRating.attribute_to_csm_age
().New in version 0.7.15.
- classmethod new()[source]¶
- Returns:
- Return type:
Creates a new
AppStreamGlib.ContentRating
.New in version 0.5.12.
- classmethod system_format_age(system, age)[source]¶
- Parameters:
system (
AppStreamGlib.ContentRatingSystem
) – anAppStreamGlib.ContentRatingSystem
age (
int
) – a CSM age to format
- Returns:
a newly allocated formatted version of age, or
None
if the given system has no representation for age- Return type:
Format age as a human-readable string in the given rating system. This is the way to present system-specific strings in a UI.
New in version 0.7.18.
- classmethod system_from_locale(locale)[source]¶
- Parameters:
locale (
str
) – a locale, in the format described inman 3 setlocale
- Returns:
the most relevant
AppStreamGlib.ContentRatingSystem
- Return type:
Determine the most appropriate
AppStreamGlib.ContentRatingSystem
for the given locale. Content rating systems are selected by territory. If no content rating system seems suitable,AppStreamGlib.ContentRatingSystem.IARC
is returned.New in version 0.7.18.
- classmethod system_get_csm_ages(system)[source]¶
- Parameters:
system (
AppStreamGlib.ContentRatingSystem
) – anAppStreamGlib.ContentRatingSystem
- Returns:
an array of CSM ages
- Return type:
[
int
]
Get the CSM ages corresponding to the entries returned by
AppStreamGlib.ContentRating.system_get_formatted_ages
() for this system.New in version 0.7.18.
- classmethod system_get_formatted_ages(system)[source]¶
- Parameters:
system (
AppStreamGlib.ContentRatingSystem
) – anAppStreamGlib.ContentRatingSystem
- Returns:
None
-terminated array of human-readable age strings- Return type:
[
str
]
Get an array of all the possible return values of
AppStreamGlib.ContentRating.system_format_age
() for the given system. The array is sorted with youngest CSM age first.New in version 0.7.18.
- classmethod system_to_string(system)[source]¶
- Parameters:
system (
AppStreamGlib.ContentRatingSystem
) – anAppStreamGlib.ContentRatingSystem
- Returns:
a human-readable string for system, or
None
if unknown- Return type:
Get a human-readable string to identify system.
None
will be returned forAppStreamGlib.ContentRatingSystem.UNKNOWN
.New in version 0.7.18.
- classmethod value_from_string(value)[source]¶
- Parameters:
value (
str
) – the string.- Returns:
a
AppStreamGlib.ContentRatingValue
orAppStreamGlib.ContentRatingValue.UNKNOWN
for unknown- Return type:
Converts the text representation to an enumerated value.
New in version 0.5.12.
- classmethod value_to_string(value)[source]¶
- Parameters:
value (
AppStreamGlib.ContentRatingValue
) – theAppStreamGlib.ContentRatingValue
.- Returns:
string version of value
- Return type:
Converts the enumerated value to an text representation.
New in version 0.5.12.
- add_attribute(id, value)[source]¶
- Parameters:
id (
str
) – a content rating ID, e.g.money-gambling
.value (
AppStreamGlib.ContentRatingValue
) – aAppStreamGlib.ContentRatingValue
, e.g.AppStreamGlib.ContentRatingValue.MODERATE
.
Adds an attribute value to the content rating.
New in version 0.7.14.
- get_minimum_age()[source]¶
- Returns:
The age in years, 0 for no rating, or
GObject.G_MAXUINT
for no details.- Return type:
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.5.12.
- get_rating_ids()[source]¶
- Returns:
None
-terminated array of ratings IDs; each ratings ID is owned by theAppStreamGlib.ContentRating
and must not be freed, but the container must be freed withGLib.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.7.15.
- get_value(id)[source]¶
- Parameters:
id (
str
) – A ratings ID, e.g.violence-bloodshed
.- Returns:
the
AppStreamGlib.ContentRatingValue
, orAppStreamGlib.ContentRatingValue.UNKNOWN
- Return type:
Gets the set value of a content rating key.
New in version 0.6.4.