fixed
This commit is contained in:
1 parent
d5bcaf16ee
commit
ef81365fce
4 files changed
+25
-69
No files matched your search
@@ -1 +0,0 @@
|
|||||||
["Z:\\tv\\Shows\\24\\Season 1\\24 - S01E01 - 12-00 A.M. - 1-00 A.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 1\\24 - S01E02 - 1-00 A.M. - 2-00 A.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 1\\24 - S01E03 - 2-00 A.M. - 3-00 A.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 1\\24 - S01E04 - 3-00 A.M. - 4-00 A.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 1\\24 - S01E05 - 4-00 A.M. - 5-00 A.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 1\\24 - S01E06 - 5-00 A.M. - 6-00 A.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 1\\24 - S01E07 - 6-00 A.M. - 7-00 A.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 1\\24 - S01E08 - 7-00 A.M. - 8-00 A.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 1\\24 - S01E09 - 8-00 A.M. - 9-00 A.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 1\\24 - S01E10 - 9-00 A.M. - 10-00 A.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 1\\24 - S01E11 - 10-00 A.M. - 11-00 A.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 1\\24 - S01E12 - 11-00 A.M. - 12-00 P.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 1\\24 - S01E13 - 12-00 P.M. - 1-00 P.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 1\\24 - S01E14 - 1-00 P.M. - 2-00 P.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 1\\24 - S01E15 - 2-00 P.M. - 3-00 P.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 1\\24 - S01E16 - 3-00 P.M. - 4-00 P.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 1\\24 - S01E17 - 4-00 P.M. - 5-00 P.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 1\\24 - S01E18 - 5-00 P.M. - 6-00 P.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 1\\24 - S01E19 - 6-00 P.M. - 7-00 P.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 1\\24 - S01E20 - 7-00 P.M. - 8-00 P.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 1\\24 - S01E21 - 8-00 P.M. - 9-00 P.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 1\\24 - S01E22 - 9-00 P.M. - 10-00 P.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 1\\24 - S01E23 - 10-00 P.M. - 11-00 P.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 1\\24 - S01E24 - 11-00 P.M. - 12-00 A.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 2\\24 - S02E01 - Day 2 - 8-00 A.M. - 9-00 A.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 2\\24 - S02E02 - Day 2 - 9-00 A.M. - 10-00 A.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 2\\24 - S02E03 - Day 2 - 10-00 A.M. - 11-00 A.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 2\\24 - S02E04 - Day 2 - 11-00 A.M. - 12-00 P.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 2\\24 - S02E05 - Day 2 - 12-00 P.M. - 1-00 P.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 2\\24 - S02E06 - Day 2 - 1-00 P.M. - 2-00 P.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 2\\24 - S02E07 - Day 2 - 2-00 P.M. - 3-00 P.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 2\\24 - S02E08 - Day 2 - 3-00 P.M. - 4-00 P.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 2\\24 - S02E09 - Day 2 - 4-00 P.M. - 5-00 P.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 2\\24 - S02E10 - Day 2 - 5-00 P.M. - 6-00 P.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 2\\24 - S02E11 - Day 2 - 6-00 P.M. - 7-00 P.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 2\\24 - S02E12 - Day 2 - 7-00 P.M. - 8-00 P.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 2\\24 - S02E13 - Day 2 - 8-00 P.M. - 9-00 P.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 2\\24 - S02E14 - Day 2 - 9-00 P.M. - 10-00 P.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 2\\24 - S02E15 - Day 2 - 10-00 P.M. - 11-00 P.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 2\\24 - S02E16 - Day 2 - 11-00 P.M. - 12-00 A.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 2\\24 - S02E17 - Day 2 - 12-00 A.M. - 1-00 A.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 2\\24 - S02E18 - Day 2 - 1-00 A.M. - 2-00 A.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 2\\24 - S02E19 - Day 2 - 2-00 A.M. - 3-00 A.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 2\\24 - S02E20 - Day 2 - 3-00 A.M. - 4-00 A.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 2\\24 - S02E21 - Day 2 - 4-00 A.M. - 5-00 A.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 2\\24 - S02E22 - Day 2 - 5-00 A.M. - 6-00 A.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 2\\24 - S02E23 - Day 2 - 6-00 A.M. - 7-00 A.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 2\\24 - S02E24 - Day 2 - 7-00 A.M. - 8-00 A.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 3\\24 - S03E01 - Day 3 - 1-00 P.M. - 2-00 P.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 3\\24 - S03E02 - Day 3 - 2-00 P.M. - 3-00 P.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 3\\24 - S03E03 - Day 3 - 3-00 P.M. - 4-00 P.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 3\\24 - S03E04 - Day 3 - 4-00 P.M. - 5-00 P.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 3\\24 - S03E05 - Day 3 - 5-00 P.M. - 6-00 P.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 3\\24 - S03E06 - Day 3 - 6-00 P.M. - 7-00 P.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 3\\24 - S03E07 - Day 3 - 7-00 P.M. - 8-00 P.M Bluray-1080p.mkv", "Z:\\tv\\Shows\\24\\Season 3\\24 - S03E08 - Day 3 - 8-00 P.M. - 9-00 P.M Bluray-1080p.mkv", "Z:\\tv\\ShowsLine truncated
|
|
||||||
@@ -70,70 +70,13 @@ signal.signal(signal.SIGINT, handle_sigint)
|
|||||||
# --- Hardware Detection ---
|
# --- Hardware Detection ---
|
||||||
def detect_hardware_encoder():
|
def detect_hardware_encoder():
|
||||||
"""Detects available hardware encoders via ffmpeg"""
|
"""Detects available hardware encoders via ffmpeg"""
|
||||||
try:
|
# Use common module detection
|
||||||
res = subprocess.run([FFMPEG_BIN, "-hide_banner", "-encoders"], capture_output=True, text=True)
|
return common.detect_hardware_encoder()
|
||||||
out = res.stdout
|
|
||||||
|
|
||||||
av1_enc = None
|
|
||||||
hevc_enc = None
|
|
||||||
|
|
||||||
# Check AMD
|
|
||||||
if "av1_amf" in out: av1_enc = "av1_amf"
|
|
||||||
if "hevc_amf" in out: hevc_enc = "hevc_amf"
|
|
||||||
if av1_enc or hevc_enc: return av1_enc, hevc_enc, "amf"
|
|
||||||
|
|
||||||
# Check NVIDIA
|
|
||||||
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"
|
|
||||||
|
|
||||||
# Check Intel
|
|
||||||
if "av1_qsv" in out: av1_enc = "av1_qsv"
|
|
||||||
if "hevc_qsv" in out: hevc_enc = "hevc_qsv"
|
|
||||||
if av1_enc or hevc_enc: return av1_enc, hevc_enc, "qsv"
|
|
||||||
|
|
||||||
# Check Apple
|
|
||||||
if "av1_videotoolbox" in out: av1_enc = "av1_videotoolbox"
|
|
||||||
if "hevc_videotoolbox" in out: hevc_enc = "hevc_videotoolbox"
|
|
||||||
if av1_enc or hevc_enc: return av1_enc, hevc_enc, "videotoolbox"
|
|
||||||
|
|
||||||
return None, None, "cpu"
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
print(f"[Warning] HW Detection failed: {e}")
|
|
||||||
return None, None, "cpu"
|
|
||||||
|
|
||||||
def get_encoder_args(codec, encoder, qp):
|
def get_encoder_args(codec, encoder, qp):
|
||||||
"""Returns correct ffmpeg args for specific HW vendor"""
|
"""Returns correct ffmpeg args for specific HW vendor"""
|
||||||
if not encoder: return []
|
# Use common module args
|
||||||
|
return common.get_encoder_args(codec, encoder, qp)
|
||||||
# AMD AMF
|
|
||||||
if "amf" in encoder:
|
|
||||||
common_args = ["-rc", "cqp", "-qp_i", str(qp), "-qp_p", str(qp), "-qp_b", str(qp), "-quality", "quality"]
|
|
||||||
return ["-c:v", encoder, "-usage", "transcoding"] + common_args
|
|
||||||
|
|
||||||
# NVIDIA NVENC
|
|
||||||
if "nvenc" in encoder:
|
|
||||||
return ["-c:v", encoder, "-rc", "constqp", "-qp", str(qp), "-preset", "p6", "-spatial-aq", "1"]
|
|
||||||
|
|
||||||
# Intel QSV
|
|
||||||
if "qsv" in encoder:
|
|
||||||
return ["-c:v", encoder, "-global_quality", str(qp), "-look_ahead", "1"]
|
|
||||||
|
|
||||||
# Apple VideoToolbox
|
|
||||||
if "videotoolbox" in encoder:
|
|
||||||
q = int(100 - (qp * 2))
|
|
||||||
return ["-c:v", encoder, "-q:v", str(q)]
|
|
||||||
|
|
||||||
# Software Fallback
|
|
||||||
if encoder == "libsvtav1":
|
|
||||||
# CRF 20-35 range usually good
|
|
||||||
return ["-c:v", "libsvtav1", "-crf", str(qp), "-preset", "6", "-g", "240"]
|
|
||||||
|
|
||||||
if encoder == "libx265":
|
|
||||||
return ["-c:v", "libx265", "-crf", str(qp), "-preset", "medium"]
|
|
||||||
|
|
||||||
return []
|
|
||||||
|
|
||||||
# --- Helpers ---
|
# --- Helpers ---
|
||||||
def run_process(cmd, description="", status_callback=None):
|
def run_process(cmd, description="", status_callback=None):
|
||||||
@@ -484,7 +427,7 @@ def main():
|
|||||||
if tv_path.exists():
|
if tv_path.exists():
|
||||||
print(f"Scanning TV: {tv_path}")
|
print(f"Scanning TV: {tv_path}")
|
||||||
files = list(tv_path.rglob("*.mkv")) + list(tv_path.rglob("*.mp4"))
|
files = list(tv_path.rglob("*.mkv")) + list(tv_path.rglob("*.mp4"))
|
||||||
files.sort(key=lambda x: x.stat().st_size, reverse=True)
|
files.sort() # Alphabetical order for consistency across platforms
|
||||||
for f in files:
|
for f in files:
|
||||||
if skipping:
|
if skipping:
|
||||||
if skip_until.lower() in str(f).lower():
|
if skip_until.lower() in str(f).lower():
|
||||||
@@ -499,7 +442,7 @@ def main():
|
|||||||
if content_path.exists():
|
if content_path.exists():
|
||||||
print(f"Scanning Content: {content_path}")
|
print(f"Scanning Content: {content_path}")
|
||||||
files = list(content_path.rglob("*.mkv")) + list(content_path.rglob("*.mp4"))
|
files = list(content_path.rglob("*.mkv")) + list(content_path.rglob("*.mp4"))
|
||||||
files.sort(key=lambda x: x.stat().st_size, reverse=True)
|
files.sort() # Alphabetical order for consistency across platforms
|
||||||
for f in files:
|
for f in files:
|
||||||
if skipping:
|
if skipping:
|
||||||
if skip_until.lower() in str(f).lower():
|
if skip_until.lower() in str(f).lower():
|
||||||
|
|||||||
@@ -76,7 +76,8 @@ def fast_scan(path):
|
|||||||
files.append(entry.path)
|
files.append(entry.path)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
return files
|
# Sort alphabetically for consistent ordering across platforms
|
||||||
|
return sorted(files)
|
||||||
|
|
||||||
# --- UI State ---
|
# --- UI State ---
|
||||||
class Dashboard:
|
class Dashboard:
|
||||||
@@ -295,10 +296,14 @@ def main():
|
|||||||
|
|
||||||
# Detect HW
|
# Detect HW
|
||||||
encoders = common.detect_hardware_encoder(args)
|
encoders = common.detect_hardware_encoder(args)
|
||||||
|
av1_enc, hevc_enc, hw_type = encoders
|
||||||
|
|
||||||
# UI
|
# UI
|
||||||
dashboard = Dashboard(args.jobs, log_dir=log_dir)
|
dashboard = Dashboard(args.jobs, log_dir=log_dir)
|
||||||
|
dashboard.add_log(f"Locks: {lock_dir}")
|
||||||
dashboard.add_log(f"Logs: {log_dir}")
|
dashboard.add_log(f"Logs: {log_dir}")
|
||||||
|
dashboard.add_log(f"Hardware: {hw_type.upper()}")
|
||||||
|
dashboard.add_log(f"AV1: {av1_enc or 'None'} | HEVC: {hevc_enc or 'None'}")
|
||||||
|
|
||||||
# Work Queue
|
# Work Queue
|
||||||
work_queue = queue.Queue()
|
work_queue = queue.Queue()
|
||||||
|
|||||||
+13
-4
@@ -231,8 +231,8 @@ def acquire_lock(lock_dir, filepath):
|
|||||||
Simple file-based lock.
|
Simple file-based lock.
|
||||||
Returns lock_path if acquired, None if failed.
|
Returns lock_path if acquired, None if failed.
|
||||||
"""
|
"""
|
||||||
# Use hash of filename to avoid long paths/invalid chars
|
# Use hash of full path (not just filename) for uniqueness
|
||||||
fhash = hashlib.md5(str(filepath.name).encode()).hexdigest()
|
fhash = hashlib.md5(str(filepath).encode()).hexdigest()
|
||||||
lock_file = lock_dir / f"{fhash}.lock"
|
lock_file = lock_dir / f"{fhash}.lock"
|
||||||
|
|
||||||
if lock_file.exists():
|
if lock_file.exists():
|
||||||
@@ -241,14 +241,23 @@ def acquire_lock(lock_dir, filepath):
|
|||||||
if time.time() - lock_file.stat().st_mtime > 86400:
|
if time.time() - lock_file.stat().st_mtime > 86400:
|
||||||
lock_file.unlink()
|
lock_file.unlink()
|
||||||
else:
|
else:
|
||||||
|
# Lock exists and is fresh - file is being processed elsewhere
|
||||||
return None
|
return None
|
||||||
except:
|
except:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
lock_file.touch()
|
# Write hostname and timestamp for debugging
|
||||||
|
import socket
|
||||||
|
lock_info = {
|
||||||
|
"file": str(filepath),
|
||||||
|
"host": socket.gethostname(),
|
||||||
|
"timestamp": time.time()
|
||||||
|
}
|
||||||
|
lock_file.write_text(json.dumps(lock_info))
|
||||||
return lock_file
|
return lock_file
|
||||||
except:
|
except Exception as e:
|
||||||
|
print(f"[Warning] Failed to acquire lock for {filepath.name}: {e}")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# --- Hardware Detection ---
|
# --- Hardware Detection ---
|
||||||
|
|||||||
Reference in new issue
Block a user