enum.py 3.68 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
24
25
26
27
28
29

from enum import Enum



class RedisChannel(Enum):
    STANDARD = "aura"

    DPE_REPLY = "delete_playlist_entry_reply"
    FNP_REPLY = "fetch_new_programme_reply"
    GAP_REPLY = "get_act_programme_reply"
David Trattnig's avatar
David Trattnig committed
30
    GS_REPLY  = "get_status_reply"
31
    GCS_REPLY = "get_connection_status_reply"
32
    GNF_REPLY = "get_next_file_reply"
33
34
    IPE_REPLY = "insert_playlist_entry_reply"
    IP_REPLY  = "init_player_reply"
35
    TS_REPLY  = "track_service_reply"
36
37
38
39
40
41
    MPE_REPLY = "move_playlist_entry_reply"
    PMQ_REPLY = "print_message_queue_reply"
    RDB_REPLY = "recreate_database_reply"
    SNF_REPLY = "get_next_file_reply"


42
43
44
45
46
47
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
48
49
    HTTP_A  = "in_http_0"
    HTTP_B  = "in_http_1"
David Trattnig's avatar
David Trattnig committed
50
51
    HTTPS_A  = "in_https_0"
    HTTPS_B  = "in_https_1"
52
53
54
55
56
    LIVE_0 = "linein_0"
    LIVE_1 = "linein_1"
    LIVE_2 = "linein_2"
    LIVE_3 = "linein_3"
    LIVE_4 = "linein_4"
57

58
59
60
    def __str__(self):
        return str(self.value)

61

62
63
64
65
66
67
68
69
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
70
    HTTP = {
71
        "id": "http",
David Trattnig's avatar
Fix.    
David Trattnig committed
72
        "channels": [Channel.HTTP_A, Channel.HTTP_B]
73
    }
David Trattnig's avatar
David Trattnig committed
74
75
    HTTPS = {
        "id": "https",
David Trattnig's avatar
Fix.    
David Trattnig committed
76
        "channels": [Channel.HTTPS_A, Channel.HTTPS_B]
David Trattnig's avatar
David Trattnig committed
77
    }
78
79
80
81
82
83
84
85
86
87
88
    LIVE = {
        "id": "live",
        "channels": [
            Channel.LIVE_0, 
            Channel.LIVE_1,
            Channel.LIVE_2,
            Channel.LIVE_3,
            Channel.LIVE_4
        ]
    }

89
90
91
92
    @property
    def channels(self):
        return self.value["channels"]

93
    def __str__(self):
94
95
        return str(self.value["id"])

96

David Trattnig's avatar
David Trattnig committed
97
98
99
100
101
102
103
104
class TransitionType(Enum):
    """
    Types of fade-in and fade-out transition.
    """
    INSTANT = "instant"
    FADE = "fade"


David Trattnig's avatar
David Trattnig committed
105
106
107
108
109
class PlaylistType(Enum):
    DEFAULT     = { "id": 0, "name": "default" }    # Default play mode
    SHOW        = { "id": 1, "name": "show" }       # The first played when some default playlist fails
    TIMESLOT    = { "id": 2, "name": "timeslot" }   # The second played when the timeslot fallback fails
    STATION     = { "id": 3, "name": "station" }    # The last played when everything else fails
110

David Trattnig's avatar
David Trattnig committed
111
112
113
114
115
116
    @property
    def id(self):
        return self.value["id"]

    def __str__(self):
        return str(self.value["name"])
117
118
119
120
121
122
123


class TimerType(Enum):
    SWITCH = "switch"
    FADEIN = "fadein"
    FADEOUT = "fadeout"

124
125
126
127
128

class EntryQueueState(Enum):
    OKAY = "ok"
    CUT = "cut"
    OUT_OF_SCHEDULE = "oos"
David Trattnig's avatar
David Trattnig committed
129
130
131
132
133
134
135
136
137
138
139
140
141
142

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"