py-tgcalls 2.1.0.dev1__py3-none-any.whl → 2.1.0.dev2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: py-tgcalls
3
- Version: 2.1.0.dev1
3
+ Version: 2.1.0.dev2
4
4
  Summary: Async client API for the Telegram Calls.
5
5
  Author-email: Laky-64 <iraci.matteo@gmail.com>
6
6
  License: GNU LESSER GENERAL PUBLIC LICENSE
@@ -187,7 +187,7 @@ Requires-Python: >=3.9
187
187
  Description-Content-Type: text/markdown
188
188
  License-File: LICENSE
189
189
  Requires-Dist: aiohttp>=3.9.3
190
- Requires-Dist: ntgcalls<1.4.0,>=1.3.0b1
190
+ Requires-Dist: ntgcalls<1.4.0,>=1.3.0b3
191
191
  Requires-Dist: deprecation
192
192
  Provides-Extra: hydrogram
193
193
  Requires-Dist: hydrogram>=0.1.4; extra == "hydrogram"
@@ -1,9 +1,9 @@
1
1
  pytgcalls/__init__.py,sha256=qbfwN7rYwIdCegMOzdcbvwazeNjDzgmowgcqLFNqKIM,308
2
- pytgcalls/__version__.py,sha256=-xsToRR0G_8PEZroy9YUubqvaJO6GE3JysoRHsKVBo0,27
2
+ pytgcalls/__version__.py,sha256=wNJAWxZJ5nqnvr7CcRnjak-Pcnydu3AaK30sXJNnIZU,27
3
3
  pytgcalls/environment.py,sha256=ctCHACvG6l8SdpPewSBhOvc70kbwpv18maC0TwLvZ08,1924
4
4
  pytgcalls/exceptions.py,sha256=0MmAktc53ajYAc7ThjD2tJ9PDyibUi0iHZMfUy2IoKs,4109
5
5
  pytgcalls/ffmpeg.py,sha256=uAqFDPwWoABW_WfubxeulpIh5vWpylxFARgYokn3ff8,8640
6
- pytgcalls/filters.py,sha256=xAjMGfAnvIU1ZySYrE6OZ3l2KoGPan-4G88hb37Vq2Q,6038
6
+ pytgcalls/filters.py,sha256=dHRXgxhQoLaLsSAsYYaq4jCwVran9sBWBG1txKWIOjY,6039
7
7
  pytgcalls/mtproto_required.py,sha256=6B-31p5qH_6oekUgypV4nK3hqPS6Nr-pA8S81wjnbaY,630
8
8
  pytgcalls/mutex.py,sha256=Frjji5Ctzlk4AXEBuBLnDK-7HbtreoV6zuyKpFpMNI4,236
9
9
  pytgcalls/pytgcalls.py,sha256=oBcWgBwusnXmjHrLEE99VVXARReVyrXdn9SyeBWHbVo,1479
@@ -47,10 +47,10 @@ pytgcalls/methods/utilities/idle.py,sha256=MDdzHTv1ws2yBhsvhBUnssGdghkZ2KwR0HUCP
47
47
  pytgcalls/methods/utilities/ping.py,sha256=hhIMSHk2BzMB-IKpwLdZFVrsEvGm2ftJwKLs1k4anh8,244
48
48
  pytgcalls/methods/utilities/resolve_chat_id.py,sha256=92x2LHbUlnJMm-kS3fXOYmzYpY2TZbqtQD2rw3eBXDY,382
49
49
  pytgcalls/methods/utilities/run.py,sha256=cnYQd2xB5Cr_WS0Q2cXJZPGiN6JOCULzj1r4xXVyrlg,152
50
- pytgcalls/methods/utilities/start.py,sha256=6opHd0FM1H_FOmIOdVEZaSKBu4ViAd7TxxYy2gegbEY,13279
50
+ pytgcalls/methods/utilities/start.py,sha256=ObY79b_2qxDSAytQEYeHKK4k4JRD2_iyLCPyGyKpH-E,13340
51
51
  pytgcalls/methods/utilities/stream_params.py,sha256=g-DmwTY_aYTWhhZ4RDthORQXz_VrhK1JQKPFYmB64II,2992
52
52
  pytgcalls/mtproto/__init__.py,sha256=X4zvzFG7km7qHyE0fdvA550WcOVO_xl_p__gvIfDGmw,130
53
- pytgcalls/mtproto/bridged_client.py,sha256=OAjDlWcuT_VoYn-toD8vRMoXpOibYomlLj4A4SXlmgU,5824
53
+ pytgcalls/mtproto/bridged_client.py,sha256=OlFCV7Xe2a9I0_AAWfrWJciAe1b7WtVocVjl1EsBMyY,5843
54
54
  pytgcalls/mtproto/client_cache.py,sha256=Mt0827e_T8DXJHOTkXhkIQUT9EUBWjoLcFcXP1gBnZY,5973
55
55
  pytgcalls/mtproto/hydrogram_client.py,sha256=3oMeEQN85yYkjeNA9oMCZvuniLTjdRdP_GJMJiOXfkI,22813
56
56
  pytgcalls/mtproto/mtproto_client.py,sha256=3TN2MfFYr8Lfd5AKp_u8G64XHSfCtpy59h4_SACa8G4,7564
@@ -82,18 +82,18 @@ pytgcalls/types/raw/audio_parameters.py,sha256=1DsBPwdn_Ukd2Tbkb3whP_ILo9xJY_3XN
82
82
  pytgcalls/types/raw/audio_stream.py,sha256=oN7Sx9oLbNFuNXiGYpoNabMwqWKGquLiHEywef28o7c,488
83
83
  pytgcalls/types/raw/stream.py,sha256=xJ3w77ofKFnLIA4cAWIuw2yREpMPvTzIvtei-3xEbJQ,666
84
84
  pytgcalls/types/raw/video_parameters.py,sha256=nUl9gkfYTVU0iLNGTtlZ5cZg8K6F7odIi9n8POJXCK4,639
85
- pytgcalls/types/raw/video_stream.py,sha256=YLjkKrI9neTrVkDOXeWIoeDRTTc_WIwgKUAVUxcs7-I,445
85
+ pytgcalls/types/raw/video_stream.py,sha256=uE3jU9kJsrAoefXtDtEKNqTjcYGaQbZ1gbJ1SfiVWIc,488
86
86
  pytgcalls/types/stream/__init__.py,sha256=a-3kNWnp4Vpja_x_Un6misT3VVVllChpeinc3w6Yd1k,457
87
87
  pytgcalls/types/stream/audio_quality.py,sha256=4X94ErmTeLP4TVcE3eLtPPdtluSPxgxbgTosuNJOVhc,141
88
88
  pytgcalls/types/stream/device.py,sha256=lnWrChNArFl3Sk-DqVEs61K-YXl2rqRAQq6PSPgjBCU,578
89
89
  pytgcalls/types/stream/direction.py,sha256=_Q1SNb-47krKuZs7B5dw1mqDhQ9_CTb_Jr96-MAfv28,395
90
- pytgcalls/types/stream/media_stream.py,sha256=GER8EpTMRrlQcjvK7ON3DtlAXzHavaqgs8J6T9cmf7Y,9164
90
+ pytgcalls/types/stream/media_stream.py,sha256=_gevQrmDJyLxGQCGk9qAfxe7949S8w51X2aF2rNCYM0,10222
91
91
  pytgcalls/types/stream/record_stream.py,sha256=FNwreJsEHHn7k_nZYbdnfC7D9-5LyPWNFQVwHYkRzio,2961
92
92
  pytgcalls/types/stream/stream_ended.py,sha256=xR_kZwFf03hA6rw_nvI7Be7GwoCKzQf_1MKaGpPDXqY,716
93
93
  pytgcalls/types/stream/stream_frame.py,sha256=TMoJUbC2tsMDL1tt4oWCkaMsHoeYKj8dnV6JIs7EoEk,797
94
94
  pytgcalls/types/stream/video_quality.py,sha256=HBfWq005kh-D19MaVE9VzVdnODzrXf4IJUimCfslfiU,231
95
- py_tgcalls-2.1.0.dev1.dist-info/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
96
- py_tgcalls-2.1.0.dev1.dist-info/METADATA,sha256=gVxB8ePO9ohhiKygAlWLLHRRxrzC9C-6sCs_dgvvOKU,14380
97
- py_tgcalls-2.1.0.dev1.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
98
- py_tgcalls-2.1.0.dev1.dist-info/top_level.txt,sha256=IUDUwn0KkcbUYZbCe9R5AUb2Ob-lmllNUGQqyeXXd8A,10
99
- py_tgcalls-2.1.0.dev1.dist-info/RECORD,,
95
+ py_tgcalls-2.1.0.dev2.dist-info/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
96
+ py_tgcalls-2.1.0.dev2.dist-info/METADATA,sha256=x49Taxds_EKwrWUaD8LgzmYaHHVrM5uQ17V_KtsC2hE,14380
97
+ py_tgcalls-2.1.0.dev2.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
98
+ py_tgcalls-2.1.0.dev2.dist-info/top_level.txt,sha256=IUDUwn0KkcbUYZbCe9R5AUb2Ob-lmllNUGQqyeXXd8A,10
99
+ py_tgcalls-2.1.0.dev2.dist-info/RECORD,,
pytgcalls/__version__.py CHANGED
@@ -1 +1 @@
1
- __version__ = '2.1.0.dev1'
1
+ __version__ = '2.1.0.dev2'
pytgcalls/filters.py CHANGED
@@ -158,6 +158,7 @@ class stream_end(Filter):
158
158
  )
159
159
  )
160
160
 
161
+
161
162
  # noinspection PyPep8Naming
162
163
  class chat(Filter, set):
163
164
  def __init__(
@@ -107,7 +107,7 @@ class Start(Scaffold):
107
107
  )
108
108
  except ConnectionNotFound:
109
109
  pass
110
- else:
110
+ elif user_id in self._videos_id:
111
111
  try:
112
112
  await self._binding.remove_incoming_video(
113
113
  chat_id,
@@ -130,7 +130,7 @@ class Start(Scaffold):
130
130
  )
131
131
  except ConnectionNotFound:
132
132
  pass
133
- else:
133
+ elif user_id in self._presentations_id:
134
134
  try:
