warp-beacon 1.0.7__tar.gz → 1.0.8__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 (34) hide show
  1. {warp_beacon-1.0.7/warp_beacon.egg-info → warp_beacon-1.0.8}/PKG-INFO +1 -1
  2. {warp_beacon-1.0.7 → warp_beacon-1.0.8}/etc/warp_beacon.conf +2 -1
  3. warp_beacon-1.0.8/warp_beacon/__version__.py +2 -0
  4. {warp_beacon-1.0.7 → warp_beacon-1.0.8}/warp_beacon/mediainfo/video.py +25 -12
  5. {warp_beacon-1.0.7 → warp_beacon-1.0.8/warp_beacon.egg-info}/PKG-INFO +1 -1
  6. warp_beacon-1.0.7/warp_beacon/__version__.py +0 -2
  7. {warp_beacon-1.0.7 → warp_beacon-1.0.8}/LICENSE +0 -0
  8. {warp_beacon-1.0.7 → warp_beacon-1.0.8}/MANIFEST.in +0 -0
  9. {warp_beacon-1.0.7 → warp_beacon-1.0.8}/README.md +0 -0
  10. {warp_beacon-1.0.7 → warp_beacon-1.0.8}/assets/placeholder.gif +0 -0
  11. {warp_beacon-1.0.7 → warp_beacon-1.0.8}/etc/.gitignore +0 -0
  12. {warp_beacon-1.0.7 → warp_beacon-1.0.8}/etc/warp_beacon.service +0 -0
  13. {warp_beacon-1.0.7 → warp_beacon-1.0.8}/pyproject.toml +0 -0
  14. {warp_beacon-1.0.7 → warp_beacon-1.0.8}/setup.cfg +0 -0
  15. {warp_beacon-1.0.7 → warp_beacon-1.0.8}/setup.py +0 -0
  16. {warp_beacon-1.0.7 → warp_beacon-1.0.8}/warp_beacon/__init__.py +0 -0
  17. {warp_beacon-1.0.7 → warp_beacon-1.0.8}/warp_beacon/compress/__init__.py +0 -0
  18. {warp_beacon-1.0.7 → warp_beacon-1.0.8}/warp_beacon/compress/video.py +0 -0
  19. {warp_beacon-1.0.7 → warp_beacon-1.0.8}/warp_beacon/jobs/__init__.py +0 -0
  20. {warp_beacon-1.0.7 → warp_beacon-1.0.8}/warp_beacon/jobs/abstract.py +0 -0
  21. {warp_beacon-1.0.7 → warp_beacon-1.0.8}/warp_beacon/jobs/download_job.py +0 -0
  22. {warp_beacon-1.0.7 → warp_beacon-1.0.8}/warp_beacon/jobs/upload_job.py +0 -0
  23. {warp_beacon-1.0.7 → warp_beacon-1.0.8}/warp_beacon/mediainfo/__init__.py +0 -0
  24. {warp_beacon-1.0.7 → warp_beacon-1.0.8}/warp_beacon/scrapler/__init__.py +0 -0
  25. {warp_beacon-1.0.7 → warp_beacon-1.0.8}/warp_beacon/scrapler/abstract.py +0 -0
  26. {warp_beacon-1.0.7 → warp_beacon-1.0.8}/warp_beacon/scrapler/instagram.py +0 -0
  27. {warp_beacon-1.0.7 → warp_beacon-1.0.8}/warp_beacon/storage/__init__.py +0 -0
  28. {warp_beacon-1.0.7 → warp_beacon-1.0.8}/warp_beacon/uploader/__init__.py +0 -0
  29. {warp_beacon-1.0.7 → warp_beacon-1.0.8}/warp_beacon/warp_beacon.py +0 -0
  30. {warp_beacon-1.0.7 → warp_beacon-1.0.8}/warp_beacon.egg-info/SOURCES.txt +0 -0
  31. {warp_beacon-1.0.7 → warp_beacon-1.0.8}/warp_beacon.egg-info/dependency_links.txt +0 -0
  32. {warp_beacon-1.0.7 → warp_beacon-1.0.8}/warp_beacon.egg-info/entry_points.txt +0 -0
  33. {warp_beacon-1.0.7 → warp_beacon-1.0.8}/warp_beacon.egg-info/requires.txt +0 -0
  34. {warp_beacon-1.0.7 → warp_beacon-1.0.8}/warp_beacon.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: warp_beacon
