warp-beacon 2.2.63__tar.gz → 2.2.64__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.
Files changed (56) hide show
  1. {warp_beacon-2.2.63/warp_beacon.egg-info → warp_beacon-2.2.64}/PKG-INFO +1 -1
  2. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/setup.py +2 -1
  3. warp_beacon-2.2.64/warp_beacon/__version__.py +2 -0
  4. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/scraper/__init__.py +4 -2
  5. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/scraper/fail_handler.py +4 -10
  6. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/storage/__init__.py +5 -11
  7. warp_beacon-2.2.64/warp_beacon/storage/mongo.py +22 -0
  8. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/telegram/bot.py +7 -2
  9. {warp_beacon-2.2.63 → warp_beacon-2.2.64/warp_beacon.egg-info}/PKG-INFO +1 -1
  10. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon.egg-info/SOURCES.txt +1 -0
  11. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon.egg-info/top_level.txt +1 -0
  12. warp_beacon-2.2.63/warp_beacon/__version__.py +0 -2
  13. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/LICENSE +0 -0
  14. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/MANIFEST.in +0 -0
  15. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/README.md +0 -0
  16. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/assets/placeholder.gif +0 -0
  17. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/etc/.gitignore +0 -0
  18. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/etc/accounts.json +0 -0
  19. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/etc/warp_beacon.conf +0 -0
  20. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/etc/warp_beacon.service +0 -0
  21. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/pyproject.toml +0 -0
  22. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/setup.cfg +0 -0
  23. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/__init__.py +0 -0
  24. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/compress/__init__.py +0 -0
  25. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/compress/video.py +0 -0
  26. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/jobs/__init__.py +0 -0
  27. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/jobs/abstract.py +0 -0
  28. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/jobs/download_job.py +0 -0
  29. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/jobs/types.py +0 -0
  30. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/jobs/upload_job.py +0 -0
  31. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/mediainfo/__init__.py +0 -0
  32. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/mediainfo/abstract.py +0 -0
  33. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/mediainfo/audio.py +0 -0
  34. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/mediainfo/silencer.py +0 -0
  35. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/mediainfo/video.py +0 -0
  36. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/scheduler/__init__.py +0 -0
  37. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/scheduler/scheduler.py +0 -0
  38. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/scraper/abstract.py +0 -0
  39. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/scraper/account_selector.py +0 -0
  40. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/scraper/exceptions.py +0 -0
  41. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/scraper/instagram/__init__.py +0 -0
  42. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/scraper/instagram/instagram.py +0 -0
  43. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/scraper/youtube/__init__.py +0 -0
  44. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/scraper/youtube/abstract.py +0 -0
  45. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/scraper/youtube/music.py +0 -0
  46. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/scraper/youtube/shorts.py +0 -0
  47. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/scraper/youtube/youtube.py +0 -0
  48. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/telegram/__init__.py +0 -0
  49. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/telegram/handlers.py +0 -0
  50. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/telegram/placeholder_message.py +0 -0
  51. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/telegram/utils.py +0 -0
  52. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/uploader/__init__.py +0 -0
  53. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon/warp_beacon.py +0 -0
  54. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon.egg-info/dependency_links.txt +0 -0
  55. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon.egg-info/entry_points.txt +0 -0
  56. {warp_beacon-2.2.63 → warp_beacon-2.2.64}/warp_beacon.egg-info/requires.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: warp_beacon
3
- Version: 2.2.63
3
+ Version: 2.2.64
4
4
  Summary: Telegram bot for expanding external media links
5
5
  Home-page: https://github.com/sb0y/warp_beacon
6
6
  Author: Andrey Bagrintsev
@@ -82,7 +82,8 @@ setup(
82
82
  "warp_beacon/scraper/youtube/youtube",
83
83
  "warp_beacon/scraper/youtube/shorts",
84
84
  "warp_beacon/scraper/youtube/music",
85
- "warp_beacon/scraper/fail_handler"
85
+ "warp_beacon/scraper/fail_handler",
86
+ "warp_beacon/storage/mongo"
86
87
  ],
