fix: Streamline transcode replacement with per-item live progress and safe history logging
This commit is contained in:
@@ -2889,14 +2889,18 @@ class RobustProxyHandler(http.server.SimpleHTTPRequestHandler):
|
||||
saved_bytes = orig_size - transcode_size
|
||||
|
||||
# Step 5: Record to Relocation History audit log
|
||||
record_relocation_history(
|
||||
source_path=transcode_path,
|
||||
target_path=orig_local_path,
|
||||
performer_name="Transcode Optimization",
|
||||
status="completed",
|
||||
size_bytes=transcode_size,
|
||||
action_type="transcode_replace"
|
||||
)
|
||||
try:
|
||||
record_relocation_history(
|
||||
source_type="stash_transcode",
|
||||
item_key=orig_local_path,
|
||||
item_name=os.path.basename(orig_local_path),
|
||||
source_path=transcode_path,
|
||||
target_path=orig_local_path,
|
||||
performer="Transcode Optimization",
|
||||
file_size=transcode_size
|
||||
)
|
||||
except Exception as e:
|
||||
print(f"Warning: History record error: {e}")
|
||||
|
||||
# Step 6: Trigger Stash metadata scan on parent folder if requested
|
||||
if trigger_rescan:
|
||||
@@ -2967,6 +2971,19 @@ class RobustProxyHandler(http.server.SimpleHTTPRequestHandler):
|
||||
saved = orig_size - transcode_size
|
||||
total_saved_bytes += saved
|
||||
rescanned_dirs.add(os.path.dirname(orig_local_path))
|
||||
|
||||
try:
|
||||
record_relocation_history(
|
||||
source_type="stash_transcode",
|
||||
item_key=orig_local_path,
|
||||
item_name=os.path.basename(orig_local_path),
|
||||
source_path=transcode_path,
|
||||
target_path=orig_local_path,
|
||||
performer="Transcode Optimization",
|
||||
file_size=transcode_size
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as e:
|
||||
errors.append({"path": orig_local_path, "error": str(e)})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user