aboutsummaryrefslogtreecommitdiff
path: root/include/py/homekit/camera/types.py
blob: c313b582d8bbaa4eaf47fd7d877acf0000a97346 (plain)
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
35
36
37
38
39
40
41
42
43
44
45
46
from enum import Enum


class CameraType(Enum):
    ESP32 = 'esp32'
    ALIEXPRESS_NONAME = 'ali'
    HIKVISION = 'hik'

    def get_channel_url(self, channel: int) -> str:
        if channel not in (1, 2):
            raise ValueError(f'channel {channel} is invalid')
        if channel == 1:
            return ''
        elif channel == 2:
            if self.value == CameraType.HIKVISION:
                return '/Streaming/Channels/2'
            elif self.value == CameraType.ALIEXPRESS_NONAME:
                return '/?stream=1.sdp'
            else:
                raise ValueError(f'unsupported camera type {self.value}')


class VideoContainerType(Enum):
    MP4 = 'mp4'
    MOV = 'mov'


class VideoCodecType(Enum):
    H264 = 'h264'
    H265 = 'h265'


class TimeFilterType(Enum):
    FIX = 'fix'
    MOTION = 'motion'
    MOTION_START = 'motion_start'


class TelegramLinkType(Enum):
    FRAGMENT = 'fragment'
    ORIGINAL_FILE = 'original_file'


class CaptureType(Enum):
    HLS = 'hls'
    RECORD = 'record'