Station
- class AzuracastPy.models.Station(id: str, name: str, shortcode: str, description: str, frontend: str, backend: str, listen_url: str, url: str, public_player_url: str, is_public: bool, hls_enabled: bool, hls_listeners: int, mounts: List[Mount], remotes: List[Remote], hls_is_default: bool | None = None, timezone: str | None = None, playlist_pls_url: str | None = None, playlist_m3u_url: str | None = None, hls_url: str | None = None, _request_handler: RequestHandler | None = None)
Represents a station on a radio.
- __init__(id: str, name: str, shortcode: str, description: str, frontend: str, backend: str, listen_url: str, url: str, public_player_url: str, is_public: bool, hls_enabled: bool, hls_listeners: int, mounts: List[Mount], remotes: List[Remote], hls_is_default: bool | None = None, timezone: str | None = None, playlist_pls_url: str | None = None, playlist_m3u_url: str | None = None, hls_url: str | None = None, _request_handler: RequestHandler | None = None)
Initializes a
Stationobject.Note
This class should not be initialized directly. Instead, obtain an instance via:
station()orstations().
- file
An instance of
FileHelper.Provides the interface for working with
StationFileinstances.For example, to get an uploaded media file with an id of
1from this station:file = station.file(1)
To upload a file to this station:
file = station.file.upload( path="song/on/station.mp3", file="file/path/on/local/system.mp3" )
- files() List[StationFile]
Retrieves the station’s uploaded music files.
- Returns:
A list of
StationFileobjects.
Usage:
files = station.files()
- history() List[SongHistory]
Retrieves the history of played songs on the station.
- Returns:
A list of
SongHistoryobjects.
Usage:
song_history = station.history()
- hls_stream
An instance of
HLSStreamHelper.Provides the interface for working with
HLSStreaminstances.For example, to get an HLS Stream with an id of
1from this station:hls_stream = station.hls_stream(1)
To create a remote on this station:
from AzuracastPy.enums import Formats, Bitrates hls_stream = station.hls_stream.create( name="New HLS Stream", format=Formats.MP3, bitrate=Bitrates.BITRATE_32 )
- hls_streams() List[HLSStream]
Retrieves the station’s HTTP Live Streaming (HLS) streams.
- Returns:
A list of
HLSStreamobjects.
Usage:
hls_streams = station.hls_streams()
- listeners() List[Listener]
Retrieves the current listeners of the station.
- Returns:
A list of
Listenerobjects.
Usage:
listeners = station.listeners()
- mount_point
An instance of
MountPointHelper.Provides the interface for working with
MountPointinstances.For example, to get a mount point with an id of
1from this station:mount_point = station.mount_point(1)
To create a mount point on this station:
from AzuracastPy.enums import Formats mount_point = station(1).mount_point.create( url="/autodj.mp3", display_name="Hehehehe", autodj_format=Formats.OPUS )
- mount_points() List[MountPoint]
Retrieves the station’s mount points.
- Returns:
A list of
MountPointobjects.
Usage:
mount_points = station.mount_points()
- perform_backend_action(action: ServiceActions = ServiceActions.RESTART)
Performs an action on the station’s backend.
- Parameters:
action – (Optional) The action to be performed. Default:
ServiceActions.RESTART.
Usage:
station.perform_backend_action(ServiceActions.STOP)
- perform_frontend_action(action: ServiceActions = ServiceActions.RESTART)
Performs an action on the station’s frontend.
- Parameters:
action – (Optional) The action to be performed. Default:
ServiceActions.RESTART.
Usage:
from AzuracastPy.enums import ServiceActions station.perform_frontend_action(ServiceActions.STOP)
- playlist
An instance of
PlaylistHelper.Provides the interface for working with
Playlistinstances.For example, to get a playlist with an id of
1from this station:playlist = station.playlist(1)
To create a playlist on this station:
from AzuracastPy.enums import PlaylistTypes playlist = station.playlist.create( name="New", type=PlaylistTypes.ONCE_PER_X_MINUTES, play_per_value=5 )
- playlists() List[Playlist]
Retrieves the station’s playlists.
- Returns:
A list of
Playlistobjects.
Usage:
playlists = station.playlists()
- podcast
An instance of
PodcastHelper.Provides the interface for working with
Podcastinstances.For example, to get a podcast with an id of
"podcast-id"from this station:podcast = station.podcast("podcast-id")
To create a podcast on this station:
from AzuracastPy.enums import Languages, PodcastCategories podcast = station.podcast.create( title="New podcast", description="This is a random description", language=Languages.ARABIC, categories=[ PodcastCategories.Arts.DESIGN, PodcastCategories.Comedy.COMEDY_INTERVIEWS ] )
- podcasts() List[Podcast]
Retrieves the station’s podcasts.
- Returns:
A list of
Podcastobjects.
Usage:
podcasts = station.podcasts()
- queue
An instance of
QueueHelper.Provides the interface for working with
QueueIteminstances.For example, to get a queue item with an id of
1from this station:queue_item = station.queue(1)
To get all items in the queue on this station:
queue = station.queue()
- remote_relay
An instance of
RemoteRelayHelper.Provides the interface for working with
RemoteRelayinstances.For example, to get a remote with an id of
1from this station:remote_relay = station.remote_relay(1)
To create a remote on this station:
from AzuracastPy.enums import Formats remote_relay = station.remote_relay.create( station_listening_url="http://station.example.com:8000", display_name="Display name", autodj_format=Formats.MP3 )
- remote_relays() List[RemoteRelay]
Retrieves the station’s remote relays.
- Returns:
A list of
RemoteRelayobjects.
Usage:
remote_relays = station.remote_relays()
- request_song(request_id: str)
Makes a song request to the station.
- Parameters:
request_id – The request ID of the song to be requested.
Usage:
station.request_song("request_id")
- requestable_songs() List[RequestableSong]
Retrieves songs that are available for requests on the station.
- Returns:
A list of
RequestableSongobjects.
Usage:
requestable_songs = station.requestable_songs()
- restart()
Restarts the station.
Usage:
station.restart()
- schedule() List[ScheduleItem]
Retrieves the schedule of the station.
- Returns:
A list of
ScheduleItemobjects.
Usage:
schedule = station.schedule()
- sftp_user
An instance of
SFTPUserHelper.Provides the interface for working with
SFTPUserinstances.For example, to get an SFTP user with an id of
1from this station:sftp_user = station.sftp_user(1)
To create a remote on this station:
sftp_user = station.sftp_user.create( username="Username", password="Password", public_keys=['key1', 'key2'] )
- sftp_users() List[SFTPUser]
Retrieves the station’s SFTP users.
- Returns:
A list of
SFTPUserobjects.
Usage:
sftp_users = station.sftp_users()
- status() StationStatus
Displays the current status of the station.
- Returns:
A
StationStatusobject.
Usage:
status = station.status()
- streamer
An instance of
StreamerHelper.Provides the interface for working with
Streamerinstances.For example, to get a streamer with an id of
1from this station:streamer = station.streamer(1)
To create a streamer on this station:
from AzuracastPy.enums import Languages, PodcastCategories podcast = station.podcast.create( title="New podcast", description="This is a random description", language=Languages.ARABIC, categories=[ PodcastCategories.Arts.DESIGN, PodcastCategories.Comedy.COMEDY_INTERVIEWS ] )
- streamers() List[Streamer]
Retrieves the station’s streamers.
- Returns:
A list of
Streamerobjects.
Usage:
streamers = station.streamers()
- webhook
An instance of
WebhookHelper.Provides the interface for working with
Webhookinstances.For example, to get a webhook with an id of
1from this station:webhook = station.webhook(1)
To create a webhook on this station:
from AzuracastPy.enums import WebhookConfigTypes, WebhookTriggers config = station.webhook.generate_webhook_config( subject="subject", message="message", to="to" ) webhook = station.webhook.create( name="New email webhook", type=WebhookConfigTypes.EMAIL, webhook_config=config, triggers=[ WebhookTriggers.STATION_ONLINE, WebhookTriggers.LIVE_CONNECT ] )