Station Streamer Helper

class AzuracastPy.models.helpers.StreamerHelper(_station)

Provides a set of functions to interact with streamers.

__call__(id: int) Streamer

Retrieves a specific streamer from the station.

Parameters:

id – The numerical ID of the streamer to be retrieved.

Returns:

A Streamer object.

Usage:

streamer = station.streamer(1)
__init__(_station)

Initializes a StreamerHelper instance.

Note

This class should not be initialized directly. Instead, obtain an instance via: streamer.

create(username: str, password: str, display_name: str | None = None, comments: str | None = None, is_active: bool = True, enforce_schedule: bool = False, schedule: List[Dict[str, Any]] | None = None) Streamer

Adds a streamer to the station.

Parameters:
  • username – The streamer’s username.

  • password – The streamer’s password.

  • display_name – (Optional) The streamer’s display_name. Leave as None to use the username as the value. Default: None.

  • comments – (Optional) Internal notes or comments about the streamer. Default: None.

  • is_active – Determines whether this streamer can log in and stream. Default: True.

  • enforce_schedule – Determines whether this streamer will only be able to connect during their scheduled broadcast times. Default: False.

  • schedule – The structure representing the schedule list of the streamer. This can be generated using the generate_schedule_items() function. Default: None.

Returns:

A Streamer object for the newly created streamer.

Usage:


streamer = station.streamer.create(

username=”Username”, password=”Password”, comments=”Never gonna give you up.”

)

generate_schedule_item(start_time: str, end_time: str, start_date: str | None = None, end_date: str | None = None, days: List[str] | None = None) Dict[str, Any]

Generates a single schedule item for a streamer.

Parameters:
  • start_time – The starting time of the schedule, in this format: "HOUR:MINUTES".

  • end_time – The ending time of the schedule, in this format: "HOUR:MINUTES".

  • start_date – (Optional) The starting date of the schedule, in this format: "YEAR-MONTH-DAY". Default: None.

  • end_date – (Optional) The ending date of the schedule, in this format: "YEAR-MONTH-DAY". Default: None.

  • days – (Optional) A list of the days that the playlist will play. Default: None.

Usage:

item = station.streamer.generate_schedule_item(
    start_time="12:32",
    end_time="23:10",
    start_date="2024-09-08",
    end_date="2025-07-08",
    days=["monday", "thursday"]
)
generate_schedule_items(*args)
Generates a list of schedule items for a streamer by using the

generate_schedule_item() function on each argument.

Parameters:

args – Tuples in the format of (start_time, end_time, start_date, end_date, days). Any of the tuple’s values can be None.

Usage:

items = station.streamer.generate_schedule_items(
    ("12:32", "23:10", "2024-09-08", "2025-07-08", None),
    ("12:32", "23:10", "2024-09-18", "2025-07-08", ["monday", "thursday"])
)