py-tgcalls 2.0.0rc3__py3-none-any.whl → 2.0.0rc4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {py_tgcalls-2.0.0rc3.dist-info → py_tgcalls-2.0.0rc4.dist-info}/METADATA +2 -2
- {py_tgcalls-2.0.0rc3.dist-info → py_tgcalls-2.0.0rc4.dist-info}/RECORD +10 -10
- pytgcalls/__version__.py +1 -1
- pytgcalls/exceptions.py +7 -0
- pytgcalls/methods/stream/play.py +7 -3
- pytgcalls/methods/utilities/start.py +32 -7
- pytgcalls/scaffold.py +1 -0
- {py_tgcalls-2.0.0rc3.dist-info → py_tgcalls-2.0.0rc4.dist-info}/LICENSE +0 -0
- {py_tgcalls-2.0.0rc3.dist-info → py_tgcalls-2.0.0rc4.dist-info}/WHEEL +0 -0
- {py_tgcalls-2.0.0rc3.dist-info → py_tgcalls-2.0.0rc4.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: py-tgcalls
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.0rc4
|
|
4
4
|
Summary: UNKNOWN
|
|
5
5
|
Home-page: https://github.com/pytgcalls/pytgcalls
|
|
6
6
|
Author: Laky-64
|
|
@@ -22,7 +22,7 @@ Description-Content-Type: text/markdown
|
|
|
22
22
|
License-File: LICENSE
|
|
23
23
|
Requires-Dist: aiohttp (>=3.9.3)
|
|
24
24
|
Requires-Dist: deprecation
|
|
25
|
-
Requires-Dist: ntgcalls (>=1.2.0.
|
|
25
|
+
Requires-Dist: ntgcalls (>=1.2.0.b6)
|
|
26
26
|
Requires-Dist: psutil
|
|
27
27
|
Requires-Dist: screeninfo
|
|
28
28
|
Requires-Dist: setuptools
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
pytgcalls/__init__.py,sha256=TfZGf1enqqs50mBB406vygB6zYgn3vAjBYFUDO4Pviw,248
|
|
2
|
-
pytgcalls/__version__.py,sha256=
|
|
2
|
+
pytgcalls/__version__.py,sha256=TZk9uVn2m_Mjhob6LWvtgl022cEas816bZCaV4pwe-c,25
|
|
3
3
|
pytgcalls/environment.py,sha256=ctCHACvG6l8SdpPewSBhOvc70kbwpv18maC0TwLvZ08,1924
|
|
4
|
-
pytgcalls/exceptions.py,sha256=
|
|
4
|
+
pytgcalls/exceptions.py,sha256=0MmAktc53ajYAc7ThjD2tJ9PDyibUi0iHZMfUy2IoKs,4109
|
|
5
5
|
pytgcalls/ffmpeg.py,sha256=1GavkVf562Y_8cT4EZxxj_b7Y0-l8yyGkX0D5eUHeas,8520
|
|
6
6
|
pytgcalls/filters.py,sha256=cmFWhRkgjQMk1WQqnd-hOAvM6x3dufJ1xjQAEL1vKLQ,4409
|
|
7
7
|
pytgcalls/mtproto_required.py,sha256=6B-31p5qH_6oekUgypV4nK3hqPS6Nr-pA8S81wjnbaY,630
|
|
8
8
|
pytgcalls/mutex.py,sha256=fSsAL4NuB7esBG90k4eUX388Knpr1_76Mz5BZlkSC0w,1119
|
|
9
9
|
pytgcalls/pytgcalls.py,sha256=VI9aRwPE-Lo1lh18ByOnkFxf1_8tq2ECyz5igPo1r8w,1443
|
|
10
10
|
pytgcalls/pytgcalls_session.py,sha256=_BGJWvf7t3mki2DhlEPjh9cypvYuSFkMSxzTsfepwUk,2719
|
|
11
|
-
pytgcalls/scaffold.py,sha256=
|
|
11
|
+
pytgcalls/scaffold.py,sha256=d5NFFm-Ntlu07fpXOE_OI4ULrvNb3Y4WDtM0nsKjqk4,986
|
|
12
12
|
pytgcalls/statictypes.py,sha256=CdlqgQNhTZ_uTE8-B8m01fJ7TlD2B42EI2QBPxDdAtA,3842
|
|
13
13
|
pytgcalls/sync.py,sha256=IsOH3TD7cxUg_-zdGt12HoS8sBlXvcGayPZAoxxKM48,3396
|
|
14
14
|
pytgcalls/version_manager.py,sha256=egeGgvb66zWlLTMuw2U-b0x8MfnRzMm1xAEVN87HF5c,296
|
|
@@ -31,7 +31,7 @@ pytgcalls/methods/decorators/on_update.py,sha256=ZTL4YcQk0N4Ru56a5WItUvkSN5SAqr6
|
|
|
31
31
|
pytgcalls/methods/stream/__init__.py,sha256=_4j-CEby4_2Kadva86tFMC4GSSzhBBjKLXfrgTk4gzo,343
|
|
32
32
|
pytgcalls/methods/stream/mute_stream.py,sha256=auo2aAazfEC90Ab6MzaiPdddiJ1w4fN_9HaORkAeOBY,570
|
|
33
33
|
pytgcalls/methods/stream/pause_stream.py,sha256=z_AIWABrQMHmTwvlah_PrH9EjXbro8gKxZni4Km5ICg,573
|
|
34
|
-
pytgcalls/methods/stream/play.py,sha256=
|
|
34
|
+
pytgcalls/methods/stream/play.py,sha256=acuav8C9wEyur8FMAT7zFxkEvNDu45gnodUmGFrfIKA,7376
|
|
35
35
|
pytgcalls/methods/stream/played_time.py,sha256=IkUdyHrqpzpRl9uf0uZhg1COo4zsHnQOPu3nipjVatI,570
|
|
36
36
|
pytgcalls/methods/stream/resume_stream.py,sha256=z_DgP4cDExjEqEeX_ZL--50MXQ9lrATK876SIwE71PQ,576
|
|
37
37
|
pytgcalls/methods/stream/unmute_stream.py,sha256=KUMhfMbhsPmZsmpF4cGWC1FVW7YwXha2MmQnqrBhM8s,576
|
|
@@ -44,7 +44,7 @@ pytgcalls/methods/utilities/idle.py,sha256=lkjbYzpU7iz-maE0kS6RVtHJ4h1PsmGqnZmaE
|
|
|
44
44
|
pytgcalls/methods/utilities/ping.py,sha256=hhIMSHk2BzMB-IKpwLdZFVrsEvGm2ftJwKLs1k4anh8,244
|
|
45
45
|
pytgcalls/methods/utilities/resolve_chat_id.py,sha256=92x2LHbUlnJMm-kS3fXOYmzYpY2TZbqtQD2rw3eBXDY,382
|
|
46
46
|
pytgcalls/methods/utilities/run.py,sha256=cnYQd2xB5Cr_WS0Q2cXJZPGiN6JOCULzj1r4xXVyrlg,152
|
|
47
|
-
pytgcalls/methods/utilities/start.py,sha256=
|
|
47
|
+
pytgcalls/methods/utilities/start.py,sha256=0TjW64IDYulevNTJIp4ZHWa9pkKCcgeyFhL47PehoqI,8534
|
|
48
48
|
pytgcalls/methods/utilities/stream_params.py,sha256=hYcNxx__McmPeHgOUDEuNcN7ThgDjukejQYHrfmWm-A,1519
|
|
49
49
|
pytgcalls/mtproto/__init__.py,sha256=X4zvzFG7km7qHyE0fdvA550WcOVO_xl_p__gvIfDGmw,130
|
|
50
50
|
pytgcalls/mtproto/bridged_client.py,sha256=kK22n-CKjtfmtNE6bXCpuL6kWAUK2_Ul7cGgx_HNuHQ,4975
|
|
@@ -86,8 +86,8 @@ pytgcalls/types/stream/media_stream.py,sha256=vH32FrwdMSA9-S54bvessVHewh_l-5WXqu
|
|
|
86
86
|
pytgcalls/types/stream/stream_audio_ended.py,sha256=2_EFa98F0vWu0d0jBmLtzp4NH_xBkDO_6yP9UtyKuCs,164
|
|
87
87
|
pytgcalls/types/stream/stream_video_ended.py,sha256=9YFTTZPMDpB95eb815rGtgDrzBGfTeazJ5mZwP6Hvks,164
|
|
88
88
|
pytgcalls/types/stream/video_quality.py,sha256=HBfWq005kh-D19MaVE9VzVdnODzrXf4IJUimCfslfiU,231
|
|
89
|
-
py_tgcalls-2.0.
|
|
90
|
-
py_tgcalls-2.0.
|
|
91
|
-
py_tgcalls-2.0.
|
|
92
|
-
py_tgcalls-2.0.
|
|
93
|
-
py_tgcalls-2.0.
|
|
89
|
+
py_tgcalls-2.0.0rc4.dist-info/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
|
|
90
|
+
py_tgcalls-2.0.0rc4.dist-info/METADATA,sha256=WRIeNUG7mRIALS23Oi0h_2bzY5o0eLfzuQAZpjaATtg,4886
|
|
91
|
+
py_tgcalls-2.0.0rc4.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
|
92
|
+
py_tgcalls-2.0.0rc4.dist-info/top_level.txt,sha256=IUDUwn0KkcbUYZbCe9R5AUb2Ob-lmllNUGQqyeXXd8A,10
|
|
93
|
+
py_tgcalls-2.0.0rc4.dist-info/RECORD,,
|
pytgcalls/__version__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '2.0.
|
|
1
|
+
__version__ = '2.0.0rc4'
|
pytgcalls/exceptions.py
CHANGED
|
@@ -72,6 +72,13 @@ class CallDeclined(Exception):
|
|
|
72
72
|
)
|
|
73
73
|
|
|
74
74
|
|
|
75
|
+
class CallDiscarded(Exception):
|
|
76
|
+
def __init__(self, user_id: int):
|
|
77
|
+
super().__init__(
|
|
78
|
+
f'Call discarded by {user_id}',
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
|
|
75
82
|
class NotInCallError(Exception):
|
|
76
83
|
def __init__(self):
|
|
77
84
|
super().__init__(
|
pytgcalls/methods/stream/play.py
CHANGED
|
@@ -37,10 +37,10 @@ class Play(Scaffold):
|
|
|
37
37
|
config: Optional[Union[CallConfig, GroupCallConfig]] = None,
|
|
38
38
|
):
|
|
39
39
|
chat_id = await self.resolve_chat_id(chat_id)
|
|
40
|
-
is_p2p = chat_id
|
|
40
|
+
is_p2p = chat_id > 0 # type: ignore
|
|
41
41
|
if config is None:
|
|
42
|
-
config = GroupCallConfig() if is_p2p else CallConfig()
|
|
43
|
-
if is_p2p and not isinstance(config, GroupCallConfig):
|
|
42
|
+
config = GroupCallConfig() if not is_p2p else CallConfig()
|
|
43
|
+
if not is_p2p and not isinstance(config, GroupCallConfig):
|
|
44
44
|
raise ValueError(
|
|
45
45
|
'Group call config must be provided for group calls',
|
|
46
46
|
)
|
|
@@ -78,6 +78,7 @@ class Play(Scaffold):
|
|
|
78
78
|
try:
|
|
79
79
|
for retries in range(4):
|
|
80
80
|
try:
|
|
81
|
+
self._wait_connect[chat_id] = self.loop.create_future()
|
|
81
82
|
if isinstance(config, GroupCallConfig):
|
|
82
83
|
call_params: str = await self._binding.create_call(
|
|
83
84
|
chat_id,
|
|
@@ -148,6 +149,7 @@ class Play(Scaffold):
|
|
|
148
149
|
raise TimedOutAnswer()
|
|
149
150
|
finally:
|
|
150
151
|
self._p2p_configs.pop(chat_id, None)
|
|
152
|
+
await self._wait_connect[chat_id]
|
|
151
153
|
break
|
|
152
154
|
except TelegramServerError:
|
|
153
155
|
if retries == 3 or is_p2p:
|
|
@@ -162,6 +164,8 @@ class Play(Scaffold):
|
|
|
162
164
|
except ConnectionNotFound:
|
|
163
165
|
pass
|
|
164
166
|
raise
|
|
167
|
+
finally:
|
|
168
|
+
self._wait_connect.pop(chat_id, None)
|
|
165
169
|
|
|
166
170
|
if isinstance(config, GroupCallConfig):
|
|
167
171
|
participants = await self._app.get_group_call_participants(
|
|
@@ -2,10 +2,13 @@ import asyncio
|
|
|
2
2
|
import logging
|
|
3
3
|
|
|
4
4
|
from ntgcalls import ConnectionNotFound
|
|
5
|
+
from ntgcalls import ConnectionState
|
|
5
6
|
from ntgcalls import MediaState
|
|
6
7
|
from ntgcalls import StreamType
|
|
8
|
+
from ntgcalls import TelegramServerError
|
|
7
9
|
|
|
8
10
|
from ...exceptions import CallDeclined
|
|
11
|
+
from ...exceptions import CallDiscarded
|
|
9
12
|
from ...exceptions import PyTgCallsAlreadyRunning
|
|
10
13
|
from ...mtproto import BridgedClient
|
|
11
14
|
from ...pytgcalls_session import PyTgCallsSession
|
|
@@ -41,6 +44,15 @@ class Start(Scaffold):
|
|
|
41
44
|
chat_id,
|
|
42
45
|
),
|
|
43
46
|
)
|
|
47
|
+
if chat_id in self._wait_connect and \
|
|
48
|
+
not self._wait_connect[chat_id].done():
|
|
49
|
+
if isinstance(update, ChatUpdate):
|
|
50
|
+
if update.status & ChatUpdate.Status.DISCARDED_CALL:
|
|
51
|
+
self._wait_connect[chat_id].set_exception(
|
|
52
|
+
CallDiscarded(
|
|
53
|
+
chat_id,
|
|
54
|
+
),
|
|
55
|
+
)
|
|
44
56
|
if isinstance(update, RawCallUpdate):
|
|
45
57
|
if update.status & RawCallUpdate.Type.REQUESTED:
|
|
46
58
|
self._p2p_configs[chat_id] = CallData(
|
|
@@ -130,10 +142,23 @@ class Start(Scaffold):
|
|
|
130
142
|
data,
|
|
131
143
|
)
|
|
132
144
|
|
|
133
|
-
async def
|
|
134
|
-
if chat_id
|
|
135
|
-
|
|
136
|
-
|
|
145
|
+
async def connection_changed(chat_id: int, state: ConnectionState):
|
|
146
|
+
if chat_id in self._wait_connect:
|
|
147
|
+
if state == ConnectionState.CONNECTED:
|
|
148
|
+
self._wait_connect[chat_id].set_result(None)
|
|
149
|
+
elif state == ConnectionState.FAILED or\
|
|
150
|
+
state == ConnectionState.TIMEOUT:
|
|
151
|
+
self._wait_connect[chat_id].set_exception(
|
|
152
|
+
TelegramServerError(),
|
|
153
|
+
)
|
|
154
|
+
await clear_call(chat_id)
|
|
155
|
+
|
|
156
|
+
if state == ConnectionState.FAILED or \
|
|
157
|
+
state == ConnectionState.TIMEOUT or \
|
|
158
|
+
state == ConnectionState.CLOSED:
|
|
159
|
+
if chat_id > 0:
|
|
160
|
+
await self._app.discard_call(chat_id)
|
|
161
|
+
await clear_call(chat_id)
|
|
137
162
|
|
|
138
163
|
async def clear_cache(chat_id: int):
|
|
139
164
|
self._p2p_configs.pop(chat_id, None)
|
|
@@ -172,9 +197,9 @@ class Start(Scaffold):
|
|
|
172
197
|
self.loop,
|
|
173
198
|
),
|
|
174
199
|
)
|
|
175
|
-
self._binding.
|
|
176
|
-
lambda chat_id: asyncio.run_coroutine_threadsafe(
|
|
177
|
-
|
|
200
|
+
self._binding.on_connection_change(
|
|
201
|
+
lambda chat_id, state: asyncio.run_coroutine_threadsafe(
|
|
202
|
+
connection_changed(chat_id, state),
|
|
178
203
|
self.loop,
|
|
179
204
|
),
|
|
180
205
|
)
|
pytgcalls/scaffold.py
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|