Skip to content

Commit

Permalink
some clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Fallen-Breath committed Apr 3, 2020
1 parent 01ac3f8 commit 1ce8c1b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 37 deletions.
35 changes: 0 additions & 35 deletions QuickBackupM.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
'share': 2,
'list': 0,
}
SharePath = '/home/shared'
OverwriteBackupFolder = 'overwrite'
ServerPath = './server'
HelpMessage = '''------MCD Multi Quick Backup------
Expand All @@ -32,7 +31,6 @@
§7{0} back §6[<slot>]§r §c回档§r为槽位§6<slot>§r的存档。当§6<slot>§r参数被指定时将会§c回档§r为槽位§6<slot>§r
§7{0} confirm§r 在执行back后使用,再次确认是否进行§c回档§r
§7{0} abort§r 在任何时候键入此指令可中断§c回档§r
§7{0} share §6[<slot>]§r 将槽位§6<slot>§r的存档放至内服云盘
§7{0} list§r 显示各槽位的存档信息
当§6<slot>§r未被指定时默认选择槽位§61§r
§a【例子】§r
Expand All @@ -45,7 +43,6 @@
abort_restore = False
creating_backup = False
restoring_backup = False
sharing_backup = False
'''
mcd_root/
server/
Expand Down Expand Up @@ -287,35 +284,6 @@ def kick_bots(server, info):
pass


def share_backup(server, info, slot):
info_message(server, info, '此指令已被禁用')
return
global sharing_backup
if sharing_backup:
info_message(server, info, '正在分享存档至云盘中,请不要重复输入')
return
sharing_backup = True
try:
ret = slot_check(server, info, slot)
if ret is None:
return
else:
slot, slot_info = ret

dir_name = slot_info['time'].replace(' ', '_')
info_message(server, info, '传输中...请稍等')
if SharePath == '': # wtf r u doing
info_message(server, info, '[ERROR] WRONG SHARE PATH WTF')
return
else:
os.system('ssh root@192.168.0.0 "rm -rf {}/*" > nul'.format(SharePath))
for world in WorldNames:
os.system('scp -r {}/{} root@192.168.0.0:{}/{} > nul'.format(get_slot_folder(slot), world, SharePath, dir_name))
info_message(server, info, '已经成功分享到内服云盘')
finally:
sharing_backup = False


def list_backup(server, info):
for i in range(SlotCount):
info_message(server, info, '[槽位§6{}§r] {}'.format(i + 1, format_slot_info(slot_number=i + 1)))
Expand Down Expand Up @@ -364,9 +332,6 @@ def onServerInfo(server, info):
# abort
elif cmdLen == 1 and command[0] == 'abort':
trigger_abort(server, info)
# share [<slot>]
elif cmdLen in [1, 2] and command[0] == 'share':
share_backup(server, info, command[1] if cmdLen == 2 else '1')
# list
elif cmdLen == 1 and command[0] == 'list':
list_backup(server, info)
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ mcd_root/

`!!qb abort` 在任何时候键入此指令可中断回档

`!!qb share` 分享存档至指定目录。在 TIS 服务器中使用,其他环境下忽略即可

`!!qb list` 显示各槽位的存档信息

`<slot>` 未被指定时默认选择槽位 `1`
Expand Down

0 comments on commit 1ce8c1b

Please sign in to comment.