py-tgcalls 2.1.0rc7__py3-none-any.whl → 2.1.2b1__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.
Files changed (46) hide show
  1. py_tgcalls-2.1.2b1.dist-info/METADATA +126 -0
  2. {py_tgcalls-2.1.0rc7.dist-info → py_tgcalls-2.1.2b1.dist-info}/RECORD +44 -29
  3. {py_tgcalls-2.1.0rc7.dist-info → py_tgcalls-2.1.2b1.dist-info}/WHEEL +1 -1
  4. pytgcalls/__version__.py +1 -1
  5. pytgcalls/exceptions.py +7 -31
  6. pytgcalls/methods/__init__.py +2 -0
  7. pytgcalls/methods/calls/leave_call.py +1 -1
  8. pytgcalls/methods/internal/__init__.py +35 -0
  9. pytgcalls/methods/internal/clear_cache.py +8 -0
  10. pytgcalls/methods/internal/clear_call.py +20 -0
  11. pytgcalls/methods/internal/connect_call.py +133 -0
  12. pytgcalls/methods/internal/emit_sig_data.py +9 -0
  13. pytgcalls/methods/internal/handle_connection_changed.py +27 -0
  14. pytgcalls/methods/internal/handle_mtproto_updates.py +175 -0
  15. pytgcalls/methods/internal/handle_stream_ended.py +23 -0
  16. pytgcalls/methods/internal/handle_stream_frame.py +41 -0
  17. pytgcalls/methods/internal/join_presentation.py +58 -0
  18. pytgcalls/methods/internal/request_broadcast_part.py +42 -0
  19. pytgcalls/methods/internal/request_broadcast_timestamp.py +25 -0
  20. pytgcalls/methods/internal/switch_connection.py +35 -0
  21. pytgcalls/methods/internal/update_status.py +22 -0
  22. pytgcalls/methods/stream/play.py +7 -106
  23. pytgcalls/methods/stream/record.py +0 -6
  24. pytgcalls/methods/utilities/__init__.py +0 -6
  25. pytgcalls/methods/utilities/start.py +23 -289
  26. pytgcalls/mtproto/bridged_client.py +30 -8
  27. pytgcalls/mtproto/hydrogram_client.py +77 -5
  28. pytgcalls/mtproto/mtproto_client.py +37 -4
  29. pytgcalls/mtproto/pyrogram_client.py +81 -9
  30. pytgcalls/mtproto/telethon_client.py +77 -5
  31. pytgcalls/mutex.py +13 -1
  32. pytgcalls/pytgcalls.py +3 -0
  33. pytgcalls/scaffold.py +79 -0
  34. pytgcalls/types/__init__.py +2 -0
  35. pytgcalls/types/calls/__init__.py +2 -0
  36. pytgcalls/types/calls/pending_connection.py +17 -0
  37. pytgcalls/types/chats/chat_update.py +8 -1
  38. pytgcalls/types/py_object.py +9 -10
  39. pytgcalls/types/stream/media_stream.py +1 -1
  40. pytgcalls/wait_counter_lock.py +20 -0
  41. py_tgcalls-2.1.0rc7.dist-info/METADATA +0 -292
  42. pytgcalls/methods/utilities/join_presentation.py +0 -50
  43. {py_tgcalls-2.1.0rc7.dist-info → py_tgcalls-2.1.2b1.dist-info/licenses}/LICENSE +0 -0
  44. {py_tgcalls-2.1.0rc7.dist-info → py_tgcalls-2.1.2b1.dist-info}/top_level.txt +0 -0
  45. /pytgcalls/methods/{utilities → internal}/log_retries.py +0 -0
  46. /pytgcalls/methods/{utilities → internal}/update_sources.py +0 -0
