CliRemote 1.6.1__py3-none-any.whl → 1.6.2__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.
- {cliremote-1.6.1.dist-info → cliremote-1.6.2.dist-info}/METADATA +1 -1
- {cliremote-1.6.1.dist-info → cliremote-1.6.2.dist-info}/RECORD +8 -7
- remote/client_manager.py +34 -0
- remote/client_picker.py +0 -36
- remote/utils/__init__.py +0 -0
- {cliremote-1.6.1.dist-info → cliremote-1.6.2.dist-info}/WHEEL +0 -0
- {cliremote-1.6.1.dist-info → cliremote-1.6.2.dist-info}/licenses/LICENSE +0 -0
- {cliremote-1.6.1.dist-info → cliremote-1.6.2.dist-info}/top_level.txt +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
cliremote-1.6.
|
1
|
+
cliremote-1.6.2.dist-info/licenses/LICENSE,sha256=O-0zMbcEi6wXz1DiSdVgzMlQjJcNqNe5KDv08uYzqR0,1055
|
2
2
|
remote/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
3
|
remote/account_manager.py,sha256=u8yqcyq7Vl8LZ1rNlrEfwlJEbJiBzoSAlL3z2hhTzyc,9829
|
4
4
|
remote/account_viewer.py,sha256=MQoH5lOz24651EjhlzVwi6O5hVUAT7Q5fFU6ZHjBlsM,4243
|
@@ -8,8 +8,8 @@ remote/batch_manager.py,sha256=jVGhYVwHMKJd7f7JxcWjKlwr03dq0RaGD1KdkyYdb00,1051
|
|
8
8
|
remote/block_manager.py,sha256=R7UaQigr-hTRtjxjG3OvJdKhvp0mDpLaESp3Of1AYhs,5692
|
9
9
|
remote/caption_manager.py,sha256=ekgcZ_D1q8C24WP18TXxlM5eWTknJmw-KNXDfqlsnEw,966
|
10
10
|
remote/cleaner.py,sha256=gvPtkosGsf7Eb3zmYyeC44xB4HtCxlzKH3e3qLuVos4,5742
|
11
|
-
remote/client_manager.py,sha256=
|
12
|
-
remote/client_picker.py,sha256=
|
11
|
+
remote/client_manager.py,sha256=dI9ZKOVPDXsq6_9Hi5Y_E_zKWyhSaqOxjiyRlr0hG5Y,10158
|
12
|
+
remote/client_picker.py,sha256=6WDIabYhcXSwcCAuRUfJfh6V1ZXP2EiFdAnutK2qLTk,139
|
13
13
|
remote/config.py,sha256=VK0e96gEINRViKIq99CYYuYyaVZTLtlWlPKKkBd41Cg,2377
|
14
14
|
remote/device_manager.py,sha256=SUCONe1qa5jMHOMqqS27ATtv3CaqAT8cN9jNi7AI_Go,5813
|
15
15
|
remote/file_sender.py,sha256=5_3ptTkoFejhJhaSyzh-8y5l_k7frxFq9LS_WL5jsGc,3657
|
@@ -31,8 +31,9 @@ remote/speed_manager.py,sha256=fIWSQAP9qW8AHZtMZq0MrC4_nvxcTFU1SBU75kpRzB8,1115
|
|
31
31
|
remote/stop_manager.py,sha256=UXzKJTblEyQqCjp7fenvQ51Q96Unx05WeOiuFMdj25M,1151
|
32
32
|
remote/text_manager.py,sha256=C2wNSXPSCDu8NSD3RsfbKmUQMWOYd1B5N4tzy-Jsriw,2195
|
33
33
|
remote/username_manager.py,sha256=nMNdke-2FIv86xR1Y6rR-43oUoQu_3Khw8wEo54noXI,3388
|
34
|
+
remote/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
34
35
|
remote/utils/sqlite_utils.py,sha256=5i0oUXsBgKC_8qHZPJ-Gyhp9D1TwqKHVvuZRIhKpS6w,1260
|
35
|
-
cliremote-1.6.
|
36
|
-
cliremote-1.6.
|
37
|
-
cliremote-1.6.
|
38
|
-
cliremote-1.6.
|
36
|
+
cliremote-1.6.2.dist-info/METADATA,sha256=pXO0OVFiYv3MzWlY2qLDRHs0AhT33RGUf2hF3FGguDg,1202
|
37
|
+
cliremote-1.6.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
38
|
+
cliremote-1.6.2.dist-info/top_level.txt,sha256=yBZidJ6zCix_a2ubGlYaewvlzBFXWbckQt20dudxJ1E,7
|
39
|
+
cliremote-1.6.2.dist-info/RECORD,,
|
remote/client_manager.py
CHANGED
@@ -245,3 +245,37 @@ def remove_client_from_pool(phone_number: str) -> None:
|
|
245
245
|
client_pool.pop(phone_number, None)
|
246
246
|
client_locks.pop(phone_number, None)
|
247
247
|
logger.info("%s: removed from client_pool and client_locks", phone_number)
|
248
|
+
|
249
|
+
async def get_any_client(message=None) -> Optional[object]:
|
250
|
+
"""
|
251
|
+
یک کلاینت آماده برمیگرداند:
|
252
|
+
1) اگر کلاینت متصل در pool هست، همان را برمیگرداند.
|
253
|
+
2) وگرنه از بین active_accounts یکی را استارت میکند.
|
254
|
+
"""
|
255
|
+
# Use any connected client
|
256
|
+
for phone, cli in list(client_pool.items()):
|
257
|
+
try:
|
258
|
+
if getattr(cli, "is_connected", False):
|
259
|
+
logger.debug("get_any_client: using connected client %s", phone)
|
260
|
+
return cli
|
261
|
+
except Exception:
|
262
|
+
pass
|
263
|
+
|
264
|
+
# Start one if needed
|
265
|
+
accs = list(get_active_accounts())
|
266
|
+
if not accs:
|
267
|
+
logger.warning("get_any_client: no active accounts")
|
268
|
+
return None
|
269
|
+
|
270
|
+
random.shuffle(accs)
|
271
|
+
for phone in accs:
|
272
|
+
try:
|
273
|
+
cli = await get_or_start_client(phone)
|
274
|
+
if cli and getattr(cli, "is_connected", False):
|
275
|
+
logger.info("get_any_client: started %s", phone)
|
276
|
+
return cli
|
277
|
+
except Exception as e:
|
278
|
+
logger.warning("get_any_client: failed start %s: %s: %s", phone, type(e).__name__, e)
|
279
|
+
|
280
|
+
logger.error("get_any_client: could not get any client")
|
281
|
+
return None
|
remote/client_picker.py
CHANGED
@@ -2,39 +2,3 @@ import random
|
|
2
2
|
import logging
|
3
3
|
from typing import Optional
|
4
4
|
from .client_manager import client_pool, get_active_accounts, get_or_start_client
|
5
|
-
|
6
|
-
logger = logging.getLogger(__name__)
|
7
|
-
|
8
|
-
async def get_any_client(message=None) -> Optional[object]:
|
9
|
-
"""
|
10
|
-
یک کلاینت آماده برمیگرداند:
|
11
|
-
1) اگر کلاینت متصل در pool هست، همان را برمیگرداند.
|
12
|
-
2) وگرنه از بین active_accounts یکی را استارت میکند.
|
13
|
-
"""
|
14
|
-
# Use any connected client
|
15
|
-
for phone, cli in list(client_pool.items()):
|
16
|
-
try:
|
17
|
-
if getattr(cli, "is_connected", False):
|
18
|
-
logger.debug("get_any_client: using connected client %s", phone)
|
19
|
-
return cli
|
20
|
-
except Exception:
|
21
|
-
pass
|
22
|
-
|
23
|
-
# Start one if needed
|
24
|
-
accs = list(get_active_accounts())
|
25
|
-
if not accs:
|
26
|
-
logger.warning("get_any_client: no active accounts")
|
27
|
-
return None
|
28
|
-
|
29
|
-
random.shuffle(accs)
|
30
|
-
for phone in accs:
|
31
|
-
try:
|
32
|
-
cli = await get_or_start_client(phone)
|
33
|
-
if cli and getattr(cli, "is_connected", False):
|
34
|
-
logger.info("get_any_client: started %s", phone)
|
35
|
-
return cli
|
36
|
-
except Exception as e:
|
37
|
-
logger.warning("get_any_client: failed start %s: %s: %s", phone, type(e).__name__, e)
|
38
|
-
|
39
|
-
logger.error("get_any_client: could not get any client")
|
40
|
-
return None
|
remote/utils/__init__.py
ADDED
File without changes
|
File without changes
|
File without changes
|
File without changes
|