Playlist

class AzuracastPy.models.Playlist(name: str, type: str, source: str, order: str, remote_url: str, remote_type: str, remote_buffer: int, is_enabled: bool, is_jingle: bool, play_per_songs: int, play_per_minutes: int, play_per_hour_minute: int, weight: int, include_in_requests: bool, include_in_on_demand: bool, backend_options: List[str], avoid_duplicates: bool, played_at: int, queue_reset_at: int, schedule_items: List[ScheduleItem], id: int, short_name: str, num_songs: int, total_length: int, links: Dict[str, Any], _station)

Represents a playlist on a station.

__init__(name: str, type: str, source: str, order: str, remote_url: str, remote_type: str, remote_buffer: int, is_enabled: bool, is_jingle: bool, play_per_songs: int, play_per_minutes: int, play_per_hour_minute: int, weight: int, include_in_requests: bool, include_in_on_demand: bool, backend_options: List[str], avoid_duplicates: bool, played_at: int, queue_reset_at: int, schedule_items: List[ScheduleItem], id: int, short_name: str, num_songs: int, total_length: int, links: Dict[str, Any], _station)

Initializes a Playlist object.

Note

This class should not be initialized directly. Instead, obtain an instance via: create(), __call__() or playlists().

delete()

Deletes the playlist from the station.

Sets all attributes of the current Playlist object to None.

Usage:

playlist.delete()
edit(name: str | None = None, source: PlaylistSources | None = None, type: PlaylistTypes | None = None, order: PlaylistOrders | None = None, avoid_duplicates: bool | None = None, allow_requests: bool | None = None, play_per_value: int | None = None, weight: int | None = None, include_in_on_demand: bool | None = None, is_jingle: bool | None = None, remote_url: str | None = None, remote_type: PlaylistRemoteTypes | None = None, remote_buffer: int | None = None, schedule: List[Dict[str, Any]] | None = None)

Edits the playlist’s properties.

Updates all edited attributes of the current Playlist object.

Parameters:
  • name – (Optional) The new name of the playlist. Default: None.

  • source – (Optional) Specify where the playlist gets its contents from. Default: None.

  • type – (Optional) The internal play-type of the playlist. Not needed if playlist’s source is set to PlaylistSources.REMOTE_URL. Default: None.

  • order – (Optional) Determines the playback order of the songs in the playlist. Not needed if playlist’s source is set to PlaylistSources.REMOTE_URL. Default: None.

  • avoid_duplicates – (Optional) Determines whether duplicate artists and track titles will be avoided when playing media from this playlist. Not needed if playlist’s source is set to PlaylistSources.REMOTE_URL. Default: None.

  • allow_requests – (Optional) Determines whether users will be able to request media that is on this playlist. Not needed if playlist’s source is set to PlaylistSources.REMOTE_URL. Default: None.

  • play_per_value – (Optional) The new value for the ONCE_PER_X_SONGS, ONCE_PER_X_HOURS and ONCE_PER_X_MINUTES playlist types. Not needed if playlist’s source is set to PlaylistSources.REMOTE_URL. Default: None.

  • weight – (Optional) The new frequency of the playlist to be played when compared to other playlists. This is the value for the DEFAULT playlist type. Not needed if playlist’s source is set to PlaylistSources.REMOTE_URL. Default: None.

  • include_in_on_demand – (Optional) Determines whether only songs that are in playlists with this setting enabled will be visible. Not needed if playlist’s source is set to PlaylistSources.REMOTE_URL. Default: None.

  • is_jingle – (Optional) Determines if metadata will be sent to the AutoDJ for files in this playlist. Not needed if playlist’s source is set to PlaylistSources.REMOTE_URL. Default: None.

  • remote_url – (Optional) The new source URL for the playlist’s contents. Not needed if playlist’s source is set to PlaylistSources.SONGS. Default: None.

  • remote_type – (Optional) Specify the type of the remote_url. Not needed if playlist’s source is set to PlaylistSources.SONGS. Default: None.

  • remote_buffer – (Optional) The new length of playback time that Liquidsoap should buffer when playing this remote playlist. Not needed if playlist’s source is set to PlaylistSources.SONGS. Default: None.

  • schedule

    (Optional) The new structure representing the schedule list of the playlist. This can be generated using the generate_schedule_items() function. Default: None.

    Warning

    This will overwrite the playlist’s existing schedule. Use the add() and remove() methods to interact with the playlist’s existing schedule.

Usage:

playlist.edit(
    name="New name lol",
    allow_requests=False,
    avoid_duplicates=False
)
schedule

An instance of ScheduleHelper.

Provides the interface for working with this playlist’s schedule.

For example, to add an item to the schedule:

item = station.playlist.generate_schedule_item(
    start_time="12:32",
    end_time="23:10",
    start_date="2024-09-08",
    end_date="2025-07-08",
    days=["monday", "thursday"]
)

playlist.schedule.add(item)

To remove an item whose id is 1 from the schedule:

playlist.schedule.remove(1)