mirror of
https://github.com/fastogt/fastocloud_admin.git
synced 2025-03-09 23:38:52 +00:00
Get own channels
This commit is contained in:
parent
dc69a69544
commit
269c3641b4
2 changed files with 23 additions and 22 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit 62826671083c4d29d68793384416e6c7bb77ed1e
|
Subproject commit 83272b64f2bc59ac84d655fac19cb832d54c591d
|
|
@ -107,6 +107,27 @@ class SubscribersServiceManager(ServiceManager, IClientHandler):
|
||||||
def on_client_state_changed(self, client, status: ClientStatus):
|
def on_client_state_changed(self, client, status: ClientStatus):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def get_watchers_by_stream_id(self, sid: str):
|
||||||
|
total = 0
|
||||||
|
for user in self._subscribers:
|
||||||
|
if user.current_stream_id == sid:
|
||||||
|
total += 1
|
||||||
|
|
||||||
|
return total
|
||||||
|
|
||||||
|
def get_user_connections_by_email(self, email) -> list:
|
||||||
|
connections = []
|
||||||
|
for user in self._subscribers:
|
||||||
|
if user.info and user.info.email == email:
|
||||||
|
connections.append(user)
|
||||||
|
|
||||||
|
return connections
|
||||||
|
|
||||||
|
def send_message(self, email: str, message: PlayerMessage):
|
||||||
|
for user in self._subscribers:
|
||||||
|
if user.info and user.info.email == email:
|
||||||
|
user.send_message(user.gen_request_id(), message.message, message.type, message.ttl * 1000)
|
||||||
|
|
||||||
# protected
|
# protected
|
||||||
|
|
||||||
def _handle_server_ping_command(self, client, resp: Response):
|
def _handle_server_ping_command(self, client, resp: Response):
|
||||||
|
@ -177,6 +198,7 @@ class SubscribersServiceManager(ServiceManager, IClientHandler):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
channels = client.info.get_streams()
|
channels = client.info.get_streams()
|
||||||
|
own_channels = client.info.get_own_streams()
|
||||||
return client.get_channels_success(cid, channels)
|
return client.get_channels_success(cid, channels)
|
||||||
|
|
||||||
def _handle_get_runtime_channel_info(self, client, cid: str, params: dict) -> bool:
|
def _handle_get_runtime_channel_info(self, client, cid: str, params: dict) -> bool:
|
||||||
|
@ -189,27 +211,6 @@ class SubscribersServiceManager(ServiceManager, IClientHandler):
|
||||||
client.current_stream_id = sid
|
client.current_stream_id = sid
|
||||||
return client.get_runtime_channel_info_success(cid, sid, watchers)
|
return client.get_runtime_channel_info_success(cid, sid, watchers)
|
||||||
|
|
||||||
def get_watchers_by_stream_id(self, sid: str):
|
|
||||||
total = 0
|
|
||||||
for user in self._subscribers:
|
|
||||||
if user.current_stream_id == sid:
|
|
||||||
total += 1
|
|
||||||
|
|
||||||
return total
|
|
||||||
|
|
||||||
def get_user_connections_by_email(self, email) -> list:
|
|
||||||
connections = []
|
|
||||||
for user in self._subscribers:
|
|
||||||
if user.info and user.info.email == email:
|
|
||||||
connections.append(user)
|
|
||||||
|
|
||||||
return connections
|
|
||||||
|
|
||||||
def send_message(self, email: str, message: PlayerMessage):
|
|
||||||
for user in self._subscribers:
|
|
||||||
if user.info and user.info.email == email:
|
|
||||||
user.send_message(user.gen_request_id(), message.message, message.type, message.ttl * 1000)
|
|
||||||
|
|
||||||
# private
|
# private
|
||||||
def __close_subscriber(self, subs: SubscriberConnection):
|
def __close_subscriber(self, subs: SubscriberConnection):
|
||||||
self.__remove_subscriber(subs)
|
self.__remove_subscriber(subs)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue