feat:完善规则

This commit is contained in:
fanxb 2022-12-04 15:58:17 +08:00
parent 43066c972c
commit cf9f168bce

View File

@ -21,7 +21,7 @@ function saveFile () {
if (fs.existsSync(cachePath)) { if (fs.existsSync(cachePath)) {
cache = JSON.parse(fs.readFileSync(cachePath, 'utf-8')); cache = JSON.parse(fs.readFileSync(cachePath, 'utf-8'));
} }
await deal("Z:\\userData\\视频\\电影", 2500, true, "cuda"); await deal("Z:\\userData\\视频", 2500, true, "cuda");
if (timer) { if (timer) {
clearInterval(timer); clearInterval(timer);
} }
@ -81,8 +81,12 @@ async function deal (basePath, maxBitRate = 2500, changeName = false, hardType)
continue; continue;
} }
let is10Bit = res.streams.filter(item => item.bits_per_raw_sample === '10').length > 0; let is10Bit = res.streams.filter(item => item.bits_per_raw_sample === '10').length > 0;
bitRate = Math.round(parseInt(bitRate) / 1000); let originBitRate = Math.round(parseInt(bitRate) / 1000);
bitRate = bitRate > maxBitRate * 2 ? maxBitRate : bitRate / 2; bitRate = originBitRate > maxBitRate * 2 ? maxBitRate : originBitRate / 2;
if (bitRate < 1000) {
bitRate = originBitRate * 0.75;
}
let newName = null; let newName = null;
replaceTextArr.forEach(item => { replaceTextArr.forEach(item => {
if (newName == null && name.indexOf(item) > -1) { if (newName == null && name.indexOf(item) > -1) {