Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LeiShi1313 committed Mar 26, 2024
1 parent f5e123d commit 9c1080e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions differential/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"reuse_torrent",
"scan_bdinfo",
"create_folder",
"optimize_screenshot",
)

URL_SHORTENER_PATH = "https://2cn.io"
Expand Down
5 changes: 4 additions & 1 deletion differential/utils/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import argparse
from configparser import RawConfigParser

from loguru import logger

from differential.constants import ImageHosting, BOOLEAN_ARGS, BOOLEAN_STATES


Expand All @@ -9,7 +11,8 @@ def merge_config(args: argparse.Namespace, section: str = '') -> dict:
config = None
if hasattr(args, 'config'):
config = RawConfigParser()
config.read(args.config, encoding='utf-8')
with open(args.config, 'r', encoding='utf-8') as f:
config.read_file(f)

if config:
# First use the args in the general section
Expand Down
2 changes: 1 addition & 1 deletion differential/utils/image/byr.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def byr_upload(img: Path, authorization: str, url: Optional[str] = None) -> Opti
if url:
m = re.search(r"\'({}.*?)\'".format(url), req.text)
else:
m = re.search(r"\'(https://byr.usx.leishi.io.*?)\'", req.text)
m = re.search(r"\'(https://byr.pt.*?)\'", req.text)
if not m:
logger.trace(req.content)
logger.warning(f"图片直链获取失败")
Expand Down
1 change: 0 additions & 1 deletion differential/utils/torrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def remake_torrent(path: Path, tracker: str, old_torrent: str) -> Optional[bytes
def make_torrent_progress(torrent, filepath, pieces_done, pieces_total):
logger.info(f'制种进度: {pieces_done/pieces_total*100:3.0f} %')


def make_torrent(path: Path, tracker: str, prefix: str = None, reuse_torrent: bool = True, from_torrent: str = None):
torrent_name = path.resolve().parent.joinpath((f"[{prefix}]." if prefix else '') + f"{path.name if path.is_dir() else path.stem}.torrent")
if from_torrent and Path(from_torrent).is_file():
Expand Down

0 comments on commit 9c1080e

Please sign in to comment.