warp-beacon 2.2.0__tar.gz → 2.2.1__tar.gz
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-2.2.0/warp_beacon.egg-info → warp_beacon-2.2.1}/PKG-INFO +1 -1
- warp_beacon-2.2.1/warp_beacon/__version__.py +2 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/scheduler/scheduler.py +33 -2
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/telegram/bot.py +6 -1
- {warp_beacon-2.2.0 → warp_beacon-2.2.1/warp_beacon.egg-info}/PKG-INFO +1 -1
- warp_beacon-2.2.0/warp_beacon/__version__.py +0 -2
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/LICENSE +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/MANIFEST.in +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/README.md +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/assets/placeholder.gif +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/etc/.gitignore +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/etc/accounts.json +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/etc/warp_beacon.conf +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/etc/warp_beacon.service +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/pyproject.toml +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/setup.cfg +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/setup.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/__init__.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/compress/__init__.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/compress/video.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/jobs/__init__.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/jobs/abstract.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/jobs/download_job.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/jobs/types.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/jobs/upload_job.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/mediainfo/__init__.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/mediainfo/abstract.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/mediainfo/audio.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/mediainfo/silencer.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/mediainfo/video.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/scheduler/__init__.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/scraper/__init__.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/scraper/abstract.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/scraper/account_selector.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/scraper/exceptions.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/scraper/instagram/__init__.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/scraper/instagram/instagram.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/scraper/youtube/__init__.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/scraper/youtube/abstract.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/scraper/youtube/music.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/scraper/youtube/shorts.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/scraper/youtube/youtube.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/storage/__init__.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/telegram/__init__.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/telegram/handlers.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/telegram/placeholder_message.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/telegram/utils.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/uploader/__init__.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon/warp_beacon.py +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon.egg-info/SOURCES.txt +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon.egg-info/dependency_links.txt +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon.egg-info/entry_points.txt +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon.egg-info/requires.txt +0 -0
- {warp_beacon-2.2.0 → warp_beacon-2.2.1}/warp_beacon.egg-info/top_level.txt +0 -0
@@ -1,4 +1,7 @@
|
|
1
|
+
import os
|
2
|
+
import time
|
1
3
|
import threading
|
4
|
+
import json
|
2
5
|
|
3
6
|
from warp_beacon.jobs import Origin
|
4
7
|
import warp_beacon
|
@@ -6,10 +9,12 @@ import warp_beacon
|
|
6
9
|
import logging
|
7
10
|
|
8
11
|
class IGScheduler(object):
|
12
|
+
state_file = "/var/warp_beacon/scheduler_state.json"
|
9
13
|
downloader = None
|
10
14
|
running = True
|
11
15
|
thread = None
|
12
16
|
event = None
|
17
|
+
state = {"remaining": 3600}
|
13
18
|
|
14
19
|
def __init__(self, downloader: warp_beacon.scraper.AsyncDownloader) -> None:
|
15
20
|
self.downloader = downloader
|
@@ -18,6 +23,23 @@ class IGScheduler(object):
|
|
18
23
|
def __del__(self) -> None:
|
19
24
|
self.stop()
|
20
25
|
|
26
|
+
def save_state(self) -> None:
|
27
|
+
try:
|
28
|
+
with open(self.state_file, 'w+', encoding="utf-8") as f:
|
29
|
+
f.write(json.dumps(self.state))
|
30
|
+
except Exception as e:
|
31
|
+
logging.error("Failed to save Scheduler state!")
|
32
|
+
logging.exception(e)
|
33
|
+
|
34
|
+
def load_state(self) -> None:
|
35
|
+
try:
|
36
|
+
if os.path.exists(self.state_file):
|
37
|
+
with open(self.state_file, 'r', encoding="utf-8") as f:
|
38
|
+
self.state = json.loads(f.read())
|
39
|
+
except Exception as e:
|
40
|
+
logging.error("Failed to load Scheduler state!")
|
41
|
+
logging.exception(e)
|
42
|
+
|
21
43
|
def start(self) -> None:
|
22
44
|
self.thread = threading.Thread(target=self.do_work)
|
23
45
|
self.thread.start()
|
@@ -55,11 +77,20 @@ class IGScheduler(object):
|
|
55
77
|
|
56
78
|
def do_work(self) -> None:
|
57
79
|
logging.info("Scheduler thread started ...")
|
80
|
+
self.load_state()
|
81
|
+
timeout = self.state["remaining"]
|
58
82
|
while self.running:
|
59
83
|
try:
|
60
84
|
logging.info("Scheduler waking up")
|
85
|
+
start_time = time.time()
|
61
86
|
self.validate_ig_session()
|
62
|
-
self.event.wait(timeout=
|
87
|
+
self.event.wait(timeout=timeout)
|
88
|
+
elapsed = time.time() - start_time
|
89
|
+
self.state["remaining"] = timeout - elapsed
|
90
|
+
|
91
|
+
if self.state["remaining"] <= 0:
|
92
|
+
self.state["remaining"] = 3600
|
63
93
|
except Exception as e:
|
64
94
|
logging.error("An error occurred in scheduler thread!")
|
65
|
-
logging.exception(e)
|
95
|
+
logging.exception(e)
|
96
|
+
self.save_state()
|
@@ -170,6 +170,7 @@ class Bot(object):
|
|
170
170
|
)
|
171
171
|
else:
|
172
172
|
args["video"] = job.tg_file_id.replace(":video", '')
|
173
|
+
args["caption"] = self.build_signature_caption(job)
|
173
174
|
else:
|
174
175
|
if job.placeholder_message_id:
|
175
176
|
args["media"] = InputMediaVideo(
|
@@ -200,6 +201,7 @@ class Bot(object):
|
|
200
201
|
)
|
201
202
|
else:
|
202
203
|
args["photo"] = job.tg_file_id.replace(":image", '')
|
204
|
+
args["caption"] = self.build_signature_caption(job)
|
203
205
|
else:
|
204
206
|
if job.placeholder_message_id:
|
205
207
|
args["media"] = InputMediaPhoto(
|
@@ -208,6 +210,7 @@ class Bot(object):
|
|
208
210
|
)
|
209
211
|
else:
|
210
212
|
args["photo"] = job.local_media_path
|
213
|
+
args["caption"] = self.build_signature_caption(job)
|
211
214
|
elif job.media_type == JobType.AUDIO:
|
212
215
|
if job.tg_file_id:
|
213
216
|
if job.placeholder_message_id:
|
@@ -239,10 +242,12 @@ class Bot(object):
|
|
239
242
|
if job.tg_file_id:
|
240
243
|
if job.placeholder_message_id:
|
241
244
|
args["media"] = InputMediaAnimation(
|
242
|
-
media=job.tg_file_id.replace(":animation", '')
|
245
|
+
media=job.tg_file_id.replace(":animation", ''),
|
246
|
+
caption=self.build_signature_caption(job)
|
243
247
|
)
|
244
248
|
else:
|
245
249
|
args["animation"] = job.tg_file_id.replace(":animation", '')
|
250
|
+
args["caption"] = self.build_signature_caption(job)
|
246
251
|
else:
|
247
252
|
if job.placeholder_message_id:
|
248
253
|
args["media"] = InputMediaAnimation(
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|