3
- Version: 1.0.7
3
+ Version: 1.0.8
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
@@ -1,10 +1,11 @@
1
1
  TG_TOKEN=""
2
2
  INSTAGRAM_LOGIN=""
3
3
  INSTAGRAM_PASSWORD=""
4
- INSTAGRAM_VERIFICATION_CODE=""
4
+ INSTAGRAM_VERIFICATION_CODE="933917"
5
5
  MONGODB_HOST="mongodb"
6
6
  MONGODB_PORT="27017"
7
7
  MONGODB_USER="root"
8
8
  MONGODB_PASSWORD="changeme"
9
9
  VIDEO_STORAGE_DIR="/var/warp_beacon/videos"
10
10
  WORKERS_POOL_SIZE=3
11
+ ENABLE_DONATES=true
@@ -0,0 +1,2 @@
1
+ __version__ = "1.0.8"
2
+
@@ -43,13 +43,17 @@ class VideoInfo(object):
43
43
  res = {}
44
44
  res.update(self.get_demensions())
45
45
  if "duration" not in except_info:
46
- res["duration"] = self.get_duration()
46
+ res["duration"] = int(self.get_duration())
47
47
  if "filesize" not in except_info:
48
- res["filesize"] = VideoInfo.get_filesize(self.filename)
48
+ res["filesize"] = round(VideoInfo.get_filesize(self.filename), 2)
49
49
  return res
50
50
 
51
51
  def shrink_image_to_fit(self, image: Image, size: tuple = (320, 320)) -> Image:
52
52
  image.thumbnail(size, Image.Resampling.LANCZOS)
53
+ #image.save(
54
+ # "/tmp/test.th.jpg",
55
+ # quality=80,
56
+ #)
53
57
  return image
54
58
 
55
59
  def generate_thumbnail(self) -> Union[io.BytesIO, None]:
@@ -59,17 +63,26 @@ class VideoInfo(object):
59
63
  # Signal that we only want to look at keyframes.
60
64
  stream = container.streams.video[0]
61
65
  stream.codec_context.skip_frame = "NONKEY"
62
- time_base = stream.time_base
63
- framerate = stream.average_rate
64
- frame_container_pts = round((60 / framerate) / time_base)
65
- container.seek(frame_container_pts, backward=True, stream=stream)
66
- frame = next(container.decode(video=0))
66
+ frame_num = 10
67
+ time_base = container.streams.video[0].time_base
68
+ framerate = container.streams.video[0].average_rate
69
+ frame_container_pts = round((frame_num / framerate) / time_base)
70
+
71
+ container.seek(frame_container_pts, backward=True, stream=container.streams.video[0])
72
+ frame = next(container.decode(stream))
73
+
67
74
  image = frame.to_image()
68
- image = self.shrink_image_to_fit(image)
69
- io_buf = io.BytesIO()
70
- io_buf.seek(0)
71
- image.save(io_buf, format='JPEG')
72
- return io_buf
75
+ #image.save(
76
+ # "/tmp/test.{:04d}.jpg".format(frame.pts),
77
+ # quality=80,
78
+ #)
79
+ #break
80
+ if image:
81
+ image = self.shrink_image_to_fit(image)
82
+ io_buf = io.BytesIO()
83
+ image.save(io_buf, format='JPEG')
84
+ io_buf.seek(0)
85
+ return io_buf
73
86
  except Exception as e:
74
87
  logging.error("Failed to generate thumbnail!")
75
88
  logging.exception(e)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: warp_beacon
3
- Version: 1.0.7
3
+ Version: 1.0.8
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
@@ -1,2 +0,0 @@
1
- __version__ = "1.0.7"
2
-
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes