This commit is contained in:
fanxb 2023-01-31 20:41:38 +08:00
parent 158f0d6275
commit e247a9fd2a
3 changed files with 91 additions and 11 deletions

View File

@ -1,9 +1,34 @@
export default interface AutoPlanConfigDto { export default interface AutoPlanConfigDto {
paths: Array<string>, /**
version: Number, *
ignoreSeason0: Boolean, */
ignorePaths: Array<string>, paths: Array<string>;
deleteSmallVideo: boolean, /**
rules: Array<string>, *
start: boolean */
version: Number;
/**
* season 0
*/
ignoreSeason0: Boolean;
/**
*
*/
ignorePaths: Array<string>;
/**
* 2m的视频文件
*/
deleteSmallVideo: boolean;
/**
*
*/
rules: Array<string>;
/**
*
*/
ignoreExist: boolean;
/**
*
*/
start: boolean;
} }

View File

@ -11,8 +11,30 @@ import GlobalConfig from 'entity/po/GlobalConfig';
import GlobalConfigService from './GlobalConfigService'; import GlobalConfigService from './GlobalConfigService';
const autoConfigCode = "autoConfig"; const autoConfigCode = "autoConfig";
/**
*
*/
let needDeal = new Set();
/**
* key:变更前的目录value:变更后的目录.当needDeal为空时清理pathMap
*/
let pathMap = {};
/**
*
*/
let autoConfig: AutoPlanConfigDto = null;
class AutoPlanService { class AutoPlanService {
static async init() {
let str = await GlobalConfigService.getVal(autoConfigCode);
if (str != null) {
} else {
autoConfig = JSON.parse(str);
}
}
/** /**
* *
*/ */
@ -23,12 +45,26 @@ class AutoPlanService {
description: "自动化计划配置" description: "自动化计划配置"
}; };
await GlobalConfigService.insertOrReplace(configBody); await GlobalConfigService.insertOrReplace(configBody);
if (!body.start) { autoConfig = body;
return; if (body.start && !body.ignoreExist) {
} }
let old = await GlobalConfigService.getVal(autoConfigCode);
if (old && old.length)
} }
}
/**
*
*/
function checkIgnore(str: string): boolean {
for (let i in autoConfig.ignorePaths) {
if (str.match(autoConfig.ignorePaths[i])) {
return true;
}
}
return false;
} }
export default AutoPlanService; export default AutoPlanService;

View File

@ -0,0 +1,19 @@
-- 记录已处理过的路径
CREATE TABLE dealed_file_path (
key_str TEXT(32) NOT NULL,
"path" TEXT(200) NOT NULL,
CONSTRAINT dealed_file_path_PK PRIMARY KEY (key_str)
);
CREATE TABLE auto_deal_history (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
createTime INTEGER NOT NULL,
oldName TEXT(200) NOT NULL,
newName TEXT(200) NOT NULL,
-- 说明
comment TEXT(200) NOT NULL,
-- 1:文件重命名2剧集下无季文件夹自动创建;3:操作失败
"type" INTEGER NOT NULL,
CONSTRAINT auto_deal_history_PK PRIMARY KEY (id)
);
CREATE INDEX auto_deal_history_createTime_IDX ON auto_deal_history (createTime);