py-tgcalls 2.0.2__py3-none-any.whl → 2.0.3b1__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.0.2
3
+ Version: 2.0.3b1
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.8
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.2.0
190
+ Requires-Dist: ntgcalls >=1.2.1
191
191
  Requires-Dist: psutil
192
192
  Requires-Dist: screeninfo
193
193
  Requires-Dist: deprecation
@@ -1,8 +1,8 @@
1
1
  pytgcalls/__init__.py,sha256=TfZGf1enqqs50mBB406vygB6zYgn3vAjBYFUDO4Pviw,248
2
- pytgcalls/__version__.py,sha256=kumiGImhzOTlTrRM-6jDo2mNnVHGO_2vxtrhB0nzAiw,22
2
+ pytgcalls/__version__.py,sha256=Dad7olVOHlrvQf3XgEEUbhKmJE563n_WQb074VssEMU,24
3
3
  pytgcalls/environment.py,sha256=ctCHACvG6l8SdpPewSBhOvc70kbwpv18maC0TwLvZ08,1924
4
4
  pytgcalls/exceptions.py,sha256=0MmAktc53ajYAc7ThjD2tJ9PDyibUi0iHZMfUy2IoKs,4109
5
- pytgcalls/ffmpeg.py,sha256=sut7ssGcvprC3NWFpCfyguyNKAXaeM0mv3lXSvDPRpM,8518
5
+ pytgcalls/ffmpeg.py,sha256=xxtO1fokGjhPG4HDkPx3Qs-T4sXXX0zmuT5E0mU-BJg,8593
6
6
  pytgcalls/filters.py,sha256=HFMBBbo_NCw6wqTtseHoDRsspJHQ49BUHBA1cxm7u4g,4852
7
7
  pytgcalls/mtproto_required.py,sha256=6B-31p5qH_6oekUgypV4nK3hqPS6Nr-pA8S81wjnbaY,630
8
8
  pytgcalls/mutex.py,sha256=Frjji5Ctzlk4AXEBuBLnDK-7HbtreoV6zuyKpFpMNI4,236
@@ -12,7 +12,7 @@ pytgcalls/scaffold.py,sha256=LihXRBl1kSqJSQvEoH5rAXJXrbnnIqSMBYrhXpW5hHs,958
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
15
- pytgcalls/ytdlp.py,sha256=VqeWts_jgPJTmcOM5_rckuKEOA0N2FujaBWvX3CyXE0,2196
15
+ pytgcalls/ytdlp.py,sha256=jRA-mKQEXleWvaoGv9wtMa77aRjxsyQxn6_0tXI3-sA,2435
16
16
  pytgcalls/custom_api/__init__.py,sha256=ZT8d0lc2YrDuw_YSFAXXHHMewoXGFZ-ANOBIAr0vGFQ,60
17
17
  pytgcalls/custom_api/custom_api.py,sha256=Ko3aS6psrwPmOhRPxvG0fepXt4STrA0StvINSxz4Cj8,1890
18
18
  pytgcalls/handlers/__init__.py,sha256=pubbxI4pLqQpAKf8-toD6ija4cpSvbCJOQFjTiDjX1E,75
@@ -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=wU4WKEp4cMfJPVDW-aug69HrzXrMJHCKkqrv-pCxQkg,7307
34
+ pytgcalls/methods/stream/play.py,sha256=38eWJSXFYgq7VRm4AH6e1NJfe6nYTyJ71PbK3mFijHs,7280
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
@@ -78,16 +78,16 @@ pytgcalls/types/raw/__init__.py,sha256=ROHsKFeUMUtlFbx2rhfrdB-TuVm0zBuvNo29Ccn56
78
78
  pytgcalls/types/raw/audio_parameters.py,sha256=1DsBPwdn_Ukd2Tbkb3whP_ILo9xJY_3XNNmbO4_NO9Q,449
79
79
  pytgcalls/types/raw/audio_stream.py,sha256=wEMa93hHt0VBUSuS6gPJlFIGZp5GdNU94O2C2u4AXnY,476
80
80
  pytgcalls/types/raw/stream.py,sha256=jCvFUSAdHupqMqfG1E36CgKijKoy0o2LUbgcVjj5Mz0,491
81
- pytgcalls/types/raw/video_parameters.py,sha256=LXBpdaw5vyNayVfgtmF-gRkCY_ATwAnunRDs75FQJTw,545
81
+ pytgcalls/types/raw/video_parameters.py,sha256=9TeZhg2jTayr5U3ttBgLKg1mfyT7OC8RbqLqinzlM4k,628
82
82
  pytgcalls/types/raw/video_stream.py,sha256=2Chrk7NFWF1H9V7hH71RZ5rF3iBhT53syFkHKw4-5gc,433
83
83
  pytgcalls/types/stream/__init__.py,sha256=xfF-9ZulOLk3E6G1nw1Ky0ZRWXlFuER0Uj8HQn3650w,338
84
84
  pytgcalls/types/stream/audio_quality.py,sha256=4X94ErmTeLP4TVcE3eLtPPdtluSPxgxbgTosuNJOVhc,141