@@ -0,0 +1,126 @@
1
+ Metadata-Version: 2.4
2
+ Name: py-tgcalls
3
+ Version: 2.1.2b1
4
+ Summary: Async client API for the Telegram Calls.
5
+ Author-email: Laky-64 <iraci.matteo@gmail.com>
6
+ Project-URL: Homepage, https://pytgcalls.github.io/
7
+ Project-URL: Repository, https://github.com/pytgcalls/pytgcalls.git
8
+ Project-URL: Documentation, https://pytgcalls.github.io/PyTgCalls
9
+ Project-URL: Changelog, https://pytgcalls.github.io/PyTgCalls/Changelogs
10
+ Keywords: audio,python,library,video,telegram,stream,ffmpeg,cpp,webrtc,voice-chat,voip,group-chat,video-calls,calls,video-chat,pytgcalls,ntgcalls,tgcalls,py-tgcalls,pyrogram,telethon,hydrogram
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Requires-Python: >=3.9
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: aiohttp>=3.9.3
23
+ Requires-Dist: ntgcalls<1.4.0,>=1.3.5b1
24
+ Requires-Dist: deprecation
25
+ Provides-Extra: pyrogram
26
+ Requires-Dist: pyrogram>=1.2.20; extra == "pyrogram"
27
+ Provides-Extra: telethon
28
+ Requires-Dist: telethon>=1.24.0; extra == "telethon"
29
+ Provides-Extra: hydrogram
30
+ Requires-Dist: hydrogram>=0.1.4; extra == "hydrogram"
31
+ Dynamic: license-file
32
+
33
+ <img src="https://raw.githubusercontent.com/pytgcalls/pytgcalls/master/.github/images/banner.png" alt="pytgcalls logo" />
34
+ <p align="center">
35
+ <b>A simple and elegant client that allows you to make group voice calls quickly and easily.</b>
36
+ <br>
37
+ <a href="https://github.com/pytgcalls/pytgcalls/tree/master/example">
38
+ Examples
39
+ </a>
40
+
41
+ <a href="https://pytgcalls.github.io/">
42
+ Documentation
43
+ </a>
44
+
45
+ <a href="https://pypi.org/project/py-tgcalls/">
46
+ PyPi
47
+ </a>
48
+
49
+ <a href="https://t.me/pytgcallsnews">
50
+ Channel
51
+ </a>
52
+
53
+ <a href="https://t.me/pytgcallschat">
54
+ Chat
55
+ </a>
56
+ </p>
57
+
58
+ # PyTgCalls [![PyPI](https://img.shields.io/pypi/v/py-tgcalls.svg?logo=python&logoColor=%23959DA5&label=pypi&labelColor=%23282f37)](https://pypi.org/project/py-tgcalls/) [![Downloads](https://img.shields.io/pepy/dt/py-tgcalls?logoColor=%23959DA5&labelColor=%23282f37&color=%2328A745)](https://pepy.tech/project/py-tgcalls)
59
+ This project allows making Telegram call using MtProto and WebRTC, this is possible thanks to the power of [NTgCalls] library and [@evgeny-nadymov]
60
+
61
+ #### Example Usage
62
+ ```python
63
+ from pytgcalls import PyTgCalls
64
+ from pytgcalls import idle
65
+ ...
66
+ chat_id = -1001185324811
67
+ app = PyTgCalls(client)
68
+ app.start()
69
+ app.play(
70
+ chat_id,
71
+ 'http://docs.evostream.com/sample_content/assets/sintel1m720p.mp4',
72
+ )
73
+ idle()
74
+ ```
75
+
76
+ ## Features
77
+ - Prebuilt wheels for macOS, Linux and Windows.
78
+ - Supporting all type of MTProto libraries: Pyrogram, Telethon and Hydrogram.
79
+ - Work with voice chats in channels and chats.
80
+ - Join as channels or chats.
81
+ - Mute/unmute, pause/resume, stop/play, volume control and more...
82
+
83
+ ## Requirements
84
+ - Python 3.9 or higher.
85
+ - An MTProto Client
86
+ - A [Telegram API key](https://docs.pyrogram.org/intro/setup#api-keys).
87
+
88
+ ## How to install?
89
+ Here's how to install the PyTgCalls lib, the commands are given below:
90
+
91
+ ``` bash
92
+ # With Git
93
+ pip install git+https://github.com/pytgcalls/pytgcalls -U
94
+
95
+ # With PyPi (Recommended)
96
+ pip install py-tgcalls -U
97
+ ```
98
+
99
+ ## Key Contributors
100
+ * <b><a href="https://github.com/Laky-64">@Laky-64</a> (DevOps Engineer, Software Architect):</b>
101
+ * Played a crucial role in developing PyTgCalls being an ex developer of pyservercall and of tgcallsjs.
102
+ * Automation with GitHub Actions
103
+ * <b><a href="https://github.com/kuogi">@kuogi</a> (Senior UI/UX designer, Documenter):</b>
104
+ * As a Senior UI/UX Designer, Kuogi has significantly improved the user interface of our documentation,
105
+ making it more visually appealing and user-friendly.
106
+ * Played a key role in writing and structuring our documentation, ensuring that it is clear,
107
+ informative, and accessible to all users.
108
+ * <b><a href="https://github.com/vrumger">@vrumger</a> (Senior Node.js Developer, Software Architect):</b>
109
+ * Has made important fixes and enhancements to the WebRTC component of the library,
110
+ improving its stability and performance.
111
+ * Main developer of TgCallsJS
112
+ * <b><a href="https://github.com/alemidev">@alemidev</a> (Senior Python Developer):</b>
113
+ * Has made important fixes and enhancements to the async part of the library
114
+
115
+ ## Junior Developers
116
+ * <b><a href="https://github.com/TuriOG">@TuriOG</a> (Junior Python Developer):</b>
117
+ * Currently working on integrating NTgCalls into <a href="//github.com/pytgcalls/pytgcalls">PyTgCalls</a>, an important step
118
+ in expanding the functionality and usability of the library.
119
+
120
+ ## Special Thanks
121
+ * <b><a href="https://github.com/evgeny-nadymov">@evgeny-nadymov</a>:</b>
122
+ A heartfelt thank you to Evgeny Nadymov for graciously allowing us to use their code from telegram-react.
123
+ His contribution has been pivotal to the success of this project.
124
+
125
+ [NTgCalls]: https://github.com/pytgcalls/ntgcalls
126
+ [@evgeny-nadymov]: https://github.com/evgeny-nadymov/
@@ -1,17 +1,19 @@
1
+ py_tgcalls-2.1.2b1.dist-info/licenses/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
1
2
  pytgcalls/__init__.py,sha256=qbfwN7rYwIdCegMOzdcbvwazeNjDzgmowgcqLFNqKIM,308
2
- pytgcalls/__version__.py,sha256=sHPVCG9vm1uyYD2Lwwg8Z_oKmpyxUnjDJ487XMAemkM,26
3
+ pytgcalls/__version__.py,sha256=kvDoewJAYHho5O8mY2N051qMPx4teq8KxOdVpZY5OZI,24
3
4
  pytgcalls/environment.py,sha256=ctCHACvG6l8SdpPewSBhOvc70kbwpv18maC0TwLvZ08,1924
4
- pytgcalls/exceptions.py,sha256=dBKyH--HyEJk6-DzfzXvG3M1fuDSRuF2LWu7XKhV-WY,4263
5
+ pytgcalls/exceptions.py,sha256=Rijc-8T93WEWJxNW9jncU8_M6mYZZZcs8F2bqitEIeI,3787
5
6
  pytgcalls/ffmpeg.py,sha256=tm6DBxyNfPh3h3an-b2s9x1UyX-cvkCdov9prlXxVZY,8649
6
7
  pytgcalls/filters.py,sha256=qTFDlt-23xnMh_Ug2WmmOUf13JPX6_yacrv7c3F9Pp0,6125
7
8
  pytgcalls/mtproto_required.py,sha256=6B-31p5qH_6oekUgypV4nK3hqPS6Nr-pA8S81wjnbaY,630
8
- pytgcalls/mutex.py,sha256=Frjji5Ctzlk4AXEBuBLnDK-7HbtreoV6zuyKpFpMNI4,236
9
- pytgcalls/pytgcalls.py,sha256=oBcWgBwusnXmjHrLEE99VVXARReVyrXdn9SyeBWHbVo,1479
9
+ pytgcalls/mutex.py,sha256=6hOwGnUTNUJliJ1GGhk47D0A3KEn8eVd-kjZq_1DdZY,670
10
+ pytgcalls/pytgcalls.py,sha256=DxCE0--mb53vyDXLLBAwy1cPrJgLsyC9rba_h2OzR2o,1608
10
11
  pytgcalls/pytgcalls_session.py,sha256=_BGJWvf7t3mki2DhlEPjh9cypvYuSFkMSxzTsfepwUk,2719
11
- pytgcalls/scaffold.py,sha256=SwePuT9V8LdOFy0KRlAnRSbsB2zeGQ4fs9ilrq7HZYI,1353
12
+ pytgcalls/scaffold.py,sha256=Gahln5l70FJZwo1KGqv1A7K9Vn_ozAATpADGFJuPhKA,3162
12
13
  pytgcalls/statictypes.py,sha256=CdlqgQNhTZ_uTE8-B8m01fJ7TlD2B42EI2QBPxDdAtA,3842
13
14
  pytgcalls/sync.py,sha256=IsOH3TD7cxUg_-zdGt12HoS8sBlXvcGayPZAoxxKM48,3396
14
15
  pytgcalls/version_manager.py,sha256=egeGgvb66zWlLTMuw2U-b0x8MfnRzMm1xAEVN87HF5c,296
16
+ pytgcalls/wait_counter_lock.py,sha256=J-KCWUBCt7ktKQKyIseNG0RfXDVRh-h0wKhaZlf4aFs,437
15
17
  pytgcalls/ytdlp.py,sha256=jRA-mKQEXleWvaoGv9wtMa77aRjxsyQxn6_0tXI3-sA,2435
16
18
  pytgcalls/custom_api/__init__.py,sha256=ZT8d0lc2YrDuw_YSFAXXHHMewoXGFZ-ANOBIAr0vGFQ,60
17
19
  pytgcalls/custom_api/custom_api.py,sha256=Ko3aS6psrwPmOhRPxvG0fepXt4STrA0StvINSxz4Cj8,1890
@@ -23,63 +25,77 @@ pytgcalls/media_devices/input_device.py,sha256=-Z5hjhdc1Y68mZQpVW-QgMePKGe_c5zJc
23
25
  pytgcalls/media_devices/media_devices.py,sha256=ZgRF8j4jCJNWrW1HCUUWZMcZ9V7LOcvm_jJmy8g7ieQ,1333
24
26
  pytgcalls/media_devices/screen_device.py,sha256=B1MCpcqW-QXKcVafNdPQfd2Es6-ejkX2NdwbfuYmhv4,201
25
27
  pytgcalls/media_devices/speaker_device.py,sha256=39aAE2oEvlhRiUwHlIJCrSUPWIy-8J9_oq1TmCq5IjA,200
26
- pytgcalls/methods/__init__.py,sha256=hk1blAT5u_Isemdrg0nqInLsdRzTTZnak5NdAfkBPAk,217
28
+ pytgcalls/methods/__init__.py,sha256=KKnG3uI_3oKKBByQ96kHJiabjxk2J6YLs4HDfOKvQ0A,262
27
29
  pytgcalls/methods/calls/__init__.py,sha256=xg4DZZClEnxwaj-DAq3e8gSR-g-MiYBdUEBth64lSXA,214
28
30
  pytgcalls/methods/calls/change_volume_call.py,sha256=xMUszg44Gs1RgTXGCwcWEESnwu3XVkW8Kx9HGLDGSEo,842
29
31
  pytgcalls/methods/calls/get_participants.py,sha256=HDEMwZwNZM7KSb76P5XVH46qNONvBEVg4x_e-rgJscI,716
30
- pytgcalls/methods/calls/leave_call.py,sha256=ay07za5mNKmXGzmpeU6gJJmHVrLeXRtRmFT4QP94pGA,1475
32
+ pytgcalls/methods/calls/leave_call.py,sha256=Q7v0xT_CjbMIUBrugtvKbZqbSgmw5laMQYVhrMcaD1U,1475
31
33
  pytgcalls/methods/decorators/__init__.py,sha256=TCGaEVZnHjtOwv-3PNfaCVm0kyFhJApUPUNntt6MwyM,78
32
34
  pytgcalls/methods/decorators/on_update.py,sha256=ZTL4YcQk0N4Ru56a5WItUvkSN5SAqr6_RDZvXmZMIHs,316
35
+ pytgcalls/methods/internal/__init__.py,sha256=fcgIxUJKT6QJD30ltnOfzKsLhzTTTklD2qxKlwCvyv0,1057
36
+ pytgcalls/methods/internal/clear_cache.py,sha256=qgG-oubmdtnefnXSiHSPHyBTyXypiLDC7G8l3FzjNw8,236
37
+ pytgcalls/methods/internal/clear_call.py,sha256=yElvn3i6_j14Q7n9kcLSl-muYAGcaIZaEFHdp6MrN0g,549
38
+ pytgcalls/methods/internal/connect_call.py,sha256=2DRmsILPyGNxV2880tVsQ2XUwd89iSIqVWHl5AkgEaE,5393
39
+ pytgcalls/methods/internal/emit_sig_data.py,sha256=ucIsknhJHB-0x7lcymXvwQ647AJQ852zH2W6MdlC3ws,216
40
+ pytgcalls/methods/internal/handle_connection_changed.py,sha256=_1u3J6_Pjl1Gs1u_WkhG2FAUl_hxlHUiflaMkKkJDsc,866
41
+ pytgcalls/methods/internal/handle_mtproto_updates.py,sha256=Ev2Jake6Z_SrBodnjO5N16YiYaEY3Ti4tkU1pKOsJVM,7747
42
+ pytgcalls/methods/internal/handle_stream_ended.py,sha256=DllD1ZfGQbwVh-S0neocwnN-8lQtwwyrzWl9teSrZbY,561
43
+ pytgcalls/methods/internal/handle_stream_frame.py,sha256=_FA782qlOT3tUqnySm7RBpjbgfEEzt1oEBDm-iADsbQ,1145
44
+ pytgcalls/methods/internal/join_presentation.py,sha256=dLB2kolIIm2KQH8yBQbEPJi_y1_cVLWpE52_Rwjn_KE,2178
45
+ pytgcalls/methods/internal/log_retries.py,sha256=6nD9J3350t82I0PKzK1pVx3ZaCBHATReiXYMs3PuVhQ,342
46
+ pytgcalls/methods/internal/request_broadcast_part.py,sha256=oh-SqMCuQQErpF9Gd8ubPDoZeaz4bKw0dK--JrjXK9s,1313
47
+ pytgcalls/methods/internal/request_broadcast_timestamp.py,sha256=yEEmtyLR-EsEO1aXMcRAD34LRH63gY6ZQvn_Sw9quLk,642
48
+ pytgcalls/methods/internal/switch_connection.py,sha256=Yyh7vJLgoR_jZNpUbOKTiXSt2KkpKPmyr20heSJncn0,1221
49
+ pytgcalls/methods/internal/update_sources.py,sha256=ISF6u3rk4IcVrPOEOB-uZUDfnwUp2_y1_2g9GboXpWM,1562
50
+ pytgcalls/methods/internal/update_status.py,sha256=6zH7oMM_qPE-88mdC5CBhT07gPvayBrmMAvDWwCDFtc,608
33
51
  pytgcalls/methods/stream/__init__.py,sha256=mAcOih0-NT6T_Gspej6mySpJNPuEe46sUwgKV3vSvYM,336
34
52
  pytgcalls/methods/stream/mute.py,sha256=ZrZS_EeNUeUxb6UgbdhwXUdRX826u-qSjH5a6sg7LsE,557
35
53
  pytgcalls/methods/stream/pause.py,sha256=-kNvWQuv5VlssNcL-M6rkT5TKFmXlbOzJrDny95qsUc,560
36
- pytgcalls/methods/stream/play.py,sha256=-Ld5TQWLhU_ktKrb7q1Xrym36UGrWhaenIbjj-3mM3k,7524
37
- pytgcalls/methods/stream/record.py,sha256=p9td2tZ4-QMpY8I8LDc1PrFVN3g-vlDINF5I7CmLsvA,1567
54
+ pytgcalls/methods/stream/play.py,sha256=fTZS-XHF50Wo9BNOZ373n4YhGqRuu7uZR-GJEACjqYY,2935
55
+ pytgcalls/methods/stream/record.py,sha256=geYSVtSbp0yRIR1Nmj-L1s-6nqQAh0x0IcA1OuFvuyA,1306
38
56
  pytgcalls/methods/stream/resume.py,sha256=AUHU3AtpXO2rtp2V1EKSC_KAWTk2KHMiHaqHluYy31M,563
39
57
  pytgcalls/methods/stream/send_frame.py,sha256=Kj9R8OqUM-g7pt-FiWP-US7sCFkH5ciPr9S8v-WPtLg,1062
40
58
  pytgcalls/methods/stream/time.py,sha256=65Hc5pQaN6z6nxgwT9Zxgsnl_UosvMkcICqE2hisNWA,659
41
59
  pytgcalls/methods/stream/unmute.py,sha256=wgWpxakIPLzZCgojC-cIkDSnF9LtDZwdTsBOctdHibQ,563
42
- pytgcalls/methods/utilities/__init__.py,sha256=HHAkTQEX_23uwo1fxnCIoE2rLBm7fKSQa52SwBLudTI,522
60
+ pytgcalls/methods/utilities/__init__.py,sha256=JcKwqNo6fFXXfuab94fNEraKF1P9fnSSgr0WQDRjF2w,339
43
61
  pytgcalls/methods/utilities/cache_peer.py,sha256=Ylt0wCCJOoNKf1wZEXjfE8aBZKUIIgdRUFOMTGA5DfE,140
44
62
  pytgcalls/methods/utilities/call_holder.py,sha256=MhIbwCG6DROd9_bHGa6aqu-rB0y4sngzPBj82zLtAXU,1068
45
63
  pytgcalls/methods/utilities/compose.py,sha256=Nzdv8orMmka5NIBZ1SW1nsqXRzArZl4m6FdZU7syaR4,334
46
64
  pytgcalls/methods/utilities/cpu_usage.py,sha256=Mbga4MFCIwuh7WC8sqBbv1Pa6ALcp5AIDyfYMH_Bix4,162
47
65
  pytgcalls/methods/utilities/idle.py,sha256=MDdzHTv1ws2yBhsvhBUnssGdghkZ2KwR0HUCPOwV38o,814
48
- pytgcalls/methods/utilities/join_presentation.py,sha256=gvxmFVzf6xsQZ4bPOz5wK8oZ0up1QD0DB2HpO5JcpGw,1671
49
- pytgcalls/methods/utilities/log_retries.py,sha256=6nD9J3350t82I0PKzK1pVx3ZaCBHATReiXYMs3PuVhQ,342
50
66
  pytgcalls/methods/utilities/ping.py,sha256=hhIMSHk2BzMB-IKpwLdZFVrsEvGm2ftJwKLs1k4anh8,244
51
67
  pytgcalls/methods/utilities/resolve_chat_id.py,sha256=92x2LHbUlnJMm-kS3fXOYmzYpY2TZbqtQD2rw3eBXDY,382
52
68
  pytgcalls/methods/utilities/run.py,sha256=cnYQd2xB5Cr_WS0Q2cXJZPGiN6JOCULzj1r4xXVyrlg,152
53
- pytgcalls/methods/utilities/start.py,sha256=Qc-uP9B6fgHtNOfjKJfgtYnWTY8JeIb6PSLmWPFXLOk,14376
69
+ pytgcalls/methods/utilities/start.py,sha256=mn0kQZhTUuc-9CCJDbFIVsEtJ8kfnfZOGbVC505qVRM,3232
54
70
  pytgcalls/methods/utilities/stream_params.py,sha256=fOSloo1A7WTxaZEtOiPXjdexMeoJjq8CZtfHuIFX7Ns,3325
55
- pytgcalls/methods/utilities/update_sources.py,sha256=ISF6u3rk4IcVrPOEOB-uZUDfnwUp2_y1_2g9GboXpWM,1562
56
71
  pytgcalls/mtproto/__init__.py,sha256=X4zvzFG7km7qHyE0fdvA550WcOVO_xl_p__gvIfDGmw,130
57
- pytgcalls/mtproto/bridged_client.py,sha256=hktnfpfBK7PEL2n7Y0kBZzI7dkLlsdrDwkYliZki8zQ,5915
72
+ pytgcalls/mtproto/bridged_client.py,sha256=svXufZkCj7WM9XOWkuk5oJVQxgL1Bg_8rz7w_ZKWlQg,6451
58
73
  pytgcalls/mtproto/client_cache.py,sha256=Mt0827e_T8DXJHOTkXhkIQUT9EUBWjoLcFcXP1gBnZY,5973
59
- pytgcalls/mtproto/hydrogram_client.py,sha256=SbyLIffnexzI6xuSkpqzChT70xGXwti_c5sjKUZFqwQ,23031
60
- pytgcalls/mtproto/mtproto_client.py,sha256=1C1Cc1GOrKom-70NqUOICKxjfjgpPZBSdKdwFUjZzBc,7616
61
- pytgcalls/mtproto/pyrogram_client.py,sha256=GFt_2QoSEuRaIkUziZOnpBj8zEPiDGs55IriHU0jXwI,23213
62
- pytgcalls/mtproto/telethon_client.py,sha256=L91_Zxud-pvtJy36fBi6daowNV2qPZHUEp5dcsu031I,22451
63
- pytgcalls/types/__init__.py,sha256=iXAzXG5WgbICLQV1JT_F4QtOqKWC8X3334-MOv2SXW4,1127
74
+ pytgcalls/mtproto/hydrogram_client.py,sha256=pSEtHowL833-vD5ppm78eBe7_Ik0pumChbDTMLsyP5Y,25553
75
+ pytgcalls/mtproto/mtproto_client.py,sha256=95A13HsNJfpNslsY_gWiqYXj_Vvo-pl3rVrsJGxftgg,8517
76
+ pytgcalls/mtproto/pyrogram_client.py,sha256=linvRHAxZCb4PenJEN9-OtjQm7Go9OONyDotZcMydNY,25710
77
+ pytgcalls/mtproto/telethon_client.py,sha256=iDMAAKvvFVigOrLPusG9ytiswxM2UCp4KZZuwtT-vKo,24987
78
+ pytgcalls/types/__init__.py,sha256=GlgBBXAwbNopXSeTTmiXktrEJhhN_rMBtuAllTBbN3k,1189
64
79
  pytgcalls/types/browsers.py,sha256=47Kr5q96n4Q4WvVhA6IUlS2egEcA9GRLlDeFcQYyc9M,9545
65
80
  pytgcalls/types/cache.py,sha256=FfsOcmYnsBGPlJoTPIXXYcUSpGE3rhx6cjIH77hyUL0,1059
66
81
  pytgcalls/types/dict.py,sha256=lAo9hu4VlVJa9S7P8Y81BYmKtvz0rH7hwpGcH3ynHUw,78
67
82
  pytgcalls/types/flag.py,sha256=dQPcQmTgTQzcOLTvGe8t_e9mY4qsVnCZFrrTk17b2Xw,132
68
83
  pytgcalls/types/list.py,sha256=UjP_XxxMpPkLlu6yEy29JYqOM5VITFwwJcDm0wZni1c,78
69
84
  pytgcalls/types/participant_list.py,sha256=LmGjU63MK1v3SS2_4xNbk04OOjmukNdAXYLRn2L-730,916
70
- pytgcalls/types/py_object.py,sha256=VlazuMP0cFpExKimW8BtWR66LDewnNdQSLC7r_t7JIM,842
85
+ pytgcalls/types/py_object.py,sha256=__GNXgffGK4jhdF4QPqIknd0k2myObJf_7fW3pNGpbU,836
71
86
  pytgcalls/types/update.py,sha256=wPCzWLhrsScZ3ksRTyt8IuDaaG5YI-ItG_Yw-OqzK2Y,157
72
87
  pytgcalls/types/user_agent.py,sha256=sSfeGqUe0v0wqBgdVszNFK0iOC_0Tdyto9CglBXlY4U,1086
73
- pytgcalls/types/calls/__init__.py,sha256=f0zMKm_mwvNsDRPgs8IopuCEefU3V0-kuHAFsTMBoAc,403
88
+ pytgcalls/types/calls/__init__.py,sha256=lgFG89_NGhWHOQqhfw3adPaQZMzsMKI1f-MyZW3TBBU,478
74
89
  pytgcalls/types/calls/call.py,sha256=n7LW7FRNT2qJzbYC3D312judOlVUuocQ1eW9l9scGCo,546
75
90
  pytgcalls/types/calls/call_config.py,sha256=b6P43YTGF2t7E2CyD1mSYPJDUBvYYeHoxB3hSbTVyOY,120
76
91
  pytgcalls/types/calls/call_data.py,sha256=-qPj2QhWv32Xs7LyFQY4hiWDqJ21B8VBvdzREK8bDvY,544
77
92
  pytgcalls/types/calls/call_protocol.py,sha256=OVIQs1VgdY-DWbZbNr41hjLA4pGQvHx8Rgom1_NhJxQ,408
78
93
  pytgcalls/types/calls/call_sources.py,sha256=sBhumPgEaN8uAKjBwb1Zf_Ag0qrceti2mURXqMhBusg,107
79
94
  pytgcalls/types/calls/group_call_config.py,sha256=auKH-hZJWj8PhTkyeQ_VK2z9NpNvNC7Scl_IhEUMnQM,353
95
+ pytgcalls/types/calls/pending_connection.py,sha256=qRRmutInj70rtzbThM7CNznFhEPqTNZQc6LUWnqpZ9I,432
80
96
  pytgcalls/types/calls/raw_call_update.py,sha256=hpNw6HrTW8Z36Lh2HinS-wzprryRtsIxyIFbIfjGgeI,795
81
97
  pytgcalls/types/chats/__init__.py,sha256=v8pUp_vbr2kQpyHtAQc80N-YqzmXHe9SbllUsa6njkU,261
82
- pytgcalls/types/chats/chat_update.py,sha256=wh8v2I-pZxJWGNBjIwWRbhY-ZCI4v8qGabDTpuJaHu0,619
98
+ pytgcalls/types/chats/chat_update.py,sha256=lzrqNDPv4a_yXpKIfUnhocXqZyIy8XgZladOQTYrrYA,730
83
99
  pytgcalls/types/chats/group_call_participant.py,sha256=XG4dekFV9GYHASqy_bSE6YnZ1uDunFFif-xLAy_eYGY,1711
84
100
  pytgcalls/types/chats/updated_group_call_participant.py,sha256=-KID-z-4e43fhYWQp0pNMKPfmZizbJHXyzn6yLtIGNg,291
85
101
  pytgcalls/types/raw/__init__.py,sha256=ROHsKFeUMUtlFbx2rhfrdB-TuVm0zBuvNo29Ccn5614,308
@@ -94,13 +110,12 @@ pytgcalls/types/stream/device.py,sha256=EdoDg6lPE7fgoZI04Nr0E9zbIk-iRIBgYYAzVqoC
94
110
  pytgcalls/types/stream/direction.py,sha256=VepLMe-dXg4M5eVdVyIb2uxYvnpB9OJL5fEgPYUFtTI,592
95
111
  pytgcalls/types/stream/external_media.py,sha256=RiuSX5tZGdNsQZ8LIRk5Lp4Ksv9oTvaccmInJRZYo4M,114
96
112
  pytgcalls/types/stream/frame.py,sha256=TXo5HZVHbbaVNBqulMhTqGODXH3bpBVlN_of1rosNUQ,586
97
- pytgcalls/types/stream/media_stream.py,sha256=jNWNJppX2ji4CrHdkF2b6FFLeiS9KKjVDGvcWPmPrvc,11917
113
+ pytgcalls/types/stream/media_stream.py,sha256=_NJFTAIUdYyTh-gjiqs6aCpAIfSVjE16mBYUapMnDfg,11917
98
114
  pytgcalls/types/stream/record_stream.py,sha256=RWeD9U-sqUmb_PuZQxYnExZyoibepU_8oI2yrH2Y18c,3135
99
115
  pytgcalls/types/stream/stream_ended.py,sha256=xR_kZwFf03hA6rw_nvI7Be7GwoCKzQf_1MKaGpPDXqY,716
100
116
  pytgcalls/types/stream/stream_frames.py,sha256=028ZhNV-mN3BGqMlmxusAV1xDQpXRYCeM0WXBZhRUhA,446
101
117
  pytgcalls/types/stream/video_quality.py,sha256=HBfWq005kh-D19MaVE9VzVdnODzrXf4IJUimCfslfiU,231
102
- py_tgcalls-2.1.0rc7.dist-info/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
103
- py_tgcalls-2.1.0rc7.dist-info/METADATA,sha256=wE_GHnEckGXj0s7PhTdGe7DDFkPApiuV1I-dT7h9SMM,14331
104
- py_tgcalls-2.1.0rc7.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
105
- py_tgcalls-2.1.0rc7.dist-info/top_level.txt,sha256=IUDUwn0KkcbUYZbCe9R5AUb2Ob-lmllNUGQqyeXXd8A,10
106
- py_tgcalls-2.1.0rc7.dist-info/RECORD,,
118
+ py_tgcalls-2.1.2b1.dist-info/METADATA,sha256=eIv6LkWODtw1kuwAm47s97UaONUq-Dx3PeF8ojZQwbQ,5284
119
+ py_tgcalls-2.1.2b1.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
120
+ py_tgcalls-2.1.2b1.dist-info/top_level.txt,sha256=IUDUwn0KkcbUYZbCe9R5AUb2Ob-lmllNUGQqyeXXd8A,10
121
+ py_tgcalls-2.1.2b1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (76.0.0)
2
+ Generator: setuptools (80.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
pytgcalls/__version__.py CHANGED
@@ -1 +1 @@
1
- __version__ = '2.1.0.rc7'
1
+ __version__ = '2.1.2b1'
pytgcalls/exceptions.py CHANGED
@@ -37,13 +37,6 @@ class TooOldHydrogramVersion(Exception):
37
37
  )
38
38
 
39
39
 
40
- class InvalidStreamMode(Exception):
41
- def __init__(self):
42
- super().__init__(
43
- 'Invalid stream mode',
44
- )
45
-
46
-
47
40
  class NoMTProtoClientSet(Exception):
48
41
  def __init__(self):
49
42
  super().__init__(
@@ -72,24 +65,24 @@ class CallDeclined(Exception):
72
65
  )
73
66
 
74
67
 
75
- class CallDiscarded(Exception):
68
+ class CallBusy(Exception):
76
69
  def __init__(self, user_id: int):
77
70
  super().__init__(
78
- f'Call discarded by {user_id}',
71
+ f'The user {user_id} is busy',
79
72
  )
80
73
 
81
74
 
82
- class NotInCallError(Exception):
83
- def __init__(self):
75
+ class CallDiscarded(Exception):
76
+ def __init__(self, user_id: int):
84
77
  super().__init__(
85
- 'The userbot is not in a call',
78
+ f'Call discarded by {user_id}',
86
79
  )
87
80
 
88
81
 
89
- class AlreadyJoinedError(Exception):
82
+ class NotInCallError(Exception):
90
83
  def __init__(self):
91
84
  super().__init__(
92
- 'Already joined into group call',
85
+ 'The userbot is not in a call',
93
86
  )
94
87
 
95
88
 
@@ -115,16 +108,6 @@ class TooManyCustomApiDecorators(Exception):
115
108
  )
