Refactor core module imports and update paths
Renamed 'src/core' to 'ytsage/core' and updated all internal imports to use relative paths. This improves package structure and ensures correct module resolution after the directory move.
This commit is contained in:
@@ -19,9 +19,9 @@ from PySide6.QtWidgets import (
|
|||||||
QVBoxLayout,
|
QVBoxLayout,
|
||||||
)
|
)
|
||||||
|
|
||||||
from src.utils.ytsage_logger import logger
|
from ..utils.ytsage_logger import logger
|
||||||
from src.utils.ytsage_localization import _
|
from ..utils.ytsage_localization import _
|
||||||
from src.utils.ytsage_constants import (
|
from ..utils.ytsage_constants import (
|
||||||
APP_BIN_DIR,
|
APP_BIN_DIR,
|
||||||
ICON_PATH,
|
ICON_PATH,
|
||||||
OS_FULL_NAME,
|
OS_FULL_NAME,
|
||||||
@@ -31,7 +31,7 @@ from src.utils.ytsage_constants import (
|
|||||||
DENO_DOWNLOAD_URL,
|
DENO_DOWNLOAD_URL,
|
||||||
DENO_SHA256_URL,
|
DENO_SHA256_URL,
|
||||||
)
|
)
|
||||||
from src.core.ytsage_ffmpeg import get_file_sha256
|
from .ytsage_ffmpeg import get_file_sha256
|
||||||
|
|
||||||
|
|
||||||
def verify_deno_sha256(file_path: Path, sha256_url: str) -> bool:
|
def verify_deno_sha256(file_path: Path, sha256_url: str) -> bool:
|
||||||
@@ -11,16 +11,16 @@ from typing import Optional, List, Set
|
|||||||
|
|
||||||
from PySide6.QtCore import QObject, QThread, Signal
|
from PySide6.QtCore import QObject, QThread, Signal
|
||||||
|
|
||||||
from src.core.ytsage_yt_dlp import get_yt_dlp_path
|
from .ytsage_yt_dlp import get_yt_dlp_path
|
||||||
from src.utils.ytsage_constants import (
|
from ..utils.ytsage_constants import (
|
||||||
SUBPROCESS_CREATIONFLAGS,
|
SUBPROCESS_CREATIONFLAGS,
|
||||||
VIDEO_EXTENSIONS,
|
VIDEO_EXTENSIONS,
|
||||||
AUDIO_EXTENSIONS,
|
AUDIO_EXTENSIONS,
|
||||||
SUBTITLE_EXTENSIONS,
|
SUBTITLE_EXTENSIONS,
|
||||||
MEDIA_EXTENSIONS,
|
MEDIA_EXTENSIONS,
|
||||||
)
|
)
|
||||||
from src.utils.ytsage_localization import LocalizationManager
|
from ..utils.ytsage_localization import LocalizationManager
|
||||||
from src.utils.ytsage_logger import logger
|
from ..utils.ytsage_logger import logger
|
||||||
|
|
||||||
# Shorthand for localization
|
# Shorthand for localization
|
||||||
_ = LocalizationManager.get_text
|
_ = LocalizationManager.get_text
|
||||||
@@ -7,8 +7,8 @@ from pathlib import Path
|
|||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from src.utils.ytsage_logger import logger
|
from ..utils.ytsage_logger import logger
|
||||||
from src.utils.ytsage_constants import (
|
from ..utils.ytsage_constants import (
|
||||||
FFMPEG_7Z_DOWNLOAD_URL,
|
FFMPEG_7Z_DOWNLOAD_URL,
|
||||||
FFMPEG_7Z_SHA256_URL,
|
FFMPEG_7Z_SHA256_URL,
|
||||||
FFMPEG_ZIP_DOWNLOAD_URL,
|
FFMPEG_ZIP_DOWNLOAD_URL,
|
||||||
@@ -11,9 +11,9 @@ from typing import Any, Dict, Optional, Union
|
|||||||
import requests
|
import requests
|
||||||
from packaging import version
|
from packaging import version
|
||||||
|
|
||||||
from src.core.ytsage_ffmpeg import check_ffmpeg_installed, get_ffmpeg_install_path
|
from .ytsage_ffmpeg import check_ffmpeg_installed, get_ffmpeg_install_path
|
||||||
from src.core.ytsage_yt_dlp import get_yt_dlp_path
|
from .ytsage_yt_dlp import get_yt_dlp_path
|
||||||
from src.utils.ytsage_constants import (
|
from ..utils.ytsage_constants import (
|
||||||
APP_CONFIG_FILE,
|
APP_CONFIG_FILE,
|
||||||
OS_NAME,
|
OS_NAME,
|
||||||
SUBPROCESS_CREATIONFLAGS,
|
SUBPROCESS_CREATIONFLAGS,
|
||||||
@@ -21,8 +21,8 @@ from src.utils.ytsage_constants import (
|
|||||||
YTDLP_APP_BIN_PATH,
|
YTDLP_APP_BIN_PATH,
|
||||||
YTDLP_DOWNLOAD_URL,
|
YTDLP_DOWNLOAD_URL,
|
||||||
)
|
)
|
||||||
from src.utils.ytsage_localization import _
|
from ..utils.ytsage_localization import _
|
||||||
from src.utils.ytsage_logger import logger
|
from ..utils.ytsage_logger import logger
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from importlib.metadata import PackageNotFoundError as ImportlibPackageNotFoundError
|
from importlib.metadata import PackageNotFoundError as ImportlibPackageNotFoundError
|
||||||
@@ -107,7 +107,7 @@ def update_version_cache(tool_name: str, version_info: str, path: Optional[str],
|
|||||||
|
|
||||||
def load_version_cache_from_config() -> None:
|
def load_version_cache_from_config() -> None:
|
||||||
"""Load cached version info from config file."""
|
"""Load cached version info from config file."""
|
||||||
from src.utils.ytsage_config_manager import ConfigManager
|
from ..utils.ytsage_config_manager import ConfigManager
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cached_versions = ConfigManager.get("cached_versions") or {}
|
cached_versions = ConfigManager.get("cached_versions") or {}
|
||||||
@@ -121,7 +121,7 @@ def load_version_cache_from_config() -> None:
|
|||||||
|
|
||||||
def save_version_cache_to_config() -> None:
|
def save_version_cache_to_config() -> None:
|
||||||
"""Save version cache to config file."""
|
"""Save version cache to config file."""
|
||||||
from src.utils.ytsage_config_manager import ConfigManager
|
from ..utils.ytsage_config_manager import ConfigManager
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ConfigManager.set("cached_versions", _version_cache.copy())
|
ConfigManager.set("cached_versions", _version_cache.copy())
|
||||||
@@ -179,7 +179,7 @@ def get_ffmpeg_version_cached() -> str:
|
|||||||
def get_deno_version_cached() -> str:
|
def get_deno_version_cached() -> str:
|
||||||
"""Get Deno version with caching support."""
|
"""Get Deno version with caching support."""
|
||||||
try:
|
try:
|
||||||
from src.core.ytsage_deno import get_deno_path
|
from .ytsage_deno import get_deno_path
|
||||||
|
|
||||||
current_path = get_deno_path()
|
current_path = get_deno_path()
|
||||||
|
|
||||||
@@ -190,7 +190,7 @@ def get_deno_version_cached() -> str:
|
|||||||
return cached_version
|
return cached_version
|
||||||
|
|
||||||
# Get fresh version info
|
# Get fresh version info
|
||||||
from src.core.ytsage_deno import get_deno_version_direct
|
from .ytsage_deno import get_deno_version_direct
|
||||||
version_info = get_deno_version_direct(current_path)
|
version_info = get_deno_version_direct(current_path)
|
||||||
|
|
||||||
# Update cache
|
# Update cache
|
||||||
@@ -215,7 +215,7 @@ def refresh_version_cache(force=False) -> bool:
|
|||||||
update_version_cache("ffmpeg", version_info, "ffmpeg", force_save=True)
|
update_version_cache("ffmpeg", version_info, "ffmpeg", force_save=True)
|
||||||
|
|
||||||
# Refresh Deno
|
# Refresh Deno
|
||||||
from src.core.ytsage_deno import get_deno_path, get_deno_version_direct
|
from .ytsage_deno import get_deno_path, get_deno_version_direct
|
||||||
deno_path = get_deno_path()
|
deno_path = get_deno_path()
|
||||||
version_info = get_deno_version_direct(deno_path)
|
version_info = get_deno_version_direct(deno_path)
|
||||||
update_version_cache("deno", version_info, deno_path, force_save=True)
|
update_version_cache("deno", version_info, deno_path, force_save=True)
|
||||||
@@ -550,7 +550,7 @@ def update_yt_dlp() -> bool:
|
|||||||
|
|
||||||
def should_check_for_auto_update() -> bool:
|
def should_check_for_auto_update() -> bool:
|
||||||
"""Check if auto-update should be performed based on user settings."""
|
"""Check if auto-update should be performed based on user settings."""
|
||||||
from src.utils.ytsage_config_manager import ConfigManager
|
from ..utils.ytsage_config_manager import ConfigManager
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Check if auto-update is enabled
|
# Check if auto-update is enabled
|
||||||
@@ -580,7 +580,7 @@ def should_check_for_auto_update() -> bool:
|
|||||||
|
|
||||||
def check_and_update_ytdlp_auto() -> bool:
|
def check_and_update_ytdlp_auto() -> bool:
|
||||||
"""Perform automatic yt-dlp update check and update if needed."""
|
"""Perform automatic yt-dlp update check and update if needed."""
|
||||||
from src.utils.ytsage_config_manager import ConfigManager
|
from ..utils.ytsage_config_manager import ConfigManager
|
||||||
|
|
||||||
try:
|
try:
|
||||||
logger.info("Performing automatic yt-dlp update check...")
|
logger.info("Performing automatic yt-dlp update check...")
|
||||||
@@ -637,7 +637,7 @@ def check_and_update_ytdlp_auto() -> bool:
|
|||||||
|
|
||||||
def get_auto_update_settings() -> Dict[str, Any]:
|
def get_auto_update_settings() -> Dict[str, Any]:
|
||||||
"""Get current auto-update settings from config."""
|
"""Get current auto-update settings from config."""
|
||||||
from src.utils.ytsage_config_manager import ConfigManager
|
from ..utils.ytsage_config_manager import ConfigManager
|
||||||
|
|
||||||
enabled: Optional[bool] = ConfigManager.get("auto_update_ytdlp")
|
enabled: Optional[bool] = ConfigManager.get("auto_update_ytdlp")
|
||||||
frequency: Optional[str] = ConfigManager.get("auto_update_frequency")
|
frequency: Optional[str] = ConfigManager.get("auto_update_frequency")
|
||||||
@@ -653,7 +653,7 @@ def get_auto_update_settings() -> Dict[str, Any]:
|
|||||||
def update_auto_update_settings(enabled: bool, frequency: str) -> bool:
|
def update_auto_update_settings(enabled: bool, frequency: str) -> bool:
|
||||||
"""Update auto-update settings in config."""
|
"""Update auto-update settings in config."""
|
||||||
try:
|
try:
|
||||||
from src.utils.ytsage_config_manager import ConfigManager
|
from ..utils.ytsage_config_manager import ConfigManager
|
||||||
|
|
||||||
ConfigManager.set("auto_update_ytdlp", enabled)
|
ConfigManager.set("auto_update_ytdlp", enabled)
|
||||||
ConfigManager.set("auto_update_frequency", frequency)
|
ConfigManager.set("auto_update_frequency", frequency)
|
||||||
@@ -20,8 +20,8 @@ from PySide6.QtWidgets import (
|
|||||||
QWidget,
|
QWidget,
|
||||||
)
|
)
|
||||||
|
|
||||||
from src.utils.ytsage_logger import logger
|
from ..utils.ytsage_logger import logger
|
||||||
from src.utils.ytsage_constants import (
|
from ..utils.ytsage_constants import (
|
||||||
APP_BIN_DIR,
|
APP_BIN_DIR,
|
||||||
ICON_PATH,
|
ICON_PATH,
|
||||||
OS_FULL_NAME,
|
OS_FULL_NAME,
|
||||||
@@ -31,8 +31,8 @@ from src.utils.ytsage_constants import (
|
|||||||
YTDLP_DOWNLOAD_URL,
|
YTDLP_DOWNLOAD_URL,
|
||||||
YTDLP_SHA256_URL,
|
YTDLP_SHA256_URL,
|
||||||
)
|
)
|
||||||
from src.core.ytsage_ffmpeg import get_file_sha256
|
from .ytsage_ffmpeg import get_file_sha256
|
||||||
from src.utils.ytsage_localization import _
|
from ..utils.ytsage_localization import _
|
||||||
|
|
||||||
# YTDLP_URLS moved to src\utils\ytsage_constants.py
|
# YTDLP_URLS moved to src\utils\ytsage_constants.py
|
||||||
# get_ytdlp_install_dir() moved to src\utils\ytsage_constants.py
|
# get_ytdlp_install_dir() moved to src\utils\ytsage_constants.py
|
||||||
Reference in New Issue
Block a user