channels.py 2.41 KB
Newer Older
1
#
David Trattnig's avatar
David Trattnig committed
2
# Aura Engine (https://gitlab.servus.at/aura/engine)
3
#
David Trattnig's avatar
David Trattnig committed
4
# Copyright (C) 2017-2020 - The Aura Engine Team.
5
#
David Trattnig's avatar
David Trattnig committed
6
7
8
9
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
10
#
David Trattnig's avatar
David Trattnig committed
11
12
13
14
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
15
#
David Trattnig's avatar
David Trattnig committed
16
17
18
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

19
20
21
22
23

from enum import Enum



David Trattnig's avatar
David Trattnig committed
24
25
26
27
28
29
class TransitionType(Enum):
    """
    Types of fade-in and fade-out transition.
    """
    INSTANT = "instant"
    FADE = "fade"
30

David Trattnig's avatar
David Trattnig committed
31
    
32
33
34
35
36
37
class Channel(Enum):
    """
    Channel name mappings to the Liqidsoap channel IDs
    """
    FILESYSTEM_A = "in_filesystem_0"
    FILESYSTEM_B = "in_filesystem_1"
David Trattnig's avatar
David Trattnig committed
38
39
    HTTP_A  = "in_http_0"
    HTTP_B  = "in_http_1"
David Trattnig's avatar
David Trattnig committed
40
41
    HTTPS_A  = "in_https_0"
    HTTPS_B  = "in_https_1"
42
43
44
45
46
    LIVE_0 = "linein_0"
    LIVE_1 = "linein_1"
    LIVE_2 = "linein_2"
    LIVE_3 = "linein_3"
    LIVE_4 = "linein_4"
47

48
49
50
    def __str__(self):
        return str(self.value)

51

52
53
54
55
56
57
58
59
class ChannelType(Enum):
    """
    Engine channel types mapped to `Entry` source types.
    """
    FILESYSTEM = {
        "id": "fs",
        "channels": [Channel.FILESYSTEM_A, Channel.FILESYSTEM_B]
    }
David Trattnig's avatar
David Trattnig committed
60
    HTTP = {
61
        "id": "http",
David Trattnig's avatar
Fix.    
David Trattnig committed
62
        "channels": [Channel.HTTP_A, Channel.HTTP_B]
63
    }
David Trattnig's avatar
David Trattnig committed
64
65
    HTTPS = {
        "id": "https",
David Trattnig's avatar
Fix.    
David Trattnig committed
66
        "channels": [Channel.HTTPS_A, Channel.HTTPS_B]
David Trattnig's avatar
David Trattnig committed
67
    }
68
69
70
71
72
73
74
75
76
77
78
    LIVE = {
        "id": "live",
        "channels": [
            Channel.LIVE_0, 
            Channel.LIVE_1,
            Channel.LIVE_2,
            Channel.LIVE_3,
            Channel.LIVE_4
        ]
    }

79
80
81
82
    @property
    def channels(self):
        return self.value["channels"]

83
    def __str__(self):
84
85
        return str(self.value["id"])

86

David Trattnig's avatar
David Trattnig committed
87
88
89
90
91
92
93
94
95
96
97
98
class EntryPlayState(Enum):
    UNKNOWN = "unknown"
    LOADING = "loading"
    READY = "ready_to_play"
    PLAYING = "playing"
    FINISHED = "finished"

class LiquidsoapResponse(Enum):
    SUCCESS = "Done"
    STREAM_STATUS_POLLING = "polling"
    STREAM_STATUS_STOPPED = "stopped"
    STREAM_STATUS_CONNECTED = "connected"
David Trattnig's avatar
David Trattnig committed
99