영어 | 한국어 | 중국어 | 일본어

APIs: utils

채널 목록 가져오기

카메라의 채널 목록을 가져옵니다.

🛠️ channels = get_channel_list()

↩️ channels: 채널 정보를 담은 객체 배열입니다. 각 객체는 다음 속성을 포함합니다:

🔹ch_no: 채널 번호.

🔹title: 채널 제목.

🔹is_connected: 카메라가 연결되어 있는지 여부.

🔹is_recording: 카메라가 녹화 중인지 여부.

🔹is_ptz: 카메라가 PTZ(팬-틸트-줌) 카메라인지 여부.

🔹ptz_presets: PTZ 프리셋 목록. "no"는 프리셋 번호, "title"은 프리셋 제목입니다.

🔹date_start: 녹화 시작 날짜 (문자열 형식 "yyyy-mm-dd").

🔹date_end: 녹화 종료 날짜 (문자열 형식 "yyyy-mm-dd").

🔹sub_channel_count: 서브 채널 수.

utils = vmspy.utils()
if not utils.init(address, port, access_id, access_pw):
    print(utils.get_error())

channels = utils.get_channel_list()
for ch in channels:
    print("Ch No:", ch.ch_no)       # 1
    print("Title:", ch.title)       # "Channel Title"
    print("Sub Channels:", ch.sub_channel_count) # 0
    print("Connected:", ch.is_connected) # True/False
    print("Recording:", ch.is_recording) # True/False
    print("Start:", ch.date_start)  # "2025-04-01"
    print("End:", ch.date_end)      # "2025-04-17"
    print("PTZ:", ch.is_ptz)        # True
    for p in ch.ptz_presets:
        print("-Preset No:", p.no)        # 1
        print("-Preset Title:", p.title)  # "Preset#1"

 

그룹 목록 가져오기

그룹 목록과 해당 멤버 채널을 가져옵니다.

🛠️ groups = get_group_list()

↩️ groups: 그룹 정보를 담은 객체 배열입니다. 각 객체는 다음 속성을 포함합니다:

🔹group_idx: 그룹 인덱스.

🔹title: 그룹 제목.

🔹channels: 채널 정보를 담은 객체 배열.

🔹ch_no: 채널 번호.

🔹title: 채널 제목.

utils = vmspy.utils()
if not utils.init(address, port, access_id, access_pw):
    print(utils.get_error())

groups = utils.get_group_list()
print(group_list)

for gr in groups:
    print("Group index:", gr.idx)  # 0
    print("Title:", gr.title)     # "Group Title"
    for ch in gr.channels:
        print("- ch no:", ch.ch_no) # 1
        print("- title:", ch.title) # "Channel Title"

 

녹화 날짜 가져오기

지정한 월의 녹화 날짜를 가져옵니다.

🛠️ dates = get_recording_dates(year, month)

➡️ year, month: 요청할 월을 지정합니다.

↩️ dates: 객체 배열입니다. 각 객체는 다음을 포함합니다:

🔹ch_no: 채널 번호.

🔹title: 채널 제목.

🔹dates: 녹화된 날짜 배열, 예) ["2026-03-19", "2026-03-20"].

utils = vmspy.utils()
if not utils.init(address, port, access_id, access_pw):
    print(utils.get_error())

recordingDates = utils.get_recording_dates(2026, 3)
for rcd in recordingDates:
    print("Channel No:", rcd.ch_no)     # 1
    print("Channel Title:", rcd.title)  # "Channel Title"
    for ds in rcd.dates:
        print("- Date:", ds)            # "2026-03-19"

 

녹화 시간 가져오기

특정 날짜의 녹화 시간을 가져옵니다.

🛠️ recording_times = get_recording_times(ch_no, year, month, day, sub_idx=0)

➡️ ch_no: 채널 번호.

➡️ year, month, day: 요청할 녹화 날짜를 지정합니다.

➡️ sub_idx: 채널 서브 인덱스, 기본값은 0.

↩️ recording_times: 객체 배열입니다. 각 객체는 다음 속성을 포함합니다:

🔹time: ISO-8601 형식의 녹화 시작 시간.

🔹timestamp: Unix 타임스탬프로 표현된 녹화 시작 시간.

🔹is_dst: 해당 시각이 DST인지 여부.

🔹duration: 녹화 시간(초 단위).

recordingTimes = utils.get_recording_times(1, 2025, 4, 18) # ch#1
for t in recordingTimes:
    print("Time:", t.time)            # 2026-03-20T11:22:45+09:00
    print("Timestamp:", t.timestamp)  # 1773973365
    print("DST:", t.is_dst)           # False
    print("Duration:", t.duration)    # 171

 

저장비디오 파일 가져오기

저장비디오 파일 목록을 가져옵니다.

🛠️ files = get_file_list()

↩️ files: 객체 배열입니다. 각 객체는 다음 속성을 포함합니다:

🔹file_id: 파일 ID.

🔹ch_no: 채널 번호.

🔹title: 채널 제목.

🔹time: ISO 8601 형식의 파일 시작 시간.

🔹timestamp: Unix 타임스탬프로 표현된 파일 시작 시간.

🔹is_dst: 해당 시각이 DST인지 여부.

🔹duration: 파일 재생 시간(초 단위).

🔹priority: 파일 우선순위 (0–5).

🔹filesize: 파일 크기.

utils = vmspy.utils()
if not utils.init(address, port, access_id, access_pw):
    print(utils.get_error())

