some pload

This commit is contained in:
2026-03-09 12:08:36 +00:00
parent 66184325d6
commit 05f29028f6
8 changed files with 463 additions and 828 deletions

View File

@@ -376,6 +376,22 @@ function ensureUniqueOutputPath(outputPath) {
return attempt;
}
function chownRecursive(targetPath, ownerSpec) {
const spec = String(ownerSpec || '').trim();
if (!spec || !targetPath) {
return;
}
try {
const { spawnSync } = require('child_process');
const result = spawnSync('chown', ['-R', spec, targetPath], { timeout: 15000 });
if (result.status !== 0) {
logger.warn('chown:failed', { targetPath, spec, stderr: String(result.stderr || '') });
}
} catch (error) {
logger.warn('chown:error', { targetPath, spec, error: error?.message });
}
}
function moveFileWithFallback(sourcePath, targetPath) {
try {
fs.renameSync(sourcePath, targetPath);
@@ -6670,6 +6686,7 @@ class PipelineService extends EventEmitter {
preferredFinalOutputPath
);
const finalizedOutputPath = outputFinalization.outputPath;
chownRecursive(path.dirname(finalizedOutputPath), settings.movie_dir_owner);
if (outputFinalization.outputPathWithTimestamp) {
await historyService.appendLog(
jobId,
@@ -6903,6 +6920,7 @@ class PipelineService extends EventEmitter {
const rawDirName = buildRawDirName(metadataBase, jobId, { incomplete: true });
const rawJobDir = path.join(rawBaseDir, rawDirName);
ensureDir(rawJobDir);
chownRecursive(rawJobDir, settings.raw_dir_owner);
logger.info('rip:raw-dir-created', { jobId, rawJobDir });
const deviceCandidate = this.detectedDisc || this.snapshot.context?.device || {
@@ -7061,6 +7079,7 @@ class PipelineService extends EventEmitter {
try {
fs.renameSync(rawJobDir, completedRawJobDir);
activeRawJobDir = completedRawJobDir;
chownRecursive(activeRawJobDir, settings.raw_dir_owner);
await historyService.updateRawPathByOldPath(rawJobDir, completedRawJobDir);
await historyService.appendLog(
jobId,

View File

@@ -35,11 +35,21 @@ const PROFILED_SETTINGS = {
dvd: 'raw_dir_dvd',
other: 'raw_dir_other'
},
raw_dir_owner: {
bluray: 'raw_dir_bluray_owner',
dvd: 'raw_dir_dvd_owner',
other: 'raw_dir_other_owner'
},
movie_dir: {
bluray: 'movie_dir_bluray',
dvd: 'movie_dir_dvd',
other: 'movie_dir_other'
},
movie_dir_owner: {
bluray: 'movie_dir_bluray_owner',
dvd: 'movie_dir_dvd_owner',
other: 'movie_dir_other_owner'
},
mediainfo_extra_args: {
bluray: 'mediainfo_extra_args_bluray',
dvd: 'mediainfo_extra_args_dvd'
@@ -79,7 +89,9 @@ const PROFILED_SETTINGS = {
};
const STRICT_PROFILE_ONLY_SETTING_KEYS = new Set([
'raw_dir',
'movie_dir'
'raw_dir_owner',
'movie_dir',
'movie_dir_owner'
]);
function applyRuntimeLogDirSetting(rawValue) {