Fixed prio and locks

This commit is contained in:
bnair
2026-01-03 13:01:54 +01:00
parent f1e79ad01d
commit 4729c75e41

View File

@@ -34,8 +34,34 @@ def get_base_paths(args=None):
tv_dir = Path(args.tv_dir) if args and hasattr(args, 'tv_dir') else Path(DEFAULT_CONFIG["tv_dir"]) tv_dir = Path(args.tv_dir) if args and hasattr(args, 'tv_dir') else Path(DEFAULT_CONFIG["tv_dir"])
# Logic: Locks MUST be at the common root of content to be shared. # Logic: Locks MUST be at the common root of content to be shared.
# We assume tv_dir is like "Z:\tv", so shared root is "Z:\" # We attempt to find the common parent if both are supplied, otherwise default to tv_dir parent.
shared_root = tv_dir.parent
potential_roots = []
if args:
if hasattr(args, 'tv_dir') and args.tv_dir: potential_roots.append(Path(args.tv_dir))
if hasattr(args, 'content_dir') and args.content_dir: potential_roots.append(Path(args.content_dir))
if not potential_roots:
potential_roots.append(Path(DEFAULT_CONFIG["tv_dir"]))
# Find common path
try:
if len(potential_roots) > 1:
# If they are on different drives, common_path might fail or return empty on Windows
# In that case, we fall back to the first one (TV dir parent)
common_root = os.path.commonpath(potential_roots)
shared_root = Path(common_root)
# If common root is the root drive itself (e.g. Z:\), that's fine.
# If it's a subdir (Z:\Media), also fine.
# But if it's too deep (e.g. just Z:\), we want to make sure we don't dump .vmaf_locks in root unless intended.
# Typically, we want the parent of the library folders.
# If os.path.commonpath returns Z:\Media, and dirs are Z:\Media\TV and Z:\Media\Content
# Then locks go to Z:\Media\.vmaf_locks. Perfect.
else:
shared_root = potential_roots[0].parent
except:
# Fallback for different drives
shared_root = potential_roots[0].parent
# Defaults # Defaults
lock_dir = Path("locks").resolve() lock_dir = Path("locks").resolve()
@@ -195,16 +221,16 @@ def detect_hardware_encoder(args=None):
hevc_enc = None hevc_enc = None
hw_type = "cpu" hw_type = "cpu"
# 1. NVIDIA (NVENC) - Windows/Linux # 1. AMD (AMF) - Windows (Preferred)
if "av1_nvenc" in out: av1_enc = "av1_nvenc"
if "hevc_nvenc" in out: hevc_enc = "hevc_nvenc"
if av1_enc or hevc_enc: return av1_enc, hevc_enc, "nvenc"
# 2. AMD (AMF) - Windows
if "av1_amf" in out: av1_enc = "av1_amf" if "av1_amf" in out: av1_enc = "av1_amf"
if "hevc_amf" in out: hevc_enc = "hevc_amf" if "hevc_amf" in out: hevc_enc = "hevc_amf"
if av1_enc or hevc_enc: return av1_enc, hevc_enc, "amf" if av1_enc or hevc_enc: return av1_enc, hevc_enc, "amf"
# 2. NVIDIA (NVENC) - Windows/Linux
if "av1_nvenc" in out: av1_enc = "av1_nvenc"
if "hevc_nvenc" in out: hevc_enc = "hevc_nvenc"
if av1_enc or hevc_enc: return av1_enc, hevc_enc, "nvenc"
# 3. AMD (VAAPI) - Linux # 3. AMD (VAAPI) - Linux
# Often named hevc_vaapi, av1_vaapi # Often named hevc_vaapi, av1_vaapi
if "av1_vaapi" in out: av1_enc = "av1_vaapi" if "av1_vaapi" in out: av1_enc = "av1_vaapi"