files = utils.get_file_list()
for file in files:
    print("File ID:", file.file_id)     # 29513186
    print("Channel No:", file.ch_no)    # 1
    print("Channel Title:", file.title) # "Channel Title"
    print("Time:", file.time)           # 2026-02-11T15:23:17+09:00
    print("Timestamp:", file.timestamp) # 1770790997
    print("DST:", file.is_dst)          # False
    print("Duration:", file.duration)   # 16
    print("Priority:", file.priority)   # 0
    print("File size:", file.filesize)  # 11408614471

 

이벤트 가져오기

특정 날짜 및 채널의 이벤트를 가져옵니다.

🛠️ events = get_events(ch_no, year, month, day, num_days=1)

➡️ ch_no: 채널 번호. 0으로 설정하면 모든 채널의 이벤트를 검색합니다.

➡️ year, month, day: 요청할 날짜를 지정합니다.

➡️ num_days: 반환할 일 수(기본값: 1).

↩️ events: 객체 배열입니다. 각 객체는 다음 속성을 포함합니다:

🔹ch_no: 이벤트의 채널 번호.

🔹type: 이벤트 유형.

🔹time: ISO-8601 형식의 이벤트 시간.

🔹timestamp: Unix 타임스탬프로 표현된 이벤트 시간.

🔹is_dst: 해당 시각이 DST인지 여부.

🔹duration: 이벤트 지속 시간(초 단위).

utils = vmspy.utils()
if not utils.init(address, port, access_id, access_pw):
    print(utils.get_error())

events = utils.get_events(0, 2025, 4, 18, num_days=5) # 모든 채널에 대해 5일간의 이벤트를 검색
for e in events:
    print("Channel No:", e.ch_no)     # 1
    print("Event Type:", e.type)      # "MOTION"
    print("Time:", e.time)            # 2026-03-20T11:22:45+09:00
    print("Timestamp:", e.timestamp)  # 1773973365
    print("DST:", e.is_dst)           # False
    print("Duration:", e.duration)    # 11

 

PTZ 프리셋 위치로 이동

PTZ 카메라를 지정한 프리셋 위치로 이동시킵니다.

🛠️ ptz_preset_go(ch_no, preset_no)

➡️ ch_no: 채널 번호.

➡️ preset_no: 이동할 프리셋 번호.

if not utils.ptz_preset_go(1, 3):
    print(utils.get_error())

 

PTZ 프리셋 위치 가져오기

현재 PTZ 카메라의 프리셋 위치를 가져옵니다.

🛠️ preset = get_ptz_preset(ch_no)

➡️ ch_no: 채널 번호.

↩️ preset: 채널에 프리셋 위치가 설정되어 있지 않으면 `None`을 반환하고, 설정된 경우 다음 속성을 가진 객체를 반환합니다:

🔹no: 프리셋 번호.

🔹title: 프리셋 제목.

p = utils.get_ptz_preset(1)
if p == None:
    print("No prest position is set")
else:
    print(f"Preset position #{p.no}.{p.title} is set")

 

VMS 서버에서 라이브 채널 보기

지정한 채널의 라이브 비디오 이미지를 표시합니다.

🛠️ show_live(ch_no, sub_idx=0)

➡️ ch_no: 채널 번호.

➡️ sub_idx: 채널 서브 인덱스, 기본값은 0.

if not utils.show_live(1):
    print(utils.get_error())

 

VMS 서버에서 재생 채널 보기

지정한 시간과 채널의 재생 비디오 이미지를 표시합니다.

🛠️ show_playback(ch_no, year, month, day, hour, minute, second, sub_idx=0)

➡️ ch_no: 채널 번호.

➡️ year, month, day: 재생 날짜를 지정합니다.

➡️ hour, minute, second: 재생 시간을 지정합니다.

➡️ sub_idx: 채널 서브 인덱스, 기본값은 0.

if not utils.show_playback(1, 2025, 4, 18, 14, 30, 0):
    print(utils.get_error())

 

VMS 서버에서 그룹의 라이브 보기

지정한 그룹의 라이브 비디오 이미지를 VMS 서버에서 표시합니다.

🛠️ show_group_live(group_idx)

➡️ group_idx: 그룹 인덱스.

# VMS에서 첫 번째 그룹(group_idx=0) 표시
if not utils.show_group_live(0):
    print(utils.get_error())

 

VMS 서버에서 그룹의 재생비디오 보기

지정한 시간의 그룹 재생 비디오 이미지를 VMS 서버에서 표시합니다.

🛠️ show_group_playback(group_idx, year, month, day, hour, minute, second)

➡️ group_idx: 그룹 인덱스.

➡️ year, month, day: 재생 날짜를 지정합니다.

➡️ hour, minute, second: 재생 시간을 지정합니다.

# VMS에서 2025-04-18 14:30:00에 첫 번째 그룹(group_idx=0) 표시
if not utils.show_group_playback(0, 2025, 4, 18, 14, 30, 0):
    print(utils.get_error())

 

VMS 서버에서 저장비디오 파일 재생 보기

VMS 서버에서 지정한 저장비디오 파일의 재생 비디오 이미지를 표시합니다.

🛠️ show_file_playback(file_id, timestamp)

➡️ file_id: 파일 ID를 지정합니다.

➡️ timestamp: Unix 타임스탬프로 재생 시간을 지정합니다.

# VMS에서 Unix 타임스탬프 1770790997로 저장비디오 파일(file_id=29513186) 표시
if not utils.show_file_playback(29513186, 1770790997):
    print(utils.get_error())