warp-beacon 2.2.35__py3-none-any.whl → 2.2.37__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.
- warp_beacon/__version__.py +1 -1
- warp_beacon/scraper/account_selector.py +15 -16
- {warp_beacon-2.2.35.dist-info → warp_beacon-2.2.37.dist-info}/METADATA +1 -1
- {warp_beacon-2.2.35.dist-info → warp_beacon-2.2.37.dist-info}/RECORD +8 -8
- {warp_beacon-2.2.35.dist-info → warp_beacon-2.2.37.dist-info}/LICENSE +0 -0
- {warp_beacon-2.2.35.dist-info → warp_beacon-2.2.37.dist-info}/WHEEL +0 -0
- {warp_beacon-2.2.35.dist-info → warp_beacon-2.2.37.dist-info}/entry_points.txt +0 -0
- {warp_beacon-2.2.35.dist-info → warp_beacon-2.2.37.dist-info}/top_level.txt +0 -0
warp_beacon/__version__.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
__version__ = "2.2.
|
1
|
+
__version__ = "2.2.37"
|
2
2
|
|
@@ -4,7 +4,6 @@ import json
|
|
4
4
|
import re
|
5
5
|
|
6
6
|
import multiprocessing
|
7
|
-
from itertools import islice, cycle
|
8
7
|
|
9
8
|
from warp_beacon.jobs import Origin
|
10
9
|
|
@@ -12,26 +11,24 @@ import logging
|
|
12
11
|
|
13
12
|
class AccountSelector(object):
|
14
13
|
accounts = []
|
15
|
-
acc_pools = {}
|
16
14
|
current = None
|
17
15
|
current_module_name = None
|
18
|
-
index = None
|
19
16
|
accounts_meta_data = None
|
20
17
|
session_dir = "/var/warp_beacon"
|
21
18
|
manager = None
|
19
|
+
account_index = {}
|
22
20
|
|
23
21
|
def __init__(self, manager: multiprocessing.managers.SyncManager, acc_file_path: str) -> None:
|
24
22
|
self.manager = manager
|
25
|
-
self.index = self.manager.Value('i', 0)
|
26
23
|
self.accounts_meta_data = self.manager.dict()
|
27
24
|
if os.path.exists(acc_file_path):
|
28
25
|
with open(acc_file_path, 'r', encoding="utf-8") as f:
|
29
26
|
self.accounts = json.loads(f.read())
|
30
27
|
if self.accounts:
|
31
28
|
self.__init_meta_data()
|
32
|
-
self.load_yt_sessions()
|
29
|
+
#self.load_yt_sessions()
|
33
30
|
for acc_type, _ in self.accounts.items():
|
34
|
-
self.
|
31
|
+
self.account_index[acc_type] = self.manager.Value('i', 0)
|
35
32
|
else:
|
36
33
|
raise ValueError("Accounts file not found")
|
37
34
|
|
@@ -65,27 +62,29 @@ class AccountSelector(object):
|
|
65
62
|
module_name = 'youtube' if next((s for s in ("yt", "youtube", "youtu_be") if s in module_origin.value), None) else 'instagram'
|
66
63
|
self.current_module_name = module_name
|
67
64
|
if self.current is None:
|
68
|
-
self.current = self.accounts[self.current_module_name][self.
|
69
|
-
#self.acc_pools[self.current_module_name] = next(islice(self.acc_pools[self.current_module_name], self.index.value, None))
|
65
|
+
self.current = self.accounts[self.current_module_name][self.account_index[self.current_module_name].value]
|
70
66
|
|
71
67
|
def next(self) -> dict:
|
72
|
-
|
73
|
-
|
74
|
-
|
68
|
+
idx = self.account_index[self.current_module_name].value + 1
|
69
|
+
if idx > len(self.accounts[self.current_module_name]) - 1:
|
70
|
+
idx = 0
|
71
|
+
self.current = self.accounts[self.current_module_name][idx]
|
72
|
+
self.account_index[self.current_module_name].value = idx
|
73
|
+
logging.info("Selected account index is '%d'", idx)
|
75
74
|
return self.current
|
76
75
|
|
77
76
|
def bump_acc_fail(self, key: str, amount: int = 1) -> int:
|
78
|
-
self.accounts_meta_data[self.
|
79
|
-
return self.accounts_meta_data[self.
|
77
|
+
self.accounts_meta_data[self.account_index[self.current_module_name].value][key] += amount
|
78
|
+
return self.accounts_meta_data[self.account_index[self.current_module_name].value][key]
|
80
79
|
|
81
80
|
def how_much(self, key: str) -> int:
|
82
|
-
return self.accounts_meta_data[self.current_module_name][self.
|
81
|
+
return self.accounts_meta_data[self.current_module_name][self.account_index[self.current_module_name].value][key]
|
83
82
|
|
84
83
|
def get_current(self) -> tuple:
|
85
|
-
return (self.
|
84
|
+
return (self.account_index[self.current_module_name].value, self.current)
|
86
85
|
|
87
86
|
def get_meta_data(self) -> dict:
|
88
|
-
return self.accounts_meta_data[self.current_module_name][self.
|
87
|
+
return self.accounts_meta_data[self.current_module_name][self.account_index[self.current_module_name].value]
|
89
88
|
|
90
89
|
def count_service_accounts(self, mod_name: Origin) -> int:
|
91
90
|
module_name = 'youtube' if next((s for s in ("yt", "youtube", "youtu_be") if s in mod_name.value), None) else 'instagram'
|
@@ -3,7 +3,7 @@ lib/systemd/system/warp_beacon.service,sha256=lPmHqLqcI2eIV7nwHS0qcALQrznixqJuww
|
|
3
3
|
var/warp_beacon/accounts.json,sha256=2QQMS9N_Z-TnfZq4U1vSUe4IKyZGmTFdgo8BoF4hQ7E,1710
|
4
4
|
var/warp_beacon/placeholder.gif,sha256=cE5CGJVaop4Sx21zx6j4AyoHU0ncmvQuS2o6hJfEH88,6064
|
5
5
|
warp_beacon/__init__.py,sha256=_rThNODmz0nDp_n4mWo_HKaNFE5jk1_7cRhHyYaencI,163
|
6
|
-
warp_beacon/__version__.py,sha256=
|
6
|
+
warp_beacon/__version__.py,sha256=OC9XQZrrf1WGc0eo7JqsLtEzJYDebrXz2uyeO7knuPM,24
|
7
7
|
warp_beacon/warp_beacon.py,sha256=7KEtZDj-pdhtl6m-zFLsSojs1ZR4o7L0xbqtdmYPvfE,342
|
8
8
|
warp_beacon/compress/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
9
|
warp_beacon/compress/video.py,sha256=_PDMVYCyzLYxHv1uZmmzGcG_8rjaZr7BTXsXTTy_oS4,2846
|
@@ -21,7 +21,7 @@ warp_beacon/scheduler/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
|
|
21
21
|
warp_beacon/scheduler/scheduler.py,sha256=oKuDP3RqUQmNYBorKxnhz9QqA-eLTJHVTinWbsYB530,2585
|
22
22
|
warp_beacon/scraper/__init__.py,sha256=tkl7UyfqFcvPlxomVPB9GpWQvAoADaM6jGb_bmx1zRY,15229
|
23
23
|
warp_beacon/scraper/abstract.py,sha256=aNZ9ypF9B8BjflcIwi-7wEzIqF-XPeF0xvfX9CP_iIw,2708
|
24
|
-
warp_beacon/scraper/account_selector.py,sha256=
|
24
|
+
warp_beacon/scraper/account_selector.py,sha256=5jJyH7AdIKfbme0YGZ8AYl7_0S6sQpsx9PVHyrK0YmM,3514
|
25
25
|
warp_beacon/scraper/exceptions.py,sha256=lHsPrYy5iYnHsIdUHqRxZmzlqrkNj_TS4TkiTJfWhTs,1326
|
26
26
|
warp_beacon/scraper/instagram/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
27
27
|
warp_beacon/scraper/instagram/instagram.py,sha256=D_r6Kdpe4iBjCeGv-vVIodiVnZps6ZyBbaY0JC7mGWI,13782
|
@@ -37,9 +37,9 @@ warp_beacon/telegram/handlers.py,sha256=xSNG_v4D4FaA5q1_5wXvJkjcDUhy5GaQnfpijJZp
|
|
37
37
|
warp_beacon/telegram/placeholder_message.py,sha256=32U-R_IMPRJd-S5UwlpemLkArJOxCmO7whcynduSbMA,6418
|
38
38
|
warp_beacon/telegram/utils.py,sha256=CeWXMwyzv2l4Af6I-wW2ySU490c-5k82sBhkjabv0n4,2452
|
39
39
|
warp_beacon/uploader/__init__.py,sha256=rsUkzzmtaeQY-kNkcIiPsrayS9idFKY3hBC71mR19XE,4743
|
40
|
-
warp_beacon-2.2.
|
41
|
-
warp_beacon-2.2.
|
42
|
-
warp_beacon-2.2.
|
43
|
-
warp_beacon-2.2.
|
44
|
-
warp_beacon-2.2.
|
45
|
-
warp_beacon-2.2.
|
40
|
+
warp_beacon-2.2.37.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
41
|
+
warp_beacon-2.2.37.dist-info/METADATA,sha256=Twiq89DxzzK_T0EDU6rdw-w1wXHrBClWa5KrBUjS1dk,21251
|
42
|
+
warp_beacon-2.2.37.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
|
43
|
+
warp_beacon-2.2.37.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
|
44
|
+
warp_beacon-2.2.37.dist-info/top_level.txt,sha256=ALb_Ft_eG-OY4_m0TWUifNUOZsrx483L-zw7G7vqXoc,971
|
45
|
+
warp_beacon-2.2.37.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|