mirror of
https://github.com/facefusion/facefusion.git
synced 2026-07-15 06:27:21 +02:00
460c65004b
* remove sleep with available event * reorder methods, caller has to follow variable names of consumer, reorder tests methods * more todos for naming
34 lines
646 B
Python
34 lines
646 B
Python
from typing import List
|
|
|
|
from facefusion import rtc
|
|
from facefusion.types import RtcPeer, RtcStore, SessionId
|
|
|
|
RTC_STORE : RtcStore = {}
|
|
|
|
|
|
def init_peers(session_id : SessionId) -> None:
|
|
RTC_STORE[session_id] = []
|
|
|
|
|
|
def has_peers(session_id : SessionId) -> bool:
|
|
return bool(RTC_STORE.get(session_id))
|
|
|
|
|
|
def get_peers(session_id : SessionId) -> List[RtcPeer]:
|
|
return RTC_STORE.get(session_id)
|
|
|
|
|
|
def delete_peers(session_id : SessionId) -> None:
|
|
if session_id in RTC_STORE:
|
|
rtc_peers = get_peers(session_id)
|
|
|
|
if rtc_peers:
|
|
rtc.delete_peers(rtc_peers)
|
|
del RTC_STORE[session_id]
|
|
|
|
return None
|
|
|
|
|
|
def clear() -> None:
|
|
RTC_STORE.clear()
|