This commit is contained in:
2026-02-09 17:45:57 -08:00
parent 567472bca0
commit 2fd13a6b3f
6 changed files with 57 additions and 34 deletions

28
.luarc.json Normal file
View File

@@ -0,0 +1,28 @@
{
"runtime": {
"version": "LuaJIT",
"path": [
"?.lua",
"?/init.lua",
"MPV/portable_config/scripts/uosc/scripts/uosc/?.lua",
"MPV/portable_config/scripts/uosc/scripts/uosc/?/init.lua",
"MPV/LUA/?.lua",
"MPV/LUA/?/init.lua"
]
},
"workspace": {
"library": [
"MPV/portable_config/scripts/uosc/scripts/uosc",
"MPV/portable_config/scripts/uosc/scripts/uosc/lib",
"MPV/LUA"
],
"checkThirdParty": false
},
"diagnostics": {
"disable": [
"undefined-global",
"undefined-field",
"need-check-nil"
]
}
}

4
CLI.py
View File

@@ -41,7 +41,7 @@ import uuid
from copy import deepcopy
from pathlib import Path
from typing import Any, Dict, List, Optional, Sequence, Set, Tuple, cast, Callable
from typing import Any, Dict, List, Optional, Sequence, Set, Tuple, cast
import typer
from prompt_toolkit import PromptSession
@@ -98,7 +98,7 @@ from ProviderCore.registry import provider_inline_query_choices
# Selection parsing and REPL lexer moved to SYS.cli_parsing
from SYS.cli_parsing import Lexer, DRIVE_RE, KEY_PREFIX_RE, TOKEN_PATTERN, SELECTION_RANGE_RE, SelectionSyntax, SelectionFilterSyntax, MedeiaLexer
from SYS.cli_parsing import SelectionSyntax, SelectionFilterSyntax, MedeiaLexer
# SelectionFilterSyntax moved to SYS.cli_parsing (imported above)

View File

@@ -6,11 +6,8 @@ import json
import sqlite3
import time
import os
import traceback
import datetime
import sys
import getpass
import hashlib
import tempfile
from copy import deepcopy
from pathlib import Path
@@ -19,7 +16,7 @@ from SYS.logger import log
import logging
logger = logging.getLogger(__name__)
from SYS.utils import expand_path
from SYS.database import db, get_config_all, save_config_value, rows_to_config
from SYS.database import db, get_config_all, rows_to_config
SCRIPT_DIR = Path(__file__).resolve().parent

View File

@@ -2,12 +2,15 @@
import sys
import inspect
import logging
import threading
from pathlib import Path
from typing import Optional
from SYS.rich_display import console_for
logger = logging.getLogger(__name__)
# Global DB logger set later to avoid circular imports
_DB_LOGGER = None

View File

@@ -1,3 +1,4 @@
# pyright: reportUnusedFunction=false
from typing import Any, Dict, Sequence, List, Optional
import os
import sys
@@ -124,10 +125,12 @@ def _repo_log_dir() -> Path:
return d
# pyright: ignore[reportUnusedFunction]
def _helper_log_file() -> Path:
return _repo_log_dir() / "medeia-mpv-helper.log"
# pyright: ignore[reportUnusedFunction]
def _lua_log_file() -> Path:
return _repo_log_dir() / "medeia-mpv-lua.log"
@@ -2089,7 +2092,7 @@ def _run(result: Any, args: Sequence[str], config: Dict[str, Any]) -> int:
else:
print("MPV logs from database (mpv module, most recent first):")
if mpv_logs:
for timestamp, level, module, message in mpv_logs:
for timestamp, level, _module, message in mpv_logs:
ts = str(timestamp or "").strip()
if ts:
print(f"[{ts}] [{level}] {message}")
@@ -2248,7 +2251,7 @@ def _start_mpv(
except Exception as e:
debug(f"Error starting MPV: {e}", file=sys.stderr)
# pyright: ignore[reportCallIssue]
CMDLET = Cmdlet(
name=".mpv",
alias=[".pipe", "pipe", "playlist", "queue", "ls-pipe"],

View File

@@ -1,3 +1,4 @@
# pyright: reportUnusedFunction=false
from __future__ import annotations
import hashlib
@@ -959,9 +960,6 @@ class YtDlpTool:
# Special handling for format keywords explicitly passed in via options
if opts.ytdl_format == "audio":
try:
opts = opts._replace(mode="audio", ytdl_format=None)
except Exception:
try:
import dataclasses as _dc
@@ -970,9 +968,6 @@ class YtDlpTool:
from SYS.logger import logger
logger.exception("Failed to set opts mode to audio via dataclasses.replace")
elif opts.ytdl_format == "video":
try:
opts = opts._replace(mode="video", ytdl_format=None)
except Exception:
try:
import dataclasses as _dc
@@ -991,9 +986,6 @@ class YtDlpTool:
if configured_format:
if configured_format.lower() == "audio":
# Default to audio-only downloads
try:
opts = opts._replace(mode="audio")
except Exception:
try:
import dataclasses as _dc
@@ -1854,7 +1846,7 @@ def download_media(opts: DownloadOptions, *, config: Optional[Dict[str, Any]] =
info = None
else:
with yt_dlp.YoutubeDL(ytdl_options) as ydl: # type: ignore[arg-type]
info = ydl.extract_info(opts.url, download=True)
info = cast(Dict[str, Any], ydl.extract_info(opts.url, download=True))
except Exception as exc:
retry_attempted = False
if _is_http_403(exc) and not ytdl_options.get("download_sections"):
@@ -1879,7 +1871,7 @@ def download_media(opts: DownloadOptions, *, config: Optional[Dict[str, Any]] =
fallback_options["extractor_args"] = extractor_args
with yt_dlp.YoutubeDL(fallback_options) as ydl: # type: ignore[arg-type]
info = ydl.extract_info(opts.url, download=True)
info = cast(Dict[str, Any], ydl.extract_info(opts.url, download=True))
except Exception as exc2:
log(f"yt-dlp failed: {exc2}", file=sys.stderr)
if debug_logger is not None: