py-tgcalls 2.1.0rc5__py3-none-any.whl → 2.1.0rc7__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.2
2
2
  Name: py-tgcalls
3
- Version: 2.1.0rc5
3
+ Version: 2.1.0rc7
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.0b15
190
+ Requires-Dist: ntgcalls<1.4.0,>=1.3.0b16
191
191
  Requires-Dist: deprecation
192
192
  Provides-Extra: pyrogram
193
193
  Requires-Dist: pyrogram>=1.2.20; extra == "pyrogram"
@@ -1,5 +1,5 @@
1
1
  pytgcalls/__init__.py,sha256=qbfwN7rYwIdCegMOzdcbvwazeNjDzgmowgcqLFNqKIM,308
2
- pytgcalls/__version__.py,sha256=QOpSP6brHLnWSrYC2nLbY_xxiEX1aNYsOQKAr2glkNA,26
2
+ pytgcalls/__version__.py,sha256=sHPVCG9vm1uyYD2Lwwg8Z_oKmpyxUnjDJ487XMAemkM,26
3
3
  pytgcalls/environment.py,sha256=ctCHACvG6l8SdpPewSBhOvc70kbwpv18maC0TwLvZ08,1924
4
4
  pytgcalls/exceptions.py,sha256=dBKyH--HyEJk6-DzfzXvG3M1fuDSRuF2LWu7XKhV-WY,4263
5
5
  pytgcalls/ffmpeg.py,sha256=tm6DBxyNfPh3h3an-b2s9x1UyX-cvkCdov9prlXxVZY,8649
@@ -34,7 +34,7 @@ pytgcalls/methods/stream/__init__.py,sha256=mAcOih0-NT6T_Gspej6mySpJNPuEe46sUwgK
34
34
  pytgcalls/methods/stream/mute.py,sha256=ZrZS_EeNUeUxb6UgbdhwXUdRX826u-qSjH5a6sg7LsE,557
35
35
  pytgcalls/methods/stream/pause.py,sha256=-kNvWQuv5VlssNcL-M6rkT5TKFmXlbOzJrDny95qsUc,560
36
36
  pytgcalls/methods/stream/play.py,sha256=-Ld5TQWLhU_ktKrb7q1Xrym36UGrWhaenIbjj-3mM3k,7524
37
- pytgcalls/methods/stream/record.py,sha256=28mFK2azDv6gUziwcj4ybvrYka9P9VXnUXnuAa1aQ5w,1466
37
+ pytgcalls/methods/stream/record.py,sha256=p9td2tZ4-QMpY8I8LDc1PrFVN3g-vlDINF5I7CmLsvA,1567
38
38
  pytgcalls/methods/stream/resume.py,sha256=AUHU3AtpXO2rtp2V1EKSC_KAWTk2KHMiHaqHluYy31M,563
39
39
  pytgcalls/methods/stream/send_frame.py,sha256=Kj9R8OqUM-g7pt-FiWP-US7sCFkH5ciPr9S8v-WPtLg,1062
40
40
  pytgcalls/methods/stream/time.py,sha256=65Hc5pQaN6z6nxgwT9Zxgsnl_UosvMkcICqE2hisNWA,659
@@ -45,13 +45,13 @@ pytgcalls/methods/utilities/call_holder.py,sha256=MhIbwCG6DROd9_bHGa6aqu-rB0y4sn
45
45
  pytgcalls/methods/utilities/compose.py,sha256=Nzdv8orMmka5NIBZ1SW1nsqXRzArZl4m6FdZU7syaR4,334
46
46
  pytgcalls/methods/utilities/cpu_usage.py,sha256=Mbga4MFCIwuh7WC8sqBbv1Pa6ALcp5AIDyfYMH_Bix4,162
47
47
  pytgcalls/methods/utilities/idle.py,sha256=MDdzHTv1ws2yBhsvhBUnssGdghkZ2KwR0HUCPOwV38o,814
48
- pytgcalls/methods/utilities/join_presentation.py,sha256=HLpVjhDkbMB6mIsCwdaGy-Ct7IaV44fM5-zOQ9M7bLU,1551
48
+ pytgcalls/methods/utilities/join_presentation.py,sha256=gvxmFVzf6xsQZ4bPOz5wK8oZ0up1QD0DB2HpO5JcpGw,1671
49
49
  pytgcalls/methods/utilities/log_retries.py,sha256=6nD9J3350t82I0PKzK1pVx3ZaCBHATReiXYMs3PuVhQ,342