87
88
  #scripts=['scripts/wait_dc_update.py'],
88
89
  data_files=[
@@ -0,0 +1,2 @@
1
+ __version__ = "2.2.64"
2
+
@@ -16,6 +16,7 @@ from warp_beacon.jobs.download_job import DownloadJob
16
16
  from warp_beacon.jobs.upload_job import UploadJob
17
17
  from warp_beacon.jobs.types import JobType
18
18
  from warp_beacon.scraper.account_selector import AccountSelector
19
+ from warp_beacon.storage.mongo import DBClient
19
20
  from warp_beacon.scraper.fail_handler import FailHandler
20
21
 
21
22
  import logging
@@ -33,9 +34,10 @@ class AsyncDownloader(object):
33
34
  manager = None
34
35
  acc_selector = None
35
36
  scheduler = None
36
- fail_handler = FailHandler()
37
+ fail_handler = None
37
38
 
38
- def __init__(self, uploader: AsyncUploader, workers_count: int) -> None:
39
+ def __init__(self, uploader: AsyncUploader, db_connect: DBClient, workers_count: int) -> None:
40
+ self.fail_handler = FailHandler(db_connect)
39
41
  self.manager = multiprocessing.Manager()
40
42
  self.allow_loop = self.manager.Value('i', 1)
41
43
  self.acc_selector = AccountSelector(self.manager, ACC_FILE)
@@ -1,8 +1,8 @@
1
1
  import os
2
2
 
3
3
  import pickle
4
- from pymongo import MongoClient
5
4
 
5
+ from warp_beacon.storage.mongo import DBClient
6
6
  from warp_beacon.jobs.download_job import DownloadJob
7
7
 
8
8
  import logging
@@ -10,17 +10,11 @@ import logging
10
10
  class FailHandler(object):
11
11
  client = None
12
12
  db = None
13
- def __init__(self) -> None:
14
- self.client = MongoClient(
15
- host=os.environ.get("MONGODB_HOST", default='127.0.0.1'),
16
- port=int(os.environ.get("MONGODB_PORT", default=27017)),
17
- username=os.environ.get("MONGODB_USER", default='root'),
18
- password=os.environ.get("MONGODB_PASSWORD", default="changeme"))
19
- self.db = self.client.media.failed_jobs
13
+ def __init__(self, client: DBClient) -> None:
14
+ self.db = client.client.media.failed_jobs
20
15
 
21
16
  def __del__(self) -> None:
22
- if self.client:
23
- self.client.close()
17
+ self.client.close()
24
18
 
25
19
  def store_failed_job(self, job: DownloadJob) -> int:
26
20
  db_id = -1
@@ -4,7 +4,7 @@ from enum import Enum
4
4
 
5
5
  from urllib.parse import urlparse, parse_qs
6
6
 
7
- from pymongo import MongoClient
7
+ from warp_beacon.storage.mongo import DBClient
8
8
 
9
9
  import logging
10
10
 
@@ -19,20 +19,14 @@ VIDEO_STORAGE_DIR = os.environ.get("VIDEO_STORAGE_DIR", default="/var/warp_beaco
19
19
  class Storage(object):
20
20
  client = None
21
21
  db = None
22
- def __init__(self) -> None:
22
+ def __init__(self, client: DBClient) -> None:
23
23
  if not os.path.isdir(VIDEO_STORAGE_DIR):
24
24
  os.mkdir(VIDEO_STORAGE_DIR)
25
-
26
- self.client = MongoClient(
27
- host=os.environ.get("MONGODB_HOST", default='127.0.0.1'),
28
- port=int(os.environ.get("MONGODB_PORT", default=27017)),
29
- username=os.environ.get("MONGODB_USER", default='root'),
30
- password=os.environ.get("MONGODB_PASSWORD", default="changeme"))
31
- self.db = self.client.media.media
25
+ self.client = client
26
+ self.db = self.client.client.media.media
32
27
 
33
28
  def __del__(self) -> None:
34
- if self.client:
35
- self.client.close()
29
+ self.client.close()
36
30
 
37
31
  @staticmethod
38
32
  def compute_uniq(url: str) -> str:
@@ -0,0 +1,22 @@
1
+ import os
2
+
3
+ from pymongo import MongoClient
4
+
5
+ class DBClient(object):
6
+ client = None
7
+
8
+ def __init__(self) -> None:
9
+ self.client = MongoClient(
10
+ host=os.environ.get("MONGODB_HOST", default='127.0.0.1'),
11
+ port=int(os.environ.get("MONGODB_PORT", default=27017)),
12
+ username=os.environ.get("MONGODB_USER", default='root'),
13
+ password=os.environ.get("MONGODB_PASSWORD", default="changeme")
14
+ )
15
+
16
+ def __del__(self) -> None:
17
+ self.close()
18
+
19
+ def close(self) -> None:
20
+ if self.client:
21
+ self.client.close()
22
+ self.client = None
@@ -15,6 +15,7 @@ import warp_beacon
15
15
  from warp_beacon.__version__ import __version__
16
16
  from warp_beacon.telegram.handlers import Handlers
17
17
  from warp_beacon.telegram.placeholder_message import PlaceholderMessage
18
+ from warp_beacon.storage.mongo import DBClient
18
19
  from warp_beacon.storage import Storage
19
20
  from warp_beacon.uploader import AsyncUploader
20
21
  from warp_beacon.jobs.upload_job import UploadJob
@@ -25,7 +26,7 @@ from warp_beacon.scheduler.scheduler import IGScheduler
25
26
  import logging
26
27
 
27
28
  class Bot(object):
28
- storage = Storage()
29
+ storage = None
29
30
  uploader = None
30
31
  downloader = None
31
32
  allow_loop = True
@@ -40,6 +41,9 @@ class Bot(object):
40
41
  format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=logging.INFO
41
42
  )
42
43
 
44
+ db_connect = DBClient()
45
+ self.storage = Storage(db_connect)
46
+
43
47
  logging.info("Starting Warp Beacon version '%s' ...", __version__)
44
48
 
45
49
  workers_amount = min(32, os.cpu_count() + 4)
@@ -71,7 +75,8 @@ class Bot(object):
71
75
  )
