Skip to content

Commit

Permalink
Merge pull request #14 from fxxkrlab/develop
Browse files Browse the repository at this point in the history
Update version 0.2.0-beta.6.2 (merged from develop branch)
  • Loading branch information
fxxkrlab authored Jul 27, 2020
2 parents 115df17 + 377efe6 commit 1ae5c0e
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 22 deletions.
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.1-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.2-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
9 changes: 9 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# iCopy v0.2 CHANGELOG

## version 0.2.0-beta.6.2

+ Update :
+ ADD : Add "rmdir" operation to the "/Purge" function to clear the empty folder in the root directory.

+ Fixbugs :
+ FIX : "/dedupe" sendMsg error.
+ FIX : Insert DATABASE error while dedupe payload finished.

## version 0.2.0-beta.6.1

+ Update :
Expand Down
13 changes: 9 additions & 4 deletions utils/dedupe_payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
)
mydb = myclient[load.cfg["database"]["db_name"]]
task_list = mydb["task_list"]
fav_col = mydb["fav_col"]

_cfg = load.cfg

Expand Down Expand Up @@ -62,11 +63,11 @@ def dedupe_task(

last_dedupe_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())

task_list.update_one(
{"_id": int(dedu_task_id)}, {"$set": {"last_dedupe_time": last_dedupe_time,}},
)

if dedu_task_id == 0:
fav_col.update_one(
{"G_id": dedu_id}, {"$set": {"last_dedupe_time": last_dedupe_time,}},
)

deduped_msg = (
" ༺ ✪iCopy✪ ༻ | "
+ "🏳️"
Expand All @@ -80,6 +81,10 @@ def dedupe_task(
)

else:
task_list.update_one(
{"_id": int(dedu_task_id)}, {"$set": {"last_dedupe_time": last_dedupe_time,}},
)

deduped_msg = (
" ༺ ✪iCopy✪ ༻ | "
+ "🏳️" + _text[_lang]["current_task_id"]
Expand Down
2 changes: 1 addition & 1 deletion utils/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


### local version
_version = "v0.2.0-beta.6.1"
_version = "v0.2.0-beta.6.2"

_cfgFile_RAW = os.path.abspath(os.path.join("config", "conf.toml"))
cfg = toml.load(_cfgFile_RAW)
Expand Down
24 changes: 17 additions & 7 deletions utils/purge_payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,32 @@

def purge_fav(purge_chat_id, purge_message_id, fav_id, fav_name):
cloner = _cfg["general"]["cloner"]
option = "delete"
option1 = "delete"
option2 = "rmdir"
remote = _cfg["general"]["remote"]
src_id = fav_id
src_block = remote + ":" + "{" + src_id + "}"
checkers = "--checkers=" + f"{_cfg['general']['parallel_c']}"
transfers = "--transfers=" + f"{_cfg['general']['parallel_t']}"
flags = ["--drive-trashed-only", "--drive-use-trash=false", "--rmdirs", "-q"]
rmdirs = "--rmdirs"
flags = ["--drive-trashed-only", "--drive-use-trash=false", "-q"]
sa_sleep = "--drive-pacer-min-sleep=" + f"{_cfg['general']['min_sleep']}"

command = [cloner, option, src_block, checkers, transfers, sa_sleep]
command += flags
command1 = [cloner, option1, src_block, rmdirs, checkers, transfers, sa_sleep]
command1 += flags

purging_process = subprocess.Popen(
command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=False,
command2 = [cloner, option2, src_block, checkers, transfers, sa_sleep]
command2 += flags

purging_process1 = subprocess.Popen(
command1, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=False,
)
purging_process1.communicate()

purging_process2 = subprocess.Popen(
command2, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=False,
)
purging_process.communicate()
purging_process2.communicate()

last_purge_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())

Expand Down
10 changes: 1 addition & 9 deletions workflow/dedupe_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,21 +176,13 @@ def dedupe_fav_mode(update, context):
reply_markup=_KB.dedupe_mode_keyboard(),
)

dedu_chat_id = dedu_msg.chat_id
dedu_message_id = dedu_msg.message_id

return _stage.FAV_PRE_DEDU_INFO


def pre_favdedu_info(update, context):
print(update.callback_query.data)
print(dedufav_callback)

dedu_mode = update.callback_query.data

dedu_msg = bot.edit_message_text(
chat_id=update.callback_query.message.chat_id,
message_id=update.callback_query.message.message_id,
dedu_msg = update.callback_query.edit_message_text(
text=_text[_lang]["ready_to_dedupe"],
reply_markup=None,
)
Expand Down

0 comments on commit 1ae5c0e

Please sign in to comment.