Admin

class AzuracastPy.models.administration.Admin(_request_handler: RequestHandler)

Represents administration functionality on a radio, such as managing stations and changing settings.

__init__(_request_handler: RequestHandler)

Initializes an Admin object.

Note

This class should not be initialized directly. Instead, obtain an instance via: admin().

cpu_stats()
Returns:

The statistics of the system running the radio.

Usage:

stats = admin.cpu_stats()
custom_field

An instance of CustomFieldHelper.

Provides the interface for working with CustomField instances.

For example, to get a custom field with an id of 1 from this radio:

custom_field = admin.custom_field(1)

To create a custom field on this radio:

from AzuracastPy.enums import AutoAssignValues

admin.custom_field.create(
    name="New Custom Field",
    auto_assign_value=AutoAssignValues.ALBUM
)
custom_fields() List[CustomField]

Retrieves the created custom fields on the radio.

Returns:

A list of CustomField objects.

Usage:

custom_fields = admin.custom_fields()
permissions() Permissions

Retrieves the available permissions on the radio.

Returns:

A Permissions object.

Usage:

radio_permissions = admin.permissions()
relays() List[Relay]

Retrieves the internal relays on the radio.

Returns:

A list of Relay objects.

Usage:

relays = admin.relays()
role

An instance of RoleHelper.

Provides the interface for working with Role instances.

For example, to get a role with an id of 1 from this radio:

role = admin.role(1)

To create a role on this radio:

from AzuracastPy.enums import GlobalPermissions, StationPermissions

station_permissions = admin.role.generate_station_permissions(
    ("name", 1, [StationPermissions.VIEW_STATION_LOGS]),
    (None, 2, [StationPermissions.ADMINISTER_ALL, StationPermissions.VIEW_STATION_LOGS]),
    ("name", None, [StationPermissions.ADMINISTER_ALL, StationPermissions.VIEW_STATION_LOGS]),
    (None, 3, None)
)

role = admin.role.create(
    name="New playlist",
    global_permissions=[
        GlobalPermissions.VIEW_ADMINISTRATION,
        GlobalPermissions.VIEW_SYSTEM_LOGS
    ],
    station_permissions=station_permissions
)
roles() List[Role]

Retrieves the created roles on the radio.

Returns:

A list of Role objects.

Usage:

radio_roles = admin.roles()
settings() Settings

Retrieves the radio’s settings.

Returns:

A Settings object.

Usage:

settings = admin.settings()
station

An instance of AdminStationHelper.

Provides the interface for working with AdminStation instances.

For example, to get a station with admin priviledges on this radio, whose id is 1:

admin_station = admin.station(1)
stations() List[AdminStation]

Retrieves all stations on the radio.

Returns:

A list of AdminStation objects.

Usage:

admin_stations = admin.stations()
storage_location

An instance of StorageLocationHelper.

Provides the interface for working with StorageLocation instances.

For example, to get a storage location with an id of 1 from this radio:

storage_location = admin.storage_location(1)
storage_locations() List[StorageLocation]

Retrieves the available storage loactions on the radio.

Returns:

A list of StorageLocation objects.

Usage:

storage_locations = admin.storage_locations()