warp-beacon 2.2.19__py3-none-any.whl → 2.2.21__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/scheduler/scheduler.py +4 -2
- warp_beacon/scraper/__init__.py +6 -6
- warp_beacon/scraper/account_selector.py +17 -15
- warp_beacon/scraper/youtube/abstract.py +1 -1
- warp_beacon/telegram/bot.py +2 -2
- {warp_beacon-2.2.19.dist-info → warp_beacon-2.2.21.dist-info}/METADATA +1 -1
- {warp_beacon-2.2.19.dist-info → warp_beacon-2.2.21.dist-info}/RECORD +12 -12
- {warp_beacon-2.2.19.dist-info → warp_beacon-2.2.21.dist-info}/LICENSE +0 -0
- {warp_beacon-2.2.19.dist-info → warp_beacon-2.2.21.dist-info}/WHEEL +0 -0
- {warp_beacon-2.2.19.dist-info → warp_beacon-2.2.21.dist-info}/entry_points.txt +0 -0
- {warp_beacon-2.2.19.dist-info → warp_beacon-2.2.21.dist-info}/top_level.txt +0 -0
warp_beacon/__version__.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
__version__ = "2.2.
|
1
|
+
__version__ = "2.2.21"
|
2
2
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import os
|
2
2
|
import time
|
3
|
+
from random import randrange
|
3
4
|
import threading
|
4
5
|
import json
|
5
6
|
|
@@ -14,7 +15,7 @@ class IGScheduler(object):
|
|
14
15
|
running = True
|
15
16
|
thread = None
|
16
17
|
event = None
|
17
|
-
state = {"remaining": 3600}
|
18
|
+
state = {"remaining": randrange(3600, 10800)}
|
18
19
|
|
19
20
|
def __init__(self, downloader: warp_beacon.scraper.AsyncDownloader) -> None:
|
20
21
|
self.downloader = downloader
|
@@ -81,7 +82,8 @@ class IGScheduler(object):
|
|
81
82
|
while self.running:
|
82
83
|
try:
|
83
84
|
if self.state["remaining"] <= 0:
|
84
|
-
self.state["remaining"] = 3600
|
85
|
+
self.state["remaining"] = randrange(3600, 10800)
|
86
|
+
logging.info("Next scheduler activity in '%s' seconds", self.state["remaining"])
|
85
87
|
|
86
88
|
start_time = time.time()
|
87
89
|
self.event.wait(timeout=self.state["remaining"])
|
warp_beacon/scraper/__init__.py
CHANGED
@@ -28,21 +28,21 @@ class AsyncDownloader(object):
|
|
28
28
|
uploader = None
|
29
29
|
workers_count = 0
|
30
30
|
auth_event = multiprocessing.Event()
|
31
|
+
manager = None
|
31
32
|
acc_selector = None
|
32
33
|
scheduler = None
|
33
34
|
|
34
35
|
def __init__(self, uploader: AsyncUploader, workers_count: int) -> None:
|
35
|
-
self.
|
36
|
+
self.manager = multiprocessing.Manager()
|
37
|
+
self.allow_loop = self.manager.Value('i', 1)
|
38
|
+
self.acc_selector = AccountSelector(self.manager, ACC_FILE)
|
36
39
|
self.uploader = uploader
|
37
40
|
self.workers_count = workers_count
|
38
|
-
AccountSelector.register('AccoutSelector', AccountSelector)
|
39
41
|
|
40
42
|
def __del__(self) -> None:
|
41
43
|
self.stop_all()
|
42
44
|
|
43
45
|
def start(self) -> None:
|
44
|
-
self.acc_selector = AccountSelector(ACC_FILE)
|
45
|
-
self.acc_selector.start()
|
46
46
|
for _ in range(self.workers_count):
|
47
47
|
proc = multiprocessing.Process(target=self.do_work, args=(self.acc_selector,))
|
48
48
|
self.workers.append(proc)
|
@@ -74,7 +74,7 @@ class AsyncDownloader(object):
|
|
74
74
|
if job.account_switches > self.acc_selector.count_service_accounts(job.job_origin):
|
75
75
|
raise AllAccountsFailed("All config accounts failed!")
|
76
76
|
if report_error:
|
77
|
-
selector.bump_acc_fail(
|
77
|
+
selector.bump_acc_fail(report_error)
|
78
78
|
selector.next()
|
79
79
|
cur_acc = selector.get_current()
|
80
80
|
logging.info("Current account: '%s'", str(cur_acc))
|
@@ -339,7 +339,7 @@ class AsyncDownloader(object):
|
|
339
339
|
#proc.terminate()
|
340
340
|
logging.info("process #%d stopped", proc.pid)
|
341
341
|
self.workers.clear()
|
342
|
-
self.
|
342
|
+
self.manager.shutdown()
|
343
343
|
|
344
344
|
def queue_task(self, job: DownloadJob) -> str:
|
345
345
|
self.job_queue.put_nowait(job)
|
@@ -1,25 +1,29 @@
|
|
1
|
+
import multiprocessing.managers
|
1
2
|
import os
|
2
3
|
import json
|
3
4
|
import re
|
4
5
|
|
6
|
+
import multiprocessing
|
5
7
|
from itertools import cycle
|
6
8
|
|
7
|
-
from multiprocessing.managers import BaseManager
|
8
|
-
|
9
9
|
from warp_beacon.jobs import Origin
|
10
10
|
|
11
11
|
import logging
|
12
12
|
|
13
|
-
class AccountSelector(
|
13
|
+
class AccountSelector(object):
|
14
14
|
accounts = []
|
15
15
|
acc_pool = None
|
16
16
|
current = None
|
17
17
|
current_module_name = None
|
18
|
-
index =
|
19
|
-
accounts_meta_data =
|
18
|
+
index = None
|
19
|
+
accounts_meta_data = None
|
20
20
|
session_dir = "/var/warp_beacon"
|
21
|
+
manager = None
|
21
22
|
|
22
|
-
def __init__(self, acc_file_path: str) -> None:
|
23
|
+
def __init__(self, manager: multiprocessing.managers.SyncManager, acc_file_path: str) -> None:
|
24
|
+
self.manager = manager
|
25
|
+
self.index = self.manager.Value('i', 0)
|
26
|
+
self.accounts_meta_data = self.manager.dict()
|
23
27
|
if os.path.exists(acc_file_path):
|
24
28
|
with open(acc_file_path, 'r', encoding="utf-8") as f:
|
25
29
|
self.accounts = json.loads(f.read())
|
@@ -28,8 +32,6 @@ class AccountSelector(BaseManager):
|
|
28
32
|
self.load_yt_sessions()
|
29
33
|
else:
|
30
34
|
raise ValueError("Accounts file not found")
|
31
|
-
|
32
|
-
super().__init__()
|
33
35
|
|
34
36
|
def __del__(self) -> None:
|
35
37
|
pass
|
@@ -65,22 +67,22 @@ class AccountSelector(BaseManager):
|
|
65
67
|
|
66
68
|
def next(self) -> dict:
|
67
69
|
self.current = next(self.acc_pool)
|
68
|
-
self.index = self.accounts[self.current_module_name].index(self.current)
|
69
|
-
logging.info("Next account index is '%d'", self.index)
|
70
|
+
self.index.value = self.accounts[self.current_module_name].index(self.current)
|
71
|
+
logging.info("Next account index is '%d'", self.index.value)
|
70
72
|
return self.current
|
71
73
|
|
72
74
|
def bump_acc_fail(self, key: str, amount: int = 1) -> int:
|
73
|
-
self.accounts_meta_data[self.index][key] += amount
|
74
|
-
return self.accounts_meta_data[self.index][key]
|
75
|
+
self.accounts_meta_data[self.index.value][key] += amount
|
76
|
+
return self.accounts_meta_data[self.index.value][key]
|
75
77
|
|
76
78
|
def how_much(self, key: str) -> int:
|
77
|
-
return self.accounts_meta_data[self.current_module_name][self.index][key]
|
79
|
+
return self.accounts_meta_data[self.current_module_name][self.index.value][key]
|
78
80
|
|
79
81
|
def get_current(self) -> tuple:
|
80
|
-
return (self.index, self.current)
|
82
|
+
return (self.index.value, self.current)
|
81
83
|
|
82
84
|
def get_meta_data(self) -> dict:
|
83
|
-
return self.accounts_meta_data[self.current_module_name][self.index]
|
85
|
+
return self.accounts_meta_data[self.current_module_name][self.index.value]
|
84
86
|
|
85
87
|
def count_service_accounts(self, mod_name: Origin) -> int:
|
86
88
|
module_name = 'youtube' if next((s for s in ("yt", "youtube", "youtu_be") if s in mod_name.value), None) else 'instagram'
|
@@ -119,7 +119,7 @@ class YoutubeAbstract(ScraperAbstract):
|
|
119
119
|
|
120
120
|
if aspect_ratio_height > 4:
|
121
121
|
image = image.resize((image.size[0], image.size[1]+new_image.size[1]))
|
122
|
-
height += new_image.size[1] -
|
122
|
+
height += new_image.size[1] - 10
|
123
123
|
|
124
124
|
paste_position = ((target_width - width) // 2, (target_height - height) // 2)
|
125
125
|
new_image.paste(image, paste_position)
|
warp_beacon/telegram/bot.py
CHANGED
@@ -319,8 +319,8 @@ class Bot(object):
|
|
319
319
|
args["message_id"] = job.placeholder_message_id
|
320
320
|
else:
|
321
321
|
args["disable_notification"] = True
|
322
|
-
|
323
|
-
args["reply_to_message_id"] = None
|
322
|
+
args["reply_to_message_id"] = job.message_id
|
323
|
+
#args["reply_to_message_id"] = None
|
324
324
|
|
325
325
|
if os.environ.get("ENABLE_DONATES", None) == "true" and job.media_type is not JobType.COLLECTION:
|
326
326
|
args["reply_markup"] = InlineKeyboardMarkup([[InlineKeyboardButton("❤ Donate", url=os.environ.get("DONATE_LINK", "https://pay.cryptocloud.plus/pos/W5BMtNQt5bJFoW2E"))]])
|
@@ -3,7 +3,7 @@ lib/systemd/system/warp_beacon.service,sha256=lPmHqLqcI2eIV7nwHS0qcALQrznixqJuww
|
|
3
3
|
var/warp_beacon/accounts.json,sha256=rKFQM_b9eoDS4mJ1B_SZNolPLXx1SQdQMdY2F_ZcBt8,1523
|
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=0VvRp3QIXuNbjaFFHlf0gX_0Z28tQEwSicNLwPGUsd8,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
|
@@ -18,28 +18,28 @@ warp_beacon/mediainfo/audio.py,sha256=ous88kwQj4bDIChN5wnGil5LqTs0IQHH0d-nyrL0-Z
|
|
18
18
|
warp_beacon/mediainfo/silencer.py,sha256=MgUc9Ibbhjhg9GbJMNfJqrdDkMsQShZkQ1sCwvW_-qI,1647
|
19
19
|
warp_beacon/mediainfo/video.py,sha256=DXHiWAOyJPSVXQ0OP7uOBikUFT7noFmMaMSIx04Mhs4,2506
|
20
20
|
warp_beacon/scheduler/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
21
|
-
warp_beacon/scheduler/scheduler.py,sha256=
|
22
|
-
warp_beacon/scraper/__init__.py,sha256=
|
21
|
+
warp_beacon/scheduler/scheduler.py,sha256=fetiuISHa-PqwZB0YHx56T9rmHHwKzYCMzd162iEIlQ,2562
|
22
|
+
warp_beacon/scraper/__init__.py,sha256=3M1nHOXwa4-vFA4jbK7YaYZN-Pk4auxwb43H5v-gqdI,14984
|
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=3bWyrtDREi8K4HlUMYWoGvZjvoL2rtNvyOk-mJAMQ3Q,3161
|
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=PpEammUP_InX5xj-sFJY6DkAUfIut2rqQsXd0uCtKOo,13579
|
28
28
|
warp_beacon/scraper/youtube/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
29
|
-
warp_beacon/scraper/youtube/abstract.py,sha256=
|
29
|
+
warp_beacon/scraper/youtube/abstract.py,sha256=_zqGs0vZ36LIN9DUSvOSml8_VSDMEEKo-Q38Dvau7_s,7635
|
30
30
|
warp_beacon/scraper/youtube/music.py,sha256=nbTDFdgXGbTNqttE828DEgvSc8-SuAsQAHeqUwU6yFM,1484
|
31
31
|
warp_beacon/scraper/youtube/shorts.py,sha256=RqMYDq4XHChtp-LdlxXyHej4h3NI3Qi9T8USxwk-pIk,1177
|
32
32
|
warp_beacon/scraper/youtube/youtube.py,sha256=JvN5pVz0jtxCY9FGMl1dIg5Ccr2Kulaoxtym0Vb1QwQ,2224
|
33
33
|
warp_beacon/storage/__init__.py,sha256=m86MDXBMtZZsTPLI2cD-pM5Xkh2g2NYVvp_dtW8eH0Q,3548
|
34
34
|
warp_beacon/telegram/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
35
|
-
warp_beacon/telegram/bot.py,sha256=
|
35
|
+
warp_beacon/telegram/bot.py,sha256=KAdtL-Fc0Jw0aztk8FtefCLPao7UP0gJkHMC5_mHJvs,15387
|
36
36
|
warp_beacon/telegram/handlers.py,sha256=xSNG_v4D4FaA5q1_5wXvJkjcDUhy5GaQnfpijJZpnPk,7039
|
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.21.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
41
|
+
warp_beacon-2.2.21.dist-info/METADATA,sha256=3YAlBp6uLDP-PWSi_Fi4N6VKzUyW_gCnVfZ9rMzCufI,21251
|
42
|
+
warp_beacon-2.2.21.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
|
43
|
+
warp_beacon-2.2.21.dist-info/entry_points.txt,sha256=eSB61Rb89d56WY0O-vEIQwkn18J-4CMrJcLA_R_8h3g,119
|
44
|
+
warp_beacon-2.2.21.dist-info/top_level.txt,sha256=ALb_Ft_eG-OY4_m0TWUifNUOZsrx483L-zw7G7vqXoc,971
|
45
|
+
warp_beacon-2.2.21.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|