116
109
 
117
110
 
118
- class GroupCallNotFound(Exception):
119
- def __init__(
120
- self,
121
- chat_id: int,
122
- ):
123
- super().__init__(
124
- f'Group call not found with the chat id {chat_id}',
125
- )
126
-
127
-
128
111
  class InvalidMTProtoClient(Exception):
129
112
  def __init__(self):
130
113
  super().__init__(
@@ -174,13 +157,6 @@ class YtDlpError(Exception):
174
157
  )
175
158
 
176
159
 
177
- class UnMuteNeeded(Exception):
178
- def __init__(self):
179
- super().__init__(
180
- 'Needed to unmute the userbot',
181
- )
182
-
183
-
184
160
  class MTProtoClientNotConnected(Exception):
185
161
  def __init__(self):
186
162
  super().__init__(
@@ -1,5 +1,6 @@
1
1
  from .calls import Calls
2
2
  from .decorators import Decorators
3
+ from .internal import Internal
3
4
  from .stream import StreamMethods
4
5
  from .utilities import Utilities
5
6
 
@@ -7,6 +8,7 @@ from .utilities import Utilities
7
8
  class Methods(
8
9
  Calls,
9
10
  Decorators,
11
+ Internal,
10
12
  StreamMethods,
11
13
  Utilities,
12
14
  ):
@@ -11,9 +11,9 @@ from ...statictypes import statictypes
11
11
 
12
12
 
13
13
  class LeaveCall(Scaffold):
14
- @mutex
15
14
  @statictypes
16
15
  @mtproto_required
16
+ @mutex
17
17
  async def leave_call(
18
18
  self,
19
19
  chat_id: Union[int, str],
@@ -0,0 +1,35 @@
1
+ from .clear_cache import ClearCache
2
+ from .clear_call import ClearCall
3
+ from .connect_call import ConnectCall
4
+ from .emit_sig_data import EmitSigData
5
+ from .handle_connection_changed import HandleConnectionChanged
6
+ from .handle_mtproto_updates import HandleMTProtoUpdates
7
+ from .handle_stream_ended import HandleStreamEnded
8
+ from .handle_stream_frame import HandleStreamFrame
9
+ from .join_presentation import JoinPresentation
10
+ from .log_retries import LogRetries
11
+ from .request_broadcast_part import RequestBroadcastPart
12
+ from .request_broadcast_timestamp import RequestBroadcastTimestamp
13
+ from .switch_connection import SwitchConnection
14
+ from .update_sources import UpdateSources
15
+ from .update_status import UpdateStatus
16
+
17
+
18
+ class Internal(
19
+ ClearCache,
20
+ ClearCall,
21
+ ConnectCall,
22
+ EmitSigData,
23
+ HandleConnectionChanged,
24
+ HandleMTProtoUpdates,
25
+ HandleStreamEnded,
26
+ HandleStreamFrame,
27
+ JoinPresentation,
28
+ LogRetries,
29
+ RequestBroadcastPart,
30
+ RequestBroadcastTimestamp,
31
+ SwitchConnection,
32
+ UpdateSources,
33
+ UpdateStatus,
34
+ ):
35
+ pass
@@ -0,0 +1,8 @@
1
+ from ...scaffold import Scaffold
2
+
3
+
4
+ class ClearCache(Scaffold):
5
+ def _clear_cache(self, chat_id: int):
6
+ self._p2p_configs.pop(chat_id, None)
7
+ self._cache_user_peer.pop(chat_id)
8
+ self._need_unmute.discard(chat_id)
@@ -0,0 +1,20 @@
1
+ from ntgcalls import ConnectionNotFound
2
+ from ntgcalls import TelegramServerError
3
+
4
+ from ...scaffold import Scaffold
5
+
6
+
7
+ class ClearCall(Scaffold):
8
+ async def _clear_call(self, chat_id: int):
9
+ res = False
10
+ if chat_id in self._wait_connect:
11
+ self._wait_connect[chat_id].set_exception(
12
+ TelegramServerError(),
13
+ )
14
+ try:
15
+ await self._binding.stop(chat_id)
16
+ res = True
17
+ except ConnectionNotFound:
18
+ pass
19
+ self._clear_cache(chat_id)
20
+ return res
@@ -0,0 +1,133 @@
1
+ import asyncio
2
+ from typing import Optional
3
+ from typing import Union
4
+
5
+ from ntgcalls import ConnectionMode
6
+ from ntgcalls import ConnectionNotFound
7
+ from ntgcalls import MediaDescription
8
+ from ntgcalls import TelegramServerError
9
+
10
+ from ...exceptions import TimedOutAnswer
11
+ from ...scaffold import Scaffold
12
+ from ...types import CallConfig
13
+ from ...types import CallData
14
+ from ...types import GroupCallConfig
15
+ from ...types import PendingConnection
16
+ from ...types import RawCallUpdate
17
+
18
+
19
+ class ConnectCall(Scaffold):
20
+ async def _connect_call(
21
+ self,
22
+ chat_id: int,
23
+ media_description: MediaDescription,
24
+ config: Union[CallConfig, GroupCallConfig],
25
+ payload: Optional[str],
26
+ ):
27
+ for retries in range(4):
28
+ try:
29
+ self._wait_connect[chat_id] = self.loop.create_future()
30
+ if isinstance(config, GroupCallConfig):
31
+ if not payload:
32
+ payload = await self._binding.create_call(
33
+ chat_id,
34
+ media_description,
35
+ )
36
+ result_params = await self._app.join_group_call(
37
+ chat_id,
38
+ payload,
39
+ config.invite_hash,
40
+ media_description.camera is None and
41
+ media_description.screen is None,
42
+ self._cache_user_peer.get(chat_id),
43
+ )
44
+ await self._binding.connect(
45
+ chat_id,
46
+ result_params,
47
+ False,
48
+ )
49
+ connection_mode = await self._binding.get_connection_mode(
50
+ chat_id,
51
+ )
52
+ if connection_mode == ConnectionMode.STREAM and payload:
53
+ self._pending_connections[chat_id] = PendingConnection(
54
+ media_description,
55
+ config,
56
+ payload,
57
+ False,
58
+ )
59
+ else:
60
+ data = self._p2p_configs.setdefault(
61
+ chat_id,
62
+ CallData(await self._app.get_dhc(), self.loop),
63
+ )
64
+ await self._binding.create_p2p_call(
65
+ chat_id,
66
+ media_description,
67
+ )
68
+ data.g_a_or_b = await self._binding.init_exchange(
69
+ chat_id,
70
+ data.dh_config,
71
+ data.g_a_or_b,
72
+ )
73
+ if not data.outgoing:
74
+ await self._app.accept_call(
75
+ chat_id,
76
+ data.g_a_or_b,
77
+ self._binding.get_protocol(),
78
+ )
79
+ else:
80
+ await self._app.request_call(
81
+ chat_id,
82
+ data.g_a_or_b,
83
+ self._binding.get_protocol(),
84
+ media_description.camera is not None or
85
+ media_description.screen is not None,
86
+ )
87
+
88
+ try:
89
+ result: RawCallUpdate = await asyncio.wait_for(
90
+ data.wait_data,
91
+ timeout=config.timeout,
92
+ )
93
+ auth_params = await self._binding.exchange_keys(
94
+ chat_id,
95
+ result.g_a_or_b,
96
+ result.fingerprint,
97
+ )
98
+ if result.status & RawCallUpdate.Type.ACCEPTED:
99
+ result.protocol = await self._app.confirm_call(
100
+ chat_id,
101
+ auth_params.g_a_or_b,
102
+ auth_params.key_fingerprint,
103
+ self._binding.get_protocol(),
104
+ )
105
+ await self._binding.connect_p2p(
106
+ chat_id,
107
+ result.protocol.rtc_servers,
108
+ result.protocol.library_versions,
109
+ result.protocol.p2p_allowed,
110
+ )
111
+ except asyncio.TimeoutError:
112
+ try:
113
+ await self._binding.stop(chat_id)
114
+ except ConnectionNotFound:
115
+ pass
116
+ await self._app.discard_call(chat_id, True)
117
+ raise TimedOutAnswer()
118
+ finally:
119
+ self._p2p_configs.pop(chat_id, None)
120
+ await self._wait_connect[chat_id]
121
+ break
122
+ except TelegramServerError:
123
+ if retries == 3 or chat_id > 0:
124
+ raise
125
+ self._log_retries(retries)
126
+ except Exception:
127
+ try:
128
+ await self._binding.stop(chat_id)
129
+ except ConnectionNotFound:
130
+ pass
131
+ raise
132
+ finally:
133
+ self._wait_connect.pop(chat_id, None)
@@ -0,0 +1,9 @@
1
+ from ...scaffold import Scaffold
2
+
3
+
4
+ class EmitSigData(Scaffold):
5
+ async def _emit_sig_data(self, chat_id: int, data: bytes):
6
+ await self._app.send_signaling(
7
+ chat_id,
8
+ data,
9
+ )
@@ -0,0 +1,27 @@
1
+ from ntgcalls import ConnectionState
2
+ from ntgcalls import NetworkInfo
3
+ from ntgcalls import TelegramServerError
4
+
5
+ from ...scaffold import Scaffold
6
+
7
+
8
+ class HandleConnectionChanged(Scaffold):
9
+ async def _handle_connection_changed(
10
+ self,
11
+ chat_id: int,
12
+ net_state: NetworkInfo,
13
+ ):
14
+ state = net_state.state
15
+ if state == ConnectionState.CONNECTING:
16
+ return
17
+ if chat_id in self._wait_connect:
18
+ if state == ConnectionState.CONNECTED:
19
+ self._wait_connect[chat_id].set_result(None)
20
+ else:
21
+ self._wait_connect[chat_id].set_exception(
22
+ TelegramServerError(),
23
+ )
24
+ elif state != ConnectionState.CONNECTED:
25
+ if chat_id > 0:
26
+ await self._app.discard_call(chat_id)
27
+ self._clear_cache(chat_id)