85
- pytgcalls/types/stream/media_stream.py,sha256=ZtREk2bjrBRnyKWdJWgxCa8z_NX7Oa02wUITcoI80m8,8860
85
+ pytgcalls/types/stream/media_stream.py,sha256=opMsQX7_XcUGrp_1b1xcYsojej8WSSdPpMB-RzVGclI,8926
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.2.dist-info/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
90
- py_tgcalls-2.0.2.dist-info/METADATA,sha256=0Fmju1o3_K53gft3sMZpLHnaPKlK6c4ioF660I5SYkM,14357
91
- py_tgcalls-2.0.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
92
- py_tgcalls-2.0.2.dist-info/top_level.txt,sha256=IUDUwn0KkcbUYZbCe9R5AUb2Ob-lmllNUGQqyeXXd8A,10
93
- py_tgcalls-2.0.2.dist-info/RECORD,,
89
+ py_tgcalls-2.0.3b1.dist-info/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
90
+ py_tgcalls-2.0.3b1.dist-info/METADATA,sha256=7wW6XiNXXjOQyDi1ZaJcMk5hEMOqgstlS4fFsfsRN48,14359
91
+ py_tgcalls-2.0.3b1.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
92
+ py_tgcalls-2.0.3b1.dist-info/top_level.txt,sha256=IUDUwn0KkcbUYZbCe9R5AUb2Ob-lmllNUGQqyeXXd8A,10
93
+ py_tgcalls-2.0.3b1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: setuptools (71.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
pytgcalls/__version__.py CHANGED
@@ -1 +1 @@
1
- __version__ = '2.0.2'
1
+ __version__ = '2.0.3b1'
pytgcalls/ffmpeg.py CHANGED
@@ -95,7 +95,10 @@ async def check_stream(
95
95
  new_w = min(original_width, stream_parameters.width)
96
96
  new_h = int(new_w / ratio)
97
97
 
98
- if new_h > stream_parameters.height:
98
+ if (
99
+ new_h > stream_parameters.height and
100
+ not stream_parameters.ratio_adjust
101
+ ):
99
102
  new_h = stream_parameters.height
100
103
  new_w = int(new_h * ratio)
101
104
 
@@ -52,7 +52,7 @@ class Play(Scaffold):
52
52
  try:
53
53
  return await self._binding.change_stream(
54
54
  chat_id,
55
- await StreamParams.get_stream_params(stream),
55
+ media_description,
56
56
  )
57
57
  except FileError as e:
58
58
  raise FileNotFoundError(e)
@@ -10,6 +10,7 @@ class VideoParameters(PyObject):
10
10
  width: int = 640,
11
11
  height: int = 360,
12
12
  frame_rate: int = 20,
13
+ ratio_adjust: bool = False,
13
14
  ):
14
15
  max_w, max_h, max_fps = max(
15
16
  VideoQuality, key=lambda x: x.value[0],
@@ -17,3 +18,4 @@ class VideoParameters(PyObject):
17
18
  self.width: int = min(width, max_w)
18
19
  self.height: int = min(height, max_h)
19
20
  self.frame_rate: int = min(frame_rate, max_fps)
21
+ self.ratio_adjust: bool = ratio_adjust
@@ -62,7 +62,10 @@ class MediaStream(Stream):
62
62
  if isinstance(video_parameters, VideoParameters):
63
63
  self._video_parameters = video_parameters
64
64
  elif isinstance(video_parameters, VideoQuality):
65
- self._video_parameters = VideoParameters(*video_parameters.value)
65
+ self._video_parameters = VideoParameters(
66
+ *video_parameters.value,
67
+ ratio_adjust=True,
68
+ )
66
69
 
67
70
  self._media_path: Optional[str] = None
68
71
  self._audio_path: Optional[str] = None
pytgcalls/ytdlp.py CHANGED
@@ -1,4 +1,5 @@
1
1
  import asyncio
2
+ import logging
2
3
  import re
3
4
  import shlex
4
5
  from typing import Optional
@@ -8,6 +9,8 @@ from .exceptions import YtDlpError
8
9
  from .ffmpeg import cleanup_commands
9
10
  from .types.raw import VideoParameters
10
11
 
12
+ py_logger = logging.getLogger('pytgcalls')
13
+
11
14
 
12
15
  class YtDlp:
13
16
  YOUTUBE_REGX = re.compile(
@@ -34,8 +37,10 @@ class YtDlp:
34
37
  'yt-dlp',
35
38
  '-g',
36
39
  '-f',
37
- f'best[width<=?{video_parameters.width}]'
38
- f'[height<=?{video_parameters.height}]',
40
+ 'bestvideo[vcodec~=\'(vp09|avc1)\']+m4a/best',
41
+ '-S',
42
+ 'res:'
43
+ f'{min(video_parameters.width, video_parameters.height)}',
39
44
  '--no-warnings',
40
45
  ]
41
46
 
@@ -52,6 +57,10 @@ class YtDlp:
52
57
 
53
58
  commands.append(link)
54
59
 
60
+ py_logger.log(
61
+ logging.DEBUG,
62
+ f'Running with "{" ".join(commands)}" command',
63
+ )
55
64
  try:
56
65
  proc = await asyncio.create_subprocess_exec(
57
66
  *commands,