j
This commit is contained in:
@@ -818,11 +818,8 @@ def _get_playable_path(
|
|||||||
# This is unrelated to MPV's IPC pipe and keeps "pipe" terminology reserved for:
|
# This is unrelated to MPV's IPC pipe and keeps "pipe" terminology reserved for:
|
||||||
# - MPV IPC pipe (transport)
|
# - MPV IPC pipe (transport)
|
||||||
# - PipeObject (pipeline data)
|
# - PipeObject (pipeline data)
|
||||||
|
backend_target_resolved = False
|
||||||
if store and file_hash and file_hash != "unknown" and file_storage:
|
if store and file_hash and file_hash != "unknown" and file_storage:
|
||||||
# If it's already a URL, MPV can usually play it directly.
|
|
||||||
if isinstance(path, str) and path.startswith(("http://", "https://")):
|
|
||||||
return (path, title)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
backend = file_storage[store]
|
backend = file_storage[store]
|
||||||
except Exception:
|
except Exception:
|
||||||
@@ -830,11 +827,10 @@ def _get_playable_path(
|
|||||||
|
|
||||||
if backend is not None:
|
if backend is not None:
|
||||||
backend_class = type(backend).__name__
|
backend_class = type(backend).__name__
|
||||||
|
backend_target_resolved = True
|
||||||
|
|
||||||
# Folder stores: resolve to an on-disk file path.
|
# Folder stores: resolve to an on-disk file path.
|
||||||
if (hasattr(backend,
|
if (hasattr(backend, "get_file") and callable(getattr(backend, "get_file"))
|
||||||
"get_file") and callable(getattr(backend,
|
|
||||||
"get_file"))
|
|
||||||
and backend_class == "Folder"):
|
and backend_class == "Folder"):
|
||||||
try:
|
try:
|
||||||
resolved = backend.get_file(file_hash)
|
resolved = backend.get_file(file_hash)
|
||||||
@@ -862,6 +858,11 @@ def _get_playable_path(
|
|||||||
f"Error building Hydrus URL from store '{store}': {e}",
|
f"Error building Hydrus URL from store '{store}': {e}",
|
||||||
file=sys.stderr
|
file=sys.stderr
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
backend_target_resolved = False
|
||||||
|
|
||||||
|
if isinstance(path, str) and path.startswith(("http://", "https://")) and not backend_target_resolved:
|
||||||
|
return (path, title)
|
||||||
|
|
||||||
if not path:
|
if not path:
|
||||||
# As a last resort, if we have a hash and no path/url, return the hash.
|
# As a last resort, if we have a hash and no path/url, return the hash.
|
||||||
|
|||||||
Reference in New Issue
Block a user