updated old legacy store names

This commit is contained in:
2026-05-23 13:49:47 -07:00
parent e8913d1344
commit a8cdd09e1e
31 changed files with 466 additions and 469 deletions
+9 -9
View File
@@ -901,7 +901,7 @@ function M._load_store_choices_direct_async(cb)
'from SYS.logger import set_thread_stream',
'set_thread_stream(sys.stderr)',
'from SYS.config import load_config',
'from Store.registry import list_configured_backend_names',
'from PluginCore.backend_registry import list_configured_backend_names',
'config = load_config()',
'choices = list_configured_backend_names(config) or []',
'sys.stdout.write(json.dumps({"choices": choices}, ensure_ascii=False))',
@@ -2842,7 +2842,7 @@ local function _start_screenshot_store_save(store, out_path, tags)
if screenshot_url == '' or not screenshot_url:match('^https?://') then
screenshot_url = ''
end
local cmd = 'file -add -store ' .. quote_pipeline_arg(store)
local cmd = 'file -add -plugin hydrusnetwork -instance ' .. quote_pipeline_arg(store)
.. ' -path ' .. quote_pipeline_arg(out_path)
if screenshot_url ~= '' then
cmd = cmd .. ' -url ' .. quote_pipeline_arg(screenshot_url)
@@ -5864,7 +5864,7 @@ mp.register_script_message('medios-download-pick-store', function(json)
local pipeline_cmd = 'file -download -url ' .. quote_pipeline_arg(url)
.. ' -query ' .. quote_pipeline_arg(query)
.. ' | file -add -store ' .. quote_pipeline_arg(store)
.. ' | file -add -plugin hydrusnetwork -instance ' .. quote_pipeline_arg(store)
_set_selected_store(store)
_queue_pipeline_in_repl(
@@ -6331,16 +6331,16 @@ local function _start_trim_with_range(range)
pipeline_cmd =
'tag -get -emit -store ' .. quote_pipeline_arg(store_hash.store) ..
' -query ' .. quote_pipeline_arg('hash:' .. store_hash.hash) ..
' | file -add -path ' .. quote_pipeline_arg(output_path) ..
' -store "' .. selected_store .. '"' ..
' | file -add -plugin hydrusnetwork -instance ' .. quote_pipeline_arg(selected_store) ..
' -path ' .. quote_pipeline_arg(output_path) ..
' | add-relationship -store "' .. selected_store .. '"' ..
' -to-hash ' .. quote_pipeline_arg(store_hash.hash)
else
pipeline_cmd =
'tag -get -emit -store ' .. quote_pipeline_arg(store_hash.store) ..
' -query ' .. quote_pipeline_arg('hash:' .. store_hash.hash) ..
' | file -add -path ' .. quote_pipeline_arg(output_path) ..
' -store "' .. store_hash.store .. '"' ..
' | file -add -plugin hydrusnetwork -instance ' .. quote_pipeline_arg(store_hash.store) ..
' -path ' .. quote_pipeline_arg(output_path) ..
' | add-relationship -store "' .. store_hash.store .. '"' ..
' -to-hash ' .. quote_pipeline_arg(store_hash.hash)
end
@@ -6350,8 +6350,8 @@ local function _start_trim_with_range(range)
if selected_store then
_lua_log('trim: building file -add command to selected_store=' .. selected_store)
-- Don't add title if empty - the file path will be used as title by default
pipeline_cmd = 'file -add -path ' .. quote_pipeline_arg(output_path) ..
' -store "' .. selected_store .. '"'
pipeline_cmd = 'file -add -plugin hydrusnetwork -instance ' .. quote_pipeline_arg(selected_store) ..
' -path ' .. quote_pipeline_arg(output_path)
_lua_log('trim: pipeline_cmd=' .. pipeline_cmd)
else
mp.osd_message('Trim complete: ' .. output_path, 5)
+12 -14
View File
@@ -816,7 +816,7 @@ def _prefetch_notes_async(
set_notes_prefetch_pending,
store_cached_notes,
)
from Store import Store
from PluginCore.backend_registry import BackendRegistry
cached = load_cached_notes(store, file_hash, config=cfg)
if cached is not None:
@@ -824,7 +824,7 @@ def _prefetch_notes_async(
set_notes_prefetch_pending(store, file_hash, True)
registry = Store(cfg, suppress_debug=True)
registry = BackendRegistry(cfg, suppress_debug=True)
if not registry.is_available(str(store)):
return
backend = registry[str(store)]
@@ -1674,14 +1674,14 @@ def _queue_items(
except Exception:
hydrus_url = None
# Initialize Store registry for path resolution
# Initialize backend registry for path resolution
file_storage = None
try:
from Store import Store
from PluginCore.backend_registry import BackendRegistry
file_storage = Store(config or {})
file_storage = BackendRegistry(config or {})
except Exception as e:
debug(f"Warning: Could not initialize Store registry: {e}", file=sys.stderr)
debug(f"Warning: Could not initialize backend registry: {e}", file=sys.stderr)
_schedule_notes_prefetch(items, config)
@@ -1831,12 +1831,10 @@ def _queue_items(
continue
new_targets.add(norm_key)
# Use memory:// M3U hack to pass title to MPV.
# Avoid this for probable ytdl URLs because it can prevent the hook from triggering.
# Use memory:// M3U to preserve titles in MPV's playlist UI.
# Avoid this only for probable ytdl URLs because it can prevent the hook from triggering.
safe_title = title.replace("\n", " ").replace("\r", "") if title else None
if title and hydrus_target:
target_to_send = target
elif title and not _is_probable_ytdl_url(target):
if title and not _is_probable_ytdl_url(target):
# Sanitize title for M3U (remove newlines)
# Carry the store name for hash URLs so MPV.lyric can resolve the backend.
# This is especially important for local file-server URLs like /get_files/file?hash=...
@@ -2587,12 +2585,12 @@ def _run(result: Any, args: Sequence[str], config: Dict[str, Any]) -> int:
if file_storage is None:
try:
from Store import Store
from PluginCore.backend_registry import BackendRegistry
file_storage = Store(config)
file_storage = BackendRegistry(config)
except Exception as e:
debug(
f"Warning: Could not initialize Store registry: {e}",
f"Warning: Could not initialize backend registry: {e}",
file=sys.stderr
)
+12 -12
View File
@@ -1156,10 +1156,10 @@ def _infer_hydrus_store_from_url_target(*, target: str, config: dict) -> Optiona
return None
try:
from Store import Store as StoreRegistry
from PluginCore.backend_registry import BackendRegistry
reg = StoreRegistry(config, suppress_debug=True)
backends = [(name, reg[name]) for name in reg.list_backends()]
backend_registry = BackendRegistry(config, suppress_debug=True)
backends = [(name, backend_registry[name]) for name in backend_registry.list_backends()]
except Exception:
return None
@@ -1218,10 +1218,10 @@ def _resolve_store_backend_for_target(
return None, None
try:
from Store import Store as StoreRegistry
from PluginCore.backend_registry import BackendRegistry
reg = StoreRegistry(config, suppress_debug=True)
backend_names = list(reg.list_backends())
backend_registry = BackendRegistry(config, suppress_debug=True)
backend_names = list(backend_registry.list_backends())
except Exception:
return None, None
@@ -1229,7 +1229,7 @@ def _resolve_store_backend_for_target(
for name in backend_names:
try:
backend = reg[name]
backend = backend_registry[name]
except Exception:
continue
@@ -1363,16 +1363,16 @@ def run_auto_overlay(
# Import the Store registry once so each track change doesn't re-import the module.
try:
from Store import Store as _StoreRegistry # noqa: PLC0415
_store_cls: Any = _StoreRegistry
from PluginCore.backend_registry import BackendRegistry # noqa: PLC0415
_backend_registry_cls: Any = BackendRegistry
except Exception:
_store_cls = None
_backend_registry_cls = None
def _make_registry() -> Optional[Any]:
if _store_cls is None:
if _backend_registry_cls is None:
return None
try:
return _store_cls(cfg, suppress_debug=True)
return _backend_registry_cls(cfg, suppress_debug=True)
except Exception:
return None
+1 -1
View File
@@ -472,7 +472,7 @@ class MPV:
pipeline = f"file -download -url {_q(url)} -query {_q(f'format:{fmt}')}"
if store:
pipeline += f" | file -add -instance {_q(store)}"
pipeline += f" | file -add -plugin hydrusnetwork -instance {_q(store)}"
else:
pipeline += f" | file -add -plugin local -instance {_q(path or '')}"
+3 -3
View File
@@ -133,7 +133,7 @@ def _store_choices_payload(choices: Any) -> Optional[str]:
def _load_store_choices_from_config(*, force_reload: bool = False) -> list[str]:
from Store.registry import list_configured_backend_names # noqa: WPS433
from PluginCore.backend_registry import list_configured_backend_names # noqa: WPS433
cfg = reload_config() if force_reload else load_config()
return _normalize_store_choices(list_configured_backend_names(cfg or {}))
@@ -810,10 +810,10 @@ def _run_op(op: str, data: Any) -> Dict[str, Any]:
"find-url",
"find_url"}:
try:
from Store import Store # noqa: WPS433
from PluginCore.backend_registry import BackendRegistry # noqa: WPS433
cfg = load_config() or {}
storage = Store(config=cfg, suppress_debug=True)
storage = BackendRegistry(config=cfg, suppress_debug=True)
raw_needles: list[str] = []
if isinstance(data, dict):