Skip to content

Commit

Permalink
无感备份;备份不修改备份列表
Browse files Browse the repository at this point in the history
  • Loading branch information
delta1037 committed Feb 19, 2024
1 parent ac74a9b commit 93cf173
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 6 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ dmypy.json
.tmp/
*_result.json
release/
config.json
dumped_pages/
config_multi.json
buffer_file/
Expand Down
6 changes: 4 additions & 2 deletions api/notion_dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
NotionDump.TMP_DIR = os.path.normpath(SEVER_ABS_PATH + "/buffer_file") + "/"
NotionDump.BUFFER_FILE = os.path.normpath(NotionDump.TMP_DIR + "/notion_download_buffer.json")

VERSION = "3.0.0"
VERSION = "3.0.1"


class NotionBackup:
Expand Down Expand Up @@ -180,7 +180,9 @@ def start_dump_multi(self):
dump_status = False

# 更新备份列表
backup_handle.update_backup_list(success_back_list)
auto_check_off = self.config.get_key("auto_check_off", "multi", default=True)
if auto_check_off:
backup_handle.update_backup_list(success_back_list)

# 新增备份日志
if dump_log != "":
Expand Down
72 changes: 72 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"*backup_type": "multi",
"single": {
"*backup_token": "secret_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"*page_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"-page_type": "page",
"-dump_path": "测试-功能测试2",
"export_child_page": true,
"page_parser_type": "md",
"db_parser_type": "md",
"db_insert_type": "content"
},
"multi": {
"*backup_token": "secret_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"*backup_info_token": "secret_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"*backup_list_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"*backup_log_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"backup_list_map": {
"page_id": "页面ID",
"page_type": "页面类型",
"dump_path": "备份位置",
"dump_status": "备份",
"db_insert_type": "数据库嵌入类型"
},
"backup_log_map": {
"title": "时间戳",
"date": "备份时间",
"status": "备份状态",
"log": "备注"
},
"auto_check_off": true
},
"use_buffer": true,
"debug": false,
"auto_close": true,
"page_properties": true,
"datetime_formate": "%Y/%m/%d-%H:%M:%S",
"date_formate": "%Y/%m/%d",
"file_with_link": false,
"color_theme": "light",
"your_color_theme": {
"f_gray": "#787774",
"f_brown": "#9F6B53",
"f_orange": "#D9730D",
"f_yellow": "#CB912F",
"f_green": "#448361",
"f_blue": "#337EA9",
"f_purple": "#9065B0",
"f_pink": "#C14C8A",
"f_red": "#D44C47",
"b_gray": "#F1F1EF",
"b_brown": "#F4EEEE",
"b_orange": "#FBECDD",
"b_yellow": "#FBF3DB",
"b_green": "#EDF3EC",
"b_blue": "#E7F3F8",
"b_purple": "#F4F0F7CC",
"b_pink": "#F9EEF3CC",
"b_red": "#FDEBEC",
"d_light_gray": "#E3E2E080",
"d_gray": "#E3E2E0",
"d_brown": "#EEE0DA",
"d_orange": "#FADEC9",
"d_yellow": "#FDECC8",
"d_green": "#DBEDDB",
"d_blue": "#D3E5EF",
"d_purple": "#E8DEEE",
"d_pink": "#F5E0E9",
"d_red": "#FFE2DD"
},
"backup_root_path": "G:\\Notion备份"
}
45 changes: 45 additions & 0 deletions notion_backup_background.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# -*- mode: python ; coding: utf-8 -*-


block_cipher = None


a = Analysis(
['notion_backup_terminal.py'],
pathex=['api/notion_dump.py', 'api/notion_dump_api.py', 'api/backup_info.py'],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)

exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='notion_backup_background',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
icon=['notion-dump.ico'],
)
11 changes: 8 additions & 3 deletions notion_backup_terminal.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# author: delta1037
# Date: 2022/05/01
# mail:[email protected]
# 打包代码 pyinstaller -F -c -i notion-dump.ico notion_backup_terminal.py -p api/notion_dump.py -p api/notion_dump_api.py -p api/backup_info.py
# 终端-打包代码 pyinstaller -F -c -i notion-dump.ico notion_backup_terminal.py -p api/notion_dump.py -p api/notion_dump_api.py -p api/backup_info.py
# 终端-打包代码 pyinstaller notion_backup_terminal.spec
# 后台-打包代码 pyinstaller -F -i notion-dump.ico notion_backup_terminal.py -p api/notion_dump.py -p api/notion_dump_api.py -p api/backup_info.py
# 后台-打包代码 pyinstaller notion_backup_background.spec
import os
import sys
import time
Expand All @@ -21,7 +24,8 @@ def __init__(self):
self.__log = open(LOG_FILE, "a+", encoding='utf-8')
# 输出备份的时间
backup_time = time.strftime('backup_time: %Y-%m-%d %H:%M:%S\n', time.localtime(time.time()))
self.terminal.write(backup_time)
if self.terminal is not None:
self.terminal.write(backup_time)
self.__log.write("\n###################################################\n")
self.__log.write(backup_time)
self.__log.flush()
Expand All @@ -33,7 +37,8 @@ def log_info(self, message):
self.log("[EXPORT KERNEL] " + str(message))

def log(self, message):
self.terminal.write(message + "\n")
if self.terminal is not None:
self.terminal.write(message + "\n")
self.__log.write(message + "\n")
self.__log.flush()

Expand Down

0 comments on commit 93cf173

Please sign in to comment.