50
50
  pytgcalls/methods/utilities/ping.py,sha256=hhIMSHk2BzMB-IKpwLdZFVrsEvGm2ftJwKLs1k4anh8,244
51
51
  pytgcalls/methods/utilities/resolve_chat_id.py,sha256=92x2LHbUlnJMm-kS3fXOYmzYpY2TZbqtQD2rw3eBXDY,382
52
52
  pytgcalls/methods/utilities/run.py,sha256=cnYQd2xB5Cr_WS0Q2cXJZPGiN6JOCULzj1r4xXVyrlg,152
53
- pytgcalls/methods/utilities/start.py,sha256=u9ahFbhE7sUTt8p8Lkam1eWor4Ys5lAmE35-SedMf0M,14387
54
- pytgcalls/methods/utilities/stream_params.py,sha256=OE673Bt1CiyCBFQGMPtC05zv3nObP3zirrh4OD9USdg,3109
53
+ pytgcalls/methods/utilities/start.py,sha256=Qc-uP9B6fgHtNOfjKJfgtYnWTY8JeIb6PSLmWPFXLOk,14376
54
+ pytgcalls/methods/utilities/stream_params.py,sha256=fOSloo1A7WTxaZEtOiPXjdexMeoJjq8CZtfHuIFX7Ns,3325
55
55
  pytgcalls/methods/utilities/update_sources.py,sha256=ISF6u3rk4IcVrPOEOB-uZUDfnwUp2_y1_2g9GboXpWM,1562
56
56
  pytgcalls/mtproto/__init__.py,sha256=X4zvzFG7km7qHyE0fdvA550WcOVO_xl_p__gvIfDGmw,130
57
57
  pytgcalls/mtproto/bridged_client.py,sha256=hktnfpfBK7PEL2n7Y0kBZzI7dkLlsdrDwkYliZki8zQ,5915
@@ -95,12 +95,12 @@ pytgcalls/types/stream/direction.py,sha256=VepLMe-dXg4M5eVdVyIb2uxYvnpB9OJL5fEgP
95
95
  pytgcalls/types/stream/external_media.py,sha256=RiuSX5tZGdNsQZ8LIRk5Lp4Ksv9oTvaccmInJRZYo4M,114
96
96
  pytgcalls/types/stream/frame.py,sha256=TXo5HZVHbbaVNBqulMhTqGODXH3bpBVlN_of1rosNUQ,586
97
97
  pytgcalls/types/stream/media_stream.py,sha256=jNWNJppX2ji4CrHdkF2b6FFLeiS9KKjVDGvcWPmPrvc,11917
98
- pytgcalls/types/stream/record_stream.py,sha256=VEKB2rSnb4U1EyoPdNteWxJ65feV58EGu5QmDEJiB2E,3037
98
+ pytgcalls/types/stream/record_stream.py,sha256=RWeD9U-sqUmb_PuZQxYnExZyoibepU_8oI2yrH2Y18c,3135
99
99
  pytgcalls/types/stream/stream_ended.py,sha256=xR_kZwFf03hA6rw_nvI7Be7GwoCKzQf_1MKaGpPDXqY,716
100
100
  pytgcalls/types/stream/stream_frames.py,sha256=028ZhNV-mN3BGqMlmxusAV1xDQpXRYCeM0WXBZhRUhA,446
101
101
  pytgcalls/types/stream/video_quality.py,sha256=HBfWq005kh-D19MaVE9VzVdnODzrXf4IJUimCfslfiU,231
102
- py_tgcalls-2.1.0rc5.dist-info/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
103
- py_tgcalls-2.1.0rc5.dist-info/METADATA,sha256=8P8bWfrdmyEeRawMa2mgY62U8rgWRdp6x09fz4_2Jxo,14331
104
- py_tgcalls-2.1.0rc5.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
105
- py_tgcalls-2.1.0rc5.dist-info/top_level.txt,sha256=IUDUwn0KkcbUYZbCe9R5AUb2Ob-lmllNUGQqyeXXd8A,10
106
- py_tgcalls-2.1.0rc5.dist-info/RECORD,,
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,,
pytgcalls/__version__.py CHANGED
@@ -1 +1 @@
1
- __version__ = '2.1.0.rc5'
1
+ __version__ = '2.1.0.rc7'
@@ -1,10 +1,12 @@
1
1
  import logging
