refactor: shorten import content

This commit is contained in:
100gle
2023-07-03 20:43:52 +08:00
parent 7fdf813683
commit a20de4f0ad
4 changed files with 10 additions and 10 deletions

View File

@@ -1,10 +1,10 @@
import pathlib
from pathlib import Path
from .config import VERSION, settings
from .log import LOG_PATH, setup_logger
TMDB_API = "32b19d6a05b512190a056fa4e747cbbc"
DATA_PATH = pathlib.Path("data/data.db")
LEGACY_DATA_PATH = pathlib.Path("data/data.json")
DATA_PATH = Path("data/data.db")
LEGACY_DATA_PATH = Path("data/data.json")
PLATFORM = "Windows" if "\\" in settings.downloader.path else "Unix"

View File

@@ -1,7 +1,7 @@
import json
import logging
import os
import pathlib
from pathlib import Path
from dotenv import load_dotenv
@@ -10,7 +10,7 @@ from module.models.config import Config
from .const import ENV_TO_ATTR
logger = logging.getLogger(__name__)
CONFIG_ROOT = pathlib.Path("config")
CONFIG_ROOT = Path("config")
try:

View File

@@ -1,9 +1,9 @@
import logging
import pathlib
from pathlib import Path
from .config import settings
LOG_ROOT = pathlib.Path("data")
LOG_ROOT = Path("data")
LOG_PATH = LOG_ROOT / "log.txt"

View File

@@ -1,5 +1,5 @@
import logging
import pathlib
from pathlib import Path
import re
from module.models import EpisodeFile, SubtitleFile
@@ -31,7 +31,7 @@ def get_path_basename(torrent_path: str) -> str:
:return: A string representing the basename of the given path.
:rtype: str
"""
return pathlib.Path(torrent_path).name
return Path(torrent_path).name
def get_group(group_and_title) -> tuple[str | None, str]:
@@ -81,7 +81,7 @@ def torrent_parser(
else:
title, _ = get_season_and_title(title)
episode = int(match_obj.group(2))
suffix = pathlib.Path(torrent_path).suffix
suffix = Path(torrent_path).suffix
if file_type == "media":
return EpisodeFile(
media_path=torrent_path,