halib 0.1.29__tar.gz → 0.1.30__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 (32) hide show
  1. {halib-0.1.29/halib.egg-info → halib-0.1.30}/PKG-INFO +1 -1
  2. {halib-0.1.29 → halib-0.1.30}/halib/tele_noti.py +9 -3
  3. {halib-0.1.29 → halib-0.1.30/halib.egg-info}/PKG-INFO +1 -1
  4. {halib-0.1.29 → halib-0.1.30}/setup.py +1 -1
  5. {halib-0.1.29 → halib-0.1.30}/.gitignore +0 -0
  6. {halib-0.1.29 → halib-0.1.30}/GDriveFolder.txt +0 -0
  7. {halib-0.1.29 → halib-0.1.30}/LICENSE.txt +0 -0
  8. {halib-0.1.29 → halib-0.1.30}/README.md +0 -0
  9. {halib-0.1.29 → halib-0.1.30}/guide_publish_pip.pdf +0 -0
  10. {halib-0.1.29 → halib-0.1.30}/halib/__init__.py +0 -0
  11. {halib-0.1.29 → halib-0.1.30}/halib/cuda.py +0 -0
  12. {halib-0.1.29 → halib-0.1.30}/halib/filetype/__init__.py +0 -0
  13. {halib-0.1.29 → halib-0.1.30}/halib/filetype/csvfile.py +0 -0
  14. {halib-0.1.29 → halib-0.1.30}/halib/filetype/jsonfile.py +0 -0
  15. {halib-0.1.29 → halib-0.1.30}/halib/filetype/textfile.py +0 -0
  16. {halib-0.1.29 → halib-0.1.30}/halib/filetype/videofile.py +0 -0
  17. {halib-0.1.29 → halib-0.1.30}/halib/filetype/yamlfile.py +0 -0
  18. {halib-0.1.29 → halib-0.1.30}/halib/listop.py +0 -0
  19. {halib-0.1.29 → halib-0.1.30}/halib/online/__init__.py +0 -0
  20. {halib-0.1.29 → halib-0.1.30}/halib/online/gdrive.py +0 -0
  21. {halib-0.1.29 → halib-0.1.30}/halib/online/gdrive_mkdir.py +0 -0
  22. {halib-0.1.29 → halib-0.1.30}/halib/online/gdrive_test.py +0 -0
  23. {halib-0.1.29 → halib-0.1.30}/halib/online/projectmake.py +0 -0
  24. {halib-0.1.29 → halib-0.1.30}/halib/plot.py +0 -0
  25. {halib-0.1.29 → halib-0.1.30}/halib/system/__init__.py +0 -0
  26. {halib-0.1.29 → halib-0.1.30}/halib/system/cmd.py +0 -0
  27. {halib-0.1.29 → halib-0.1.30}/halib/system/filesys.py +0 -0
  28. {halib-0.1.29 → halib-0.1.30}/halib.egg-info/SOURCES.txt +0 -0
  29. {halib-0.1.29 → halib-0.1.30}/halib.egg-info/dependency_links.txt +0 -0
  30. {halib-0.1.29 → halib-0.1.30}/halib.egg-info/requires.txt +0 -0
  31. {halib-0.1.29 → halib-0.1.30}/halib.egg-info/top_level.txt +0 -0
  32. {halib-0.1.29 → halib-0.1.30}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: halib
3
- Version: 0.1.29
3
+ Version: 0.1.30
4
4
  Summary: Small library for common tasks
5
5
  Author: Hoang Van Ha
6
6
  Author-email: hoangvanhauit@gmail.com
@@ -7,12 +7,14 @@ import telegram
7
7
  import pandas as pd
8
8
 
9
9
  from rich.pretty import pprint
10
+ from rich.console import Console
10
11
  import plotly.graph_objects as go
11
12
 
12
13
  from .system import filesys as fs
13
14
  from .filetype import textfile, csvfile
14
15
 
15
16
  from argparse import ArgumentParser
17
+ tele_console = Console()
16
18
 
17
19
  def parse_args():
18
20
  parser = ArgumentParser(
@@ -90,7 +92,7 @@ def compose_message_and_img_path(
90
92
  return context_msg, img_path
91
93
 
92
94
 
93
- async def send_to_telegram(cfg_dict):
95
+ async def send_to_telegram(cfg_dict, interval_in_sec):
94
96
  # pprint(cfg_dict)
95
97
  token = cfg_dict["telegram"]["token"]
96
98
  chat_id = cfg_dict["telegram"]["chat_id"]
@@ -114,7 +116,11 @@ async def send_to_telegram(cfg_dict):
114
116
  out_img_scale,
115
117
  output_img_dir,
116
118
  )
117
- pprint('Sending message to telegram...')
119
+ # calculate the next time to send message
120
+ next_time = pd.Timestamp.now() + pd.Timedelta(seconds=interval_in_sec)
121
+ tele_console.rule()
122
+ tele_console.print("[green] Send message to telegram [/green]")
123
+ tele_console.print(f"[red] Next message will be sent at <{next_time}> [/red]")
118
124
  await bot.send_message(text=context_msg, chat_id=chat_id)
119
125
  if img_path:
120
126
  await bot.send_photo(chat_id=chat_id, photo=open(img_path, "rb"))
@@ -130,7 +136,7 @@ async def run_forever(cfg_path):
130
136
  interval_in_sec = int(interval_in_min * 60)
131
137
  pprint(f'Message will be sent every {interval_in_min} minutes or {interval_in_sec} seconds')
132
138
  while True:
133
- await send_to_telegram(cfg_dict)
139
+ await send_to_telegram(cfg_dict, interval_in_sec)
134
140
  await asyncio.sleep(interval_in_sec)
135
141
 
136
142
  async def main():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: halib
3
- Version: 0.1.29
3
+ Version: 0.1.30
4
4
  Summary: Small library for common tasks
5
5
  Author: Hoang Van Ha
6
6
  Author-email: hoangvanhauit@gmail.com
@@ -8,7 +8,7 @@ with open("requirements.txt") as f:
8
8
 
9
9
  setuptools.setup(
10
10
  name="halib",
11
- version="0.1.29",
11
+ version="0.1.30",
12
12
  author="Hoang Van Ha",
13
13
  author_email="hoangvanhauit@gmail.com",
14
14
  description="Small library for common tasks",
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