enum.py 3.28 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"
55
56
57
58
    LIVE_0 = "aura_linein_0"
    LIVE_1 = "aura_linein_1"
    LIVE_2 = "aura_linein_2"
    LIVE_3 = "aura_linein_3"
59
60
    LIVE_4 = "aura_linein_4"

61
62
63
    def __str__(self):
        return str(self.value)

64

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

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

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

95

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


104
105
class FallbackType(Enum):
    SHOW = "show" # the first played when the show playlist fails
106
    TIMESLOT = "timeslot" # the second played when timeslot fallback fails
107
    STATION = "station" # the last played when everything else fails
108

109
110
111
112
113
114
115


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

116
117
118
119
120

class EntryQueueState(Enum):
    OKAY = "ok"
    CUT = "cut"
    OUT_OF_SCHEDULE = "oos"
David Trattnig's avatar
David Trattnig committed
121
122
123
124
125
126
127
128
129
130
131
132
133
134

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"