2
+ from pathlib import Path
2
3
  from typing import Optional
3
4
  from typing import Union
4
5
 
5
6
  from ntgcalls import FileError
6
7
  from ntgcalls import StreamMode
7
8
 
9
+ from ...media_devices import SpeakerDevice
8
10
  from ...mtproto_required import mtproto_required
9
11
  from ...scaffold import Scaffold
10
12
  from ...statictypes import statictypes
@@ -22,7 +24,7 @@ class Record(Scaffold):
22
24
  async def record(
23
25
  self,
24
26
  chat_id: Union[int, str],
25
- stream: Optional[Stream] = None,
27
+ stream: Optional[Union[str, Path, Stream, SpeakerDevice]] = None,
26
28
  config: Optional[Union[CallConfig, GroupCallConfig]] = None,
27
29
  ):
28
30
  chat_id = await self.resolve_chat_id(chat_id)
@@ -1,5 +1,6 @@
1
1
  from typing import Union
2
2
 
3
+ from ntgcalls import ConnectionError
3
4
  from ntgcalls import TelegramServerError
4
5
 
5
6
  from ...scaffold import Scaffold
@@ -40,7 +41,10 @@ class JoinPresentation(Scaffold):
40
41
  self._log_retries(retries)
41
42
  finally:
42
43
  self._wait_connect.pop(chat_id, None)
43
- elif chat_id in self._call_sources:
44
- await self._binding.stop_presentation(chat_id)
45
- await self._app.leave_presentation(chat_id)
44
+ elif chat_id in self._presentations:
45
+ try:
46
+ await self._binding.stop_presentation(chat_id)
47
+ await self._app.leave_presentation(chat_id)
48
+ except ConnectionError:
49
+ pass
46
50
  self._presentations.discard(chat_id)
@@ -272,7 +272,7 @@ class Start(Scaffold):
272
272
  chat_id: int,
273
273
  net_state: NetworkInfo,
274
274
  ):
275
- state = net_state.connection_state
275
+ state = net_state.state
276
276
  if state == ConnectionState.CONNECTING:
277
277
  return
278
278
  if chat_id in self._wait_connect:
@@ -7,6 +7,7 @@ from ntgcalls import MediaDescription
7
7
  from ntgcalls import VideoDescription
8
8
 
9
9
  from ...media_devices.input_device import InputDevice
10
+ from ...media_devices.speaker_device import SpeakerDevice
10
11
  from ...types import RecordStream
11
12
  from ...types.raw import AudioStream
12
13
  from ...types.raw import Stream
@@ -75,12 +76,14 @@ class StreamParams:
75
76
 
76
77
  @staticmethod
77
78
  async def get_record_params(
78
- stream: Optional[Stream],
79
+ stream: Optional[Union[str, Path, Stream, SpeakerDevice]],
79
80
  ) -> MediaDescription:
80
81
  if stream is not None:
82
+ if isinstance(stream, (str, Path, SpeakerDevice)):
83
+ stream = RecordStream(stream)
81
84
  if isinstance(stream, MediaStream):
82
85
  raise ValueError(
83
86
  'Stream should be an instance of '
84
87
  'RecordStream or a raw Stream',
85
88
  )
86
- return StreamParams._parse_stream_description(stream)
89
+ return StreamParams._parse_stream_description(stream) # type: ignore
@@ -1,3 +1,4 @@
1
+ from pathlib import Path
1
2
  from typing import Union
2
3
 
3
4
  from ntgcalls import MediaSource
@@ -16,7 +17,7 @@ class RecordStream(Stream):
16
17
  @statictypes
17
18
  def __init__(
18
19
  self,
19
- audio: Union[bool, str, SpeakerDevice] = False,
20
+ audio: Union[bool, str, Path, SpeakerDevice] = False,
20
21
  audio_parameters: Union[
21
22
  AudioParameters,
22
23
  AudioQuality,
@@ -46,6 +47,8 @@ class RecordStream(Stream):
46
47
  path='',
47
48
  parameters=raw_audio_parameters,
48
49
  )
50
+ if isinstance(audio, Path):
51
+ audio = str(audio)
49
52
  if isinstance(audio, str):
50
53
  is_lossless = raw_audio_parameters.bitrate > 48000
51
54
  commands = [