Skip to content

Commit

Permalink
Merge pull request #20 from fxxkrlab/develop
Browse files Browse the repository at this point in the history
Update version 0.2.0-beta.6.7 (Merged from develop branch)
  • Loading branch information
fxxkrlab authored Aug 1, 2020
2 parents c523f0e + 274f461 commit d13a471
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 45 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ element.md
now_work.md
web/
sanic/
examples/
examples/
config/conf copy.toml
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

[![iCopy Telegram-Bot](https://img.shields.io/badge/iCopy-Telegram%20BOT-red?style=flat-square&logo=appveyor)](https://bbs.jsu.net/c/official-project/icopy/6)
[![Programming Language](https://img.shields.io/badge/LANGUAGE-Python%203.6%2B-success?style=flat-square&logo=appveyor)](https://bbs.jsu.net/c/official-project/icopy/6)
[![Version](https://img.shields.io/badge/Version-0.2.0--beta.6.6-ff69b4?style=flat-square&logo=appveyor)](https://bbs.jsu.net/c/official-project/icopy/6)
[![Version](https://img.shields.io/badge/Version-0.2.0--beta.6.7-ff69b4?style=flat-square&logo=appveyor)](https://bbs.jsu.net/c/official-project/icopy/6)
[![License](https://img.shields.io/github/license/fxxkrlab/iCopy?style=flat-square&logo=appveyor)](https://bbs.jsu.net/c/official-project/icopy/6)
[![DATABASE](https://img.shields.io/badge/DATABASE-MongoDB-brightgreen?style=flat-square&logo=appveyor)](https://github.com/mongodb/mongo)
[![Stars](https://img.shields.io/github/stars/fxxkrlab/iCopy?style=flat-square&logo=appveyor)](https://github.com/fxxkrlab/iCopy)
Expand Down
10 changes: 10 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# iCopy v0.2 CHANGELOG

## version 0.2.0-beta.6.7

+ Update :
+ ADD : renew requirements.txt.
+ ADD : "\_\_version\_\_"

+ Fixbugs :
+ Compatible with the old version of the database format
+ Fix floatify format error when the size is 0

## version 0.2.0-beta.6.6

+ Update :
Expand Down
4 changes: 2 additions & 2 deletions iCopy.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
task_box as _box,
task_payload as _payload,
callback_stage as _stage,
__version__,
)

from workflow import (
Expand Down Expand Up @@ -129,7 +130,6 @@ def stop_and_restart():
progress.terminate()
load.myclient.close()
updater.stop()
#os.execl(sys.executable, os.path.abspath(__file__), *sys.argv)
os.execl(sys.executable, sys.executable, *sys.argv)

def restart(update, context):
Expand Down Expand Up @@ -166,7 +166,7 @@ def restart(update, context):
dp.add_error_handler(_func.error)

updater.start_polling()
logger.info(f"Fxxkr LAB iCopy {load._version} Start")
logger.info("Fxxkr LAB iCopy " + __version__.__version__ + " Start")
updater.idle()


Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ protobuf==3.12.2
pymongo[srv]==3.10.1
toml==0.10.1
python-telegram-bot==12.8
urllib3==1.25.9
urllib3==1.25.9
requests==2.24.0
2 changes: 2 additions & 0 deletions utils/__version__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
### local version
__version__ = "v0.2.0-beta.6.7"
3 changes: 2 additions & 1 deletion utils/get_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
task_box as _box,
task_payload as _payload,
callback_stage as _stage,
__version__,
)
from workflow import copy_workflow as _copy
from utils.load import _lang, _text
Expand Down Expand Up @@ -220,7 +221,7 @@ def check_restart(bot):
def _version(update, context):
update.message.reply_text(
"Welcome to use iCopy Telegram BOT\n\n"
f"Current Version : {load._version}\n\n"
"Current Version : " + __version__.__version__ + "\n\n"
f"Latest Version : {_get_ver()}"
)

Expand Down
2 changes: 0 additions & 2 deletions utils/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
from telegram.utils.request import Request as TGRequest
from telegram import Bot

### local version
_version = "v0.2.0-beta.6.6"

_cfgFile_RAW = os.path.abspath(os.path.join("config", "conf.toml"))
cfg = toml.load(_cfgFile_RAW)
Expand Down
114 changes: 77 additions & 37 deletions utils/task_payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,44 +296,84 @@ def task_process(chat_id, command, task, ns):
)
check_is_reset = task_list.find_one({"_id": task["_id"]})
if check_is_reset['is_reset'] == 0:
task_list.update_one(
{"_id": task["_id"]},
{
"$set": {
"status": 1,
"start_time": start_time,
"finished_time": finished_time,
"task_current_prog_num": int(task_current_prog_num),
"task_total_prog_num": int(task_total_prog_num),
"task_current_prog_size": float(task_current_prog_size),
"task_total_prog_size": float(task_total_prog_size),
"task_current_prog_size_tail": task_current_prog_size_tail,
"task_total_prog_size_tail": task_total_prog_size_tail,
"dst_endpoint_link": dst_endpoint_link,
"dst_endpoint_id": dst_endpoint_id["id"],
}
},
)
if task_total_prog_size != 0 and task_current_prog_size != 0:
task_list.update_one(
{"_id": task["_id"]},
{
"$set": {
"status": 1,
"start_time": start_time,
"finished_time": finished_time,
"task_current_prog_num": int(task_current_prog_num),
"task_total_prog_num": int(task_total_prog_num),
"task_current_prog_size": float(task_current_prog_size),
"task_total_prog_size": float(task_total_prog_size),
"task_current_prog_size_tail": task_current_prog_size_tail,
"task_total_prog_size_tail": task_total_prog_size_tail,
"dst_endpoint_link": dst_endpoint_link,
"dst_endpoint_id": dst_endpoint_id["id"],
}
},
)
else:
task_list.update_one(
{"_id": task["_id"]},
{
"$set": {
"status": 1,
"start_time": start_time,
"finished_time": finished_time,
"task_current_prog_num": int(task_current_prog_num),
"task_total_prog_num": int(task_total_prog_num),
"task_current_prog_size": int(task_current_prog_size),
"task_total_prog_size": int(task_total_prog_size),
"task_current_prog_size_tail": task_current_prog_size_tail,
"task_total_prog_size_tail": task_total_prog_size_tail,
"dst_endpoint_link": dst_endpoint_link,
"dst_endpoint_id": dst_endpoint_id["id"],
}
},
)

if check_is_reset['is_reset'] == 1:
task_list.update_one(
{"_id": task["_id"]},
{
"$set": {
"status": 1,
"start_time": start_time,
"finished_time": finished_time,
"task_current_prog_num": int(task_current_prog_num) + check_is_reset['task_current_prog_num'],
"task_total_prog_num": int(task_total_prog_num) + check_is_reset['task_total_prog_num'],
"task_current_prog_size": 0,
"task_total_prog_size": 0,
"task_current_prog_size_tail": "",
"task_total_prog_size_tail": "",
"dst_endpoint_link": dst_endpoint_link,
"dst_endpoint_id": dst_endpoint_id["id"],
}
},
)
elif check_is_reset['is_reset'] == 1:
if "task_current_prog_num" and "task_total_prog_num" in check_is_reset:
task_list.update_one(
{"_id": task["_id"]},
{
"$set": {
"status": 1,
"start_time": start_time,
"finished_time": finished_time,
"task_current_prog_num": int(task_current_prog_num) + check_is_reset['task_current_prog_num'],
"task_total_prog_num": int(task_total_prog_num) + check_is_reset['task_total_prog_num'],
"task_current_prog_size": 0,
"task_total_prog_size": 0,
"task_current_prog_size_tail": "",
"task_total_prog_size_tail": "",
"dst_endpoint_link": dst_endpoint_link,
"dst_endpoint_id": dst_endpoint_id["id"],
}
},
)
else:
task_list.update_one(
{"_id": task["_id"]},
{
"$set": {
"status": 1,
"start_time": start_time,
"finished_time": finished_time,
"task_current_prog_num": int(task_current_prog_num),
"task_total_prog_num": int(task_total_prog_num),
"task_current_prog_size": 0,
"task_total_prog_size": 0,
"task_current_prog_size_tail": "",
"task_total_prog_size_tail": "",
"dst_endpoint_link": dst_endpoint_link,
"dst_endpoint_id": dst_endpoint_id["id"],
}
},
)

if ns.x == 1:
bot.edit_message_text(
Expand Down

0 comments on commit d13a471

Please sign in to comment.