72
76
  self.downloader = warp_beacon.scraper.AsyncDownloader(
73
77
  workers_count=int(os.environ.get("WORKERS_POOL_SIZE", default=workers_amount)),
74
- uploader=self.uploader
78
+ uploader=self.uploader,
79
+ db_connect=db_connect
75
80
  )
76
81
 
77
82
  self.scheduler = IGScheduler(self.downloader)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: warp_beacon
3
- Version: 2.2.63
3
+ Version: 2.2.64
4
4
  Summary: Telegram bot for expanding external media links
5
5
  Home-page: https://github.com/sb0y/warp_beacon
6
6
  Author: Andrey Bagrintsev
@@ -45,6 +45,7 @@ warp_beacon/scraper/youtube/music.py
45
45
  warp_beacon/scraper/youtube/shorts.py
46
46
  warp_beacon/scraper/youtube/youtube.py
47
47
  warp_beacon/storage/__init__.py
48
+ warp_beacon/storage/mongo.py
48
49
  warp_beacon/telegram/__init__.py
49
50
  warp_beacon/telegram/bot.py
50
51
  warp_beacon/telegram/handlers.py
@@ -27,6 +27,7 @@ warp_beacon/scraper/youtube/music
27
27
  warp_beacon/scraper/youtube/shorts
28
28
  warp_beacon/scraper/youtube/youtube
29
29
  warp_beacon/storage
30
+ warp_beacon/storage/mongo
30
31
  warp_beacon/telegram
31
32
  warp_beacon/telegram/bot
32
33
  warp_beacon/telegram/handlers
@@ -1,2 +0,0 @@
1
- __version__ = "2.2.63"
2
-
File without changes
File without changes
File without changes
File without changes