enum.py 3.41 KB
Newer Older
1
2
3
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
#
#  engine
#
#  Playout Daemon for autoradio project
#
#
#  Copyright (C) 2017-2018 Gottfried Gaisbauer <gottfried.gaisbauer@servus.at>
#
#  This file is part of engine.
#
#  engine is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation, either version 3 of the License, or
#  any later version.
#
#  engine 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 General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with engine. If not, see <http://www.gnu.org/licenses/>.
#

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
35
    GS_REPLY  = "get_status_reply"
36
    GCS_REPLY = "get_connection_status_reply"
37
    GNF_REPLY = "get_next_file_reply"
38
39
    IPE_REPLY = "insert_playlist_entry_reply"
    IP_REPLY  = "init_player_reply"
40
    TS_REPLY  = "track_service_reply"
41
42
43
44
45
46
    MPE_REPLY = "move_playlist_entry_reply"
    PMQ_REPLY = "print_message_queue_reply"
    RDB_REPLY = "recreate_database_reply"
    SNF_REPLY = "get_next_file_reply"


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

63
64
65
    def __str__(self):
        return str(self.value)

66

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

94
95
96
97
    @property
    def channels(self):
        return self.value["channels"]

98
    def __str__(self):
99
100
        return str(self.value["id"])

101

David Trattnig's avatar
David Trattnig committed
102
103
104
105
106
107
108
109
class TransitionType(Enum):
    """
    Types of fade-in and fade-out transition.
    """
    INSTANT = "instant"
    FADE = "fade"


110
111
class FallbackType(Enum):
    SHOW = "show" # the first played when the show playlist fails
112
    TIMESLOT = "timeslot" # the second played when timeslot fallback fails
113
    STATION = "station" # the last played when everything else fails
114

115
116
117
118
119
120
121


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

122
123
124
125
126

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

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"