135
135
  await self._binding.remove_incoming_video(
136
136
  chat_id,
@@ -152,7 +152,7 @@ class BridgedClient(HandlersHolder):
152
152
  [
153
153
  SsrcGroup(
154
154
  source_group.semantics,
155
- source_group.sources,
155
+ [ssrc for ssrc in source_group.sources],
156
156
  )
157
157
  for source_group in source.source_groups
158
158
  ],
@@ -1,10 +1,11 @@
1
1
  from ntgcalls import MediaSource
2
2
 
3
3
  from ...statictypes import statictypes
4
+ from ..py_object import PyObject
4
5
  from .video_parameters import VideoParameters
5
6
 
6
7
 
7
- class VideoStream:
8
+ class VideoStream(PyObject):
8
9
  @statictypes
9
10
  def __init__(
10
11
  self,
@@ -68,31 +68,36 @@ class MediaStream(Stream):
68
68
 
69
69
  self._media_path: Optional[str] = None
70
70
  self._audio_path: Optional[str] = None
71
+ self._is_media_device: bool = False
72
+ self._is_audio_device: bool = False
71
73
  if isinstance(media_path, str):
72
74
  self._media_path = media_path
73
75
  elif isinstance(media_path, Path):
74
76
  self._media_path = str(media_path)
75
- elif isinstance(media_path, InputDevice):
77
+ elif isinstance(media_path, (InputDevice, ScreenDevice)):
78
+ print('MediaStream', media_path.is_video)
76
79
  if media_path.is_video:
77
80
  self._media_path = media_path.metadata
81
+ self._is_media_device = True
78
82
  else:
79
83
  self._audio_path = media_path.metadata
84
+ self._is_audio_device = True
80
85
 
81
86
  if isinstance(audio_path, str):
82
87
  self._audio_path = audio_path
83
88
  elif isinstance(audio_path, Path):
84
89
  self._audio_path = str(audio_path)
85
- elif isinstance(audio_path, InputDevice):
90
+ elif isinstance(audio_path, (InputDevice, ScreenDevice)):
86
91
  if audio_path.is_video:
87
92
  raise ValueError('Audio path must be an audio device')
88
93
  self._audio_path = audio_path.metadata
94
+ self._is_audio_device = True
89
95
 
90
96
  self._audio_flags = self._filter_flags(audio_flags)
91
97
  self._video_flags = self._filter_flags(video_flags)
92
98
  self._ffmpeg_parameters = ffmpeg_parameters
93
99
  self._ytdlp_parameters = ytdlp_parameters
94
100
  self._headers = headers
95
-
96
101
  super().__init__(
97
102
  microphone=None
98
103
  if self._audio_flags & MediaStream.Flags.IGNORE else
@@ -101,7 +106,7 @@ class MediaStream(Stream):
101
106
  self._audio_path,
102
107
  self._audio_parameters,
103
108
  )
104
- if isinstance(audio_path, InputDevice) else
109
+ if self._is_audio_device else
105
110
  AudioStream(
106
111
  MediaSource.SHELL,
107
112
  ' '.join(
@@ -120,12 +125,12 @@ class MediaStream(Stream):
120
125
  camera=None
121
126
  if self._video_flags & MediaStream.Flags.IGNORE else
122
127
  VideoStream(
123
- MediaSource.DESKTOP if isinstance(audio_path, ScreenDevice)
128
+ MediaSource.DESKTOP if isinstance(media_path, ScreenDevice)
124
129
  else MediaSource.DEVICE,
125
130
  self._media_path,
126
131
  self._video_parameters,
127
132
  )
128
- if isinstance(audio_path, InputDevice) else
133
+ if self._is_media_device else
129
134
  VideoStream(
130
135
  MediaSource.SHELL,
131
136
  ' '.join(
@@ -145,90 +150,103 @@ class MediaStream(Stream):
145
150
 
146
151
  async def check_stream(self):
147
152
  if not self._video_flags & MediaStream.Flags.IGNORE:
148
- if YtDlp.is_valid(self._media_path):
149
- links = await YtDlp.extract(
150
- self._media_path,
151
- self._video_parameters,
152
- self._ytdlp_parameters,
153
- )
154
- self._media_path = links[0]
155
- if not self._audio_path:
156
- self._audio_path = links[1]
157
- try:
158
- image_commands = []
159
- live_stream = False
160
- try:
161
- await check_stream(
162
- self._ffmpeg_parameters,
153
+ if self._is_media_device:
154
+ if not self._media_path:
155
+ self.camera = None
156
+ elif self._media_path:
157
+ if YtDlp.is_valid(self._media_path):
158
+ links = await YtDlp.extract(
163
159
  self._media_path,
164
160
  self._video_parameters,
165
- [],
166
- self._headers,
161
+ self._ytdlp_parameters,
167
162
  )
168
- except ImageSourceFound:
169
- image_commands = [
170
- '-loop',
171
- '1',
172
- '-framerate',
173
- '1',
174
- ]
175
- except LiveStreamFound:
176
- live_stream = True
177
- self.camera.path = ' '.join(
178
- build_command(
179
- 'ffmpeg',
180
- self._ffmpeg_parameters,
181
- self._media_path,
182
- self._video_parameters,
183
- image_commands,
184
- self._headers,
185
- live_stream,
186
- ),
187
- )
188
- except NoVideoSourceFound as e:
189
- if self._video_flags & MediaStream.Flags.REQUIRED:
190
- raise e
163
+ self._media_path = links[0]
164
+ if not self._audio_path:
165
+ self._audio_path = links[1]
166
+ try:
167
+ image_commands = []
168
+ live_stream = False
169
+ try:
170
+ await check_stream(
171
+ self._ffmpeg_parameters,
172
+ self._media_path,
173
+ self._video_parameters,
174
+ [],
175
+ self._headers,
176
+ )
177
+ except ImageSourceFound:
178
+ image_commands = [
179
+ '-loop',
180
+ '1',
181
+ '-framerate',
182
+ '1',
183
+ ]
184
+ except LiveStreamFound:
185
+ live_stream = True
186
+ self.camera.path = ' '.join(
187
+ build_command(
188
+ 'ffmpeg',
189
+ self._ffmpeg_parameters,
190
+ self._media_path,
191
+ self._video_parameters,
192
+ image_commands,
193
+ self._headers,
194
+ live_stream,
195
+ ),
196
+ )
197
+ except NoVideoSourceFound as e:
198
+ if self._video_flags & MediaStream.Flags.REQUIRED:
199
+ raise e
200
+ self.camera = None
201
+ else:
191
202
  self.camera = None
192
203
 
193
- self._audio_path = self._audio_path \
194
- if self._audio_path else self._media_path
204
+ if not self._is_media_device:
205
+ self._audio_path = self._audio_path \
206
+ if self._audio_path else self._media_path
195
207
 
196
208
  if not self._audio_flags & MediaStream.Flags.IGNORE:
197
- if YtDlp.is_valid(self._audio_path):
198
- self._audio_path = (
199
- await YtDlp.extract(
200
- self._audio_path,
201
- self._video_parameters,
202
- self._ytdlp_parameters,
203
- )
204
- )[1]
209
+ if self._is_audio_device:
210
+ if not self._audio_path:
211
+ self.microphone = None
212
+ elif self._audio_path:
213
+ if YtDlp.is_valid(self._audio_path):
214
+ self._audio_path = (
215
+ await YtDlp.extract(
216
+ self._audio_path,
217
+ self._video_parameters,
218
+ self._ytdlp_parameters,
219
+ )
220
+ )[1]
205
221
 
206
- try:
207
- live_stream = False
208
222
  try:
209
- await check_stream(
210
- self._ffmpeg_parameters,
211
- self._audio_path,
212
- self._audio_parameters,
213
- [],
214
- self._headers,
223
+ live_stream = False
224
+ try:
225
+ await check_stream(
226
+ self._ffmpeg_parameters,
227
+ self._audio_path,
228
+ self._audio_parameters,
229
+ [],
230
+ self._headers,
231
+ )
232
+ except LiveStreamFound:
233
+ live_stream = True
234
+ self.microphone.path = ' '.join(
235
+ build_command(
236
+ 'ffmpeg',
237
+ self._ffmpeg_parameters,
238
+ self._audio_path,
239
+ self._audio_parameters,
240
+ [],
241
+ self._headers,
242
+ live_stream,
243
+ ),
215
244
  )
216
- except LiveStreamFound:
217
- live_stream = True
218
- self.microphone.path = ' '.join(
219
- build_command(
220
- 'ffmpeg',
221
- self._ffmpeg_parameters,
222
- self._audio_path,
223
- self._audio_parameters,
224
- [],
225
- self._headers,
226
- live_stream,
227
- ),
228
- )
229
- except NoAudioSourceFound as e:
230
- if self._audio_flags & MediaStream.Flags.REQUIRED:
231
- raise e
245
+ except NoAudioSourceFound as e:
246
+ if self._audio_flags & MediaStream.Flags.REQUIRED:
247
+ raise e
248
+ self.microphone = None
249
+ else:
232
250
  self.microphone = None
233
251
 
234
252
  @staticmethod