Skip to content

Setlist

Setlist ¤

Bases: ItemBase

Source code in helixapi\setlist.py
 4
 5
 6
 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
class Setlist(ItemBase):
    def __init__(self, data: dict, index: int, set_active_callback=None, metadata: dict = {}):
        super().__init__(cls=Setlist, data=data, metadata=metadata, setlist_index=index)
        self.index = index
        self._active = False
        self._set_active_callback = set_active_callback
        self._presets = Presets(data=data, setlist_index=index)

    @property
    def presets(self):
        """
        Get the presets for this setlist.

        Returns:
            Presets: The presets for this setlist.
        """
        return self._presets

    @property
    def name(self) -> str:
        """
        Get the name of the setlist.

        Returns:
            str: The name of the setlist.
        """
        return self._get_data("name")

    @name.setter
    def name(self, value: str) -> None:
        """
        Set the name of the setlist.

        Args:
            value (str): The name to set for the setlist.

        Raises:
            ValueError: If the name length exceeds the maximum allowed length.
        """
        if len(value) > 16:
            raise ValueError("Name must be 16 characters or fewer.")
        self._set_data("name", value)

    def import_setlist(self, file_path=None):
        """
        Import a setlist from a file.

        Args:
            file_path (str, optional): The path to the file to import. Defaults to None.

        Raises:
            Exception: If the file path is not specified or the file type is incorrect.
        """
        self._import_file(file_path=file_path)

    def export_setlist(self, file_path=None):
        """
        Export a setlist to a file.

        Args:
            file_path (str, optional): The path to the file to export. Defaults to None.

        Raises:
            Exception: If the file path is not specified or the file type is incorrect.
        """
        self._export_file(file_path=file_path)

    def reset_setlist(self):
        """
        Reset the setlist to its default state.
        """
        self.import_setlist()
        self.name = f"SETLIST {self.index + 1}"

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

        Returns:
            bool: True if the setlist is active, False otherwise.
        """
        return self._active

    @active.setter
    def active(self, value):
        """
        Set the active state of the setlist.

        Args:
            value (bool): True to set the setlist as active, False otherwise.
        """
        if value and self._set_active_callback:
            self._set_active_callback(self.index)
        self._active = value

active property writable ¤

Get the active state of the setlist.

Returns:

Name Type Description
bool

True if the setlist is active, False otherwise.

index = index instance-attribute ¤

name: str property writable ¤

Get the name of the setlist.

Returns:

Name Type Description
str str

The name of the setlist.

presets property ¤

Get the presets for this setlist.

Returns:

Name Type Description
Presets

The presets for this setlist.

export_setlist(file_path=None) ¤

Export a setlist to a file.

Parameters:

Name Type Description Default
file_path str

The path to the file to export. Defaults to None.

None

Raises:

Type Description
Exception

If the file path is not specified or the file type is incorrect.

Source code in helixapi\setlist.py
59
60
61
62
63
64
65
66
67
68
69
def export_setlist(self, file_path=None):
    """
    Export a setlist to a file.

    Args:
        file_path (str, optional): The path to the file to export. Defaults to None.

    Raises:
        Exception: If the file path is not specified or the file type is incorrect.
    """
    self._export_file(file_path=file_path)

import_setlist(file_path=None) ¤

Import a setlist from a file.

Parameters:

Name Type Description Default
file_path str

The path to the file to import. Defaults to None.

None

Raises:

Type Description
Exception

If the file path is not specified or the file type is incorrect.

Source code in helixapi\setlist.py
47
48
49
50
51
52
53
54
55
56
57
def import_setlist(self, file_path=None):
    """
    Import a setlist from a file.

    Args:
        file_path (str, optional): The path to the file to import. Defaults to None.

    Raises:
        Exception: If the file path is not specified or the file type is incorrect.
    """
    self._import_file(file_path=file_path)

reset_setlist() ¤

Reset the setlist to its default state.

Source code in helixapi\setlist.py
71
72
73
74
75
76
def reset_setlist(self):
    """
    Reset the setlist to its default state.
    """
    self.import_setlist()
    self.name = f"SETLIST {self.index + 1}"