Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Commit

Permalink
v0.4.6
Browse files Browse the repository at this point in the history
- web ui移动端优化
- 添加同步目录时,本地目录从输入变成选择
  • Loading branch information
qicfan committed Dec 28, 2024
1 parent 34f048b commit 02759e6
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 38 deletions.
4 changes: 3 additions & 1 deletion console.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ def listLib():
table = Table(title="同步目录列表")

table.add_column("KEY", justify="left", style="cyan", no_wrap=True)
table.add_column("网盘类型",)
table.add_column("名称", style="magenta")
table.add_column("目录树路径", justify="right", style="green")
table.add_column("方式", justify="right", style="red")
for lib in libList:
table.add_row(lib.key, lib.name, lib.path, lib.type)
table.add_row(lib.key, lib.cloud_type, lib.name, lib.path, lib.type)
console = Console()
console.print(table)

Expand Down Expand Up @@ -79,6 +80,7 @@ def readTmp():
if tmp.get('path') is not None:
rprint("已经将上一次输入的值设置为每一项的默认值,[bold]如果没有改动可以直接回车[/],直到未完成的输入项")
lib = Lib(tmp)
# 选择网盘类型
o5s: list[OO5] = o5List.getList()
if len(o5s) == 0:
rprint("[bold red]请先添加115账号,执行:q115strm.exe add115[/]")
Expand Down

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion frontend/assets/index-D-ItpPJK.css

This file was deleted.

1 change: 1 addition & 0 deletions frontend/assets/index-W39v3FUh.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Q115-STRM</title>
<script type="module" crossorigin src="/assets/index-C2yc2d1C.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-D-ItpPJK.css">
<script type="module" crossorigin src="/assets/index-A_qiR64x.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-W39v3FUh.css">
</head>
<body>
<div id="app"></div>
Expand Down
10 changes: 7 additions & 3 deletions job.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import time
import urllib
import urllib.parse
import psutil

from p115client import P115Client, tool
import telegramify_markdown
Expand Down Expand Up @@ -43,9 +44,12 @@ def __init__(self, key: str = None, logStream: bool = False):
if self.oo5Account is None:
self.logger.error('无法找到所选的115账号,请检查115账号列表中是否存在此项: %s' % self.lib.id_of_115)
raise ValueError('无法找到所选的115账号,请检查115账号列表中是否存在此项')
if self.lib.extra.pid > 0:
self.logger.error('正在同步中,跳过本次执行')
raise ValueError('正在同步中,跳过本次执行')
try:
if self.lib.extra.pid > 0 and psutil.pid_exists(self.lib.extra.pid):
self.logger.error('正在同步中,跳过本次执行')
raise ValueError('正在同步中,跳过本次执行')
except:
pass

def notify(self, msg):
settings = Setting()
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ httpx_request="^0.1"
watchdog = "^6.0.0"
flask = "^3.1.0"
python-crontab = "^3.2.0"
psutil = "^6.1.1"


[build-system]
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ watchdog
pytz
rich
pyTelegramBotAPI
telegramify-markdown
telegramify-markdown
psutil
20 changes: 20 additions & 0 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,25 @@ def post(self):
return {'code': 500, 'msg': '保存成功,但是Telegram通知配置出错:{0}'.format(msg), 'data': settings.__dict__}
return {'code': 200, 'msg': '', 'data': settings.__dict__}

class DirApi(Resource):
def post(self):
"""
返回目录列表
"""
data = request.get_json()
base_dir = data.get('base_dir')
if base_dir is None or base_dir == '':
base_dir = '/'
dirs = os.listdir(base_dir)
result = []
for dir in dirs:
item = os.path.join(base_dir, dir)
if os.path.isfile(item):
# 如果是文件,则不用递归
continue
result.append(dir)
return {'code': 200, 'msg': '', 'data': result}


api.add_resource(Libs, '/api/libs')
api.add_resource(Lib, '/api/lib/<key>')
Expand All @@ -165,6 +184,7 @@ def post(self):
api.add_resource(OO5List, '/api/oo5list')
api.add_resource(OO5, '/api/oo5/<key>')
api.add_resource(SettingApi, '/api/settings')
api.add_resource(DirApi, '/api/dir')

# 跨域支持
def after_request(resp):
Expand Down

0 comments on commit 02759e6

Please sign in to comment.