Skip to content

Setlists

Setlists ¤

Bases: CollectionBase

Represents a collection of Helix setlists.

Source code in helixapi\setlists.py
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
class Setlists(CollectionBase):
    """
    Represents a collection of Helix setlists.
    """
    def __init__(self, data: dict=None):
        self._midi = MIDI()

        super().__init__(cls=Setlist, items=[Setlist(data=data, index=i, set_active_callback=self._set_active_setlist) for i in range(MAX_SETLISTS)])

        self._set_active_setlist(0)  # Set the first setlist as active initially

        # Ensure the initial active setlist is correctly marked as active
        if self._items:
            self._items[self._active_index].active = True

    def _set_active_setlist(self, index):
        self._active_index = index
        self._midi.commands.change_to_setlist(self._active_index)

    @property
    def active_index(self):
        """
        Get the index of the active setlist.

        Returns:
            int: The index of the active setlist.
        """
        return self._active_index

    @active_index.setter
    def active_index(self, index):
        """
        Set the index of the active setlist.

        Args:
            index (int): The index of the setlist to set as active.
        """
        self._set_active_setlist(index)

    @property
    def active_item(self):
        """
        Get the active setlist.

        Returns:
            Setlist: The active setlist.
        """
        return self._active_item

    @active_item.setter
    def active_item(self, item):
        """
        Set the active setlist.

        Args:
            item (Setlist): The setlist to set as active.
        """
        self._active_item = item
        self._set_active_setlist(item.index)

    def export_setlists(self, file_path=None):
        """
        Export each setlist to individual files.

        Args:
            file_path (str): The path to export the setlists to.

        Examples:
        ``` py
        setlists.export_setlists(file_path="/path/to/setlists")
        ```

        Returns:
            None
        """
        self._export_files(file_path)

    def import_setlists(self, file_paths: List[str]):
        """
        Import each setlist from individual files.

        !!! note


            Setlist order will follow the order of the provided file_paths (i.e. the first file path will be setlist 1, etc)

        Args:
            file_paths (List[str]): The paths to import the setlists from.

        Examples:
        ``` py
        setlists.import_setlists(file_paths=["/path/to/setlist1", "/path/to/setlist2"])
        ```

        Returns:
            None
        """
        self._import_files(file_paths)

active_index property writable ¤

Get the index of the active setlist.

Returns:

Name Type Description
int

The index of the active setlist.

active_item property writable ¤

Get the active setlist.

Returns:

Name Type Description
Setlist

The active setlist.

export_setlists(file_path=None) ¤

Export each setlist to individual files.

Parameters:

Name Type Description Default
file_path str

The path to export the setlists to.

None

Examples:

setlists.export_setlists(file_path="/path/to/setlists")

Returns:

Type Description

None

Source code in helixapi\setlists.py
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
def export_setlists(self, file_path=None):
    """
    Export each setlist to individual files.

    Args:
        file_path (str): The path to export the setlists to.

    Examples:
    ``` py
    setlists.export_setlists(file_path="/path/to/setlists")
    ```

    Returns:
        None
    """
    self._export_files(file_path)

import_setlists(file_paths) ¤

Import each setlist from individual files.

Note

Setlist order will follow the order of the provided file_paths (i.e. the first file path will be setlist 1, etc)

Parameters:

Name Type Description Default
file_paths List[str]

The paths to import the setlists from.

required

Examples:

setlists.import_setlists(file_paths=["/path/to/setlist1", "/path/to/setlist2"])

Returns:

Type Description

None

Source code in helixapi\setlists.py
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
def import_setlists(self, file_paths: List[str]):
    """
    Import each setlist from individual files.

    !!! note


        Setlist order will follow the order of the provided file_paths (i.e. the first file path will be setlist 1, etc)

    Args:
        file_paths (List[str]): The paths to import the setlists from.

    Examples:
    ``` py
    setlists.import_setlists(file_paths=["/path/to/setlist1", "/path/to/setlist2"])
    ```

    Returns:
        None
    """
    self._import_files(file_paths)