diff --git a/.gitignore b/.gitignore index 1406706..4e287b3 100644 --- a/.gitignore +++ b/.gitignore @@ -132,4 +132,7 @@ dist output +# xpath notebook +.xbook + 회차별채점자료/*/정답파일 \ No newline at end of file diff --git a/250220_DIC_2521A_TEST.xlsx b/250220_DIC_2521A_TEST.xlsx new file mode 100644 index 0000000..c86787e Binary files /dev/null and b/250220_DIC_2521A_TEST.xlsx differ diff --git a/README.md b/README.md index a5e8378..7bc43e8 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,6 @@ xpath 테스트 용 5. CRTrackClip * Type="0" ClipIndex="-1" : 공백 - * 5. todo * 자막 위치 검사하는 로직 원복 @@ -134,4 +133,9 @@ xpath 테스트 용 '초록빛 이파리들...'자막 시작시간 오답처리 (완료) * 자막 클립의 앞이 잘리게 되면 트림시간이 생성되어 CRTrackClip태그의 속성값들이 변경 됨 * CRTrackClip 태그 ClipLength, Length, Pos 속성값 비교 연산 필요 - * ClipLength - Length = Pos \ No newline at end of file + * ClipLength - Length = Pos + +1. 클립 조각 발생 스킵 여부 (5프레임) + - 멀티미디어-003678-신은재(A) 2프레임 : (3-1) 배열 점수 추가 +2. 배열(모션이미지클립 처리여부) +3. 오디오 \ No newline at end of file diff --git a/getToday.js b/getToday.js new file mode 100644 index 0000000..bb2eba0 --- /dev/null +++ b/getToday.js @@ -0,0 +1,12 @@ +const getToday = () => { + const now = new Date(); + const yy = String(now.getFullYear()).slice(2); // 연도 끝 두 자리 + const mm = String(now.getMonth() + 1).padStart(2, "0"); // 월 (01~12) + const dd = String(now.getDate()).padStart(2, "0"); // 일 (01~31) + return `${yy}${mm}${dd}`; +}; + +// 실행 +console.log(getToday()); // 예: 240217 (2024년 2월 17일) + +module.exports = getToday; \ No newline at end of file diff --git a/psdExport_2.js b/psdExport_2.js index a55bcc1..b57a8aa 100644 --- a/psdExport_2.js +++ b/psdExport_2.js @@ -7,12 +7,14 @@ const xpath = require('xpath'); const { DOMParser } = require('xmldom'); const findSimilarString = require('./findSimilarString'); +const getToday = require('./getToday.js'); +const todayDate = getToday(); // -------------------------------------------------------- -// const scoringJson = require('./DIC_2521A.json'); +const scoringJson = require('./DIC_2521A.json'); // const scoringJson = require('./DIC_2521B.json'); // const scoringJson = require('./DIC_2521C.json'); -const scoringJson = require('./DIC_2521D.json'); +// const scoringJson = require('./DIC_2521D.json'); // TEST // const scoringJson = require('./DIC_2521A_TEST.json'); @@ -23,25 +25,25 @@ const scoringJson = require('./DIC_2521D.json'); // const answerFilesDir = './output/A/DIC'; // const answerFilesDir = './output/B/DIC'; // const answerFilesDir = './output/C/DIC'; -const answerFilesDir = './output/D/DIC'; +// const answerFilesDir = './output/D/DIC'; // TEST -// const answerFilesDir = './output/A/TEST'; +const answerFilesDir = './output/A/TEST'; // const answerFilesDir = './output/B/TEST'; // const answerFilesDir = './output/C/TEST'; // const answerFilesDir = './output/D/TEST'; // -------------------------------------------------------- -// const outputExcelFile = './DIC_2521A_result.xlsx'; -// const outputExcelFile = './DIC_2521B_result.xlsx'; -// const outputExcelFile = './DIC_2521C_result.xlsx'; -// const outputExcelFile = './DIC_2521D_result.xlsx'; +// const outputExcelFile = './'+todayDate+'_DIC_2521A_result.xlsx'; +// const outputExcelFile = './'+todayDate+'_DIC_2521B_result.xlsx'; +// const outputExcelFile = './'+todayDate+'_DIC_2521C_result.xlsx'; +// const outputExcelFile = './'+todayDate+'_DIC_2521D_result.xlsx'; // TEST -// const outputExcelFile = './DIC_2521A_TEST.xlsx'; -// const outputExcelFile = './DIC_2521B_TEST.xlsx'; -// const outputExcelFile = './DIC_2521C_TEST.xlsx'; -const outputExcelFile = './DIC_2521D_TEST.xlsx'; +const outputExcelFile = './'+todayDate+'_DIC_2521A_TEST.xlsx'; +// const outputExcelFile = './'+todayDate+'_DIC_2521B_TEST.xlsx'; +// const outputExcelFile = './'+todayDate+'_DIC_2521C_TEST.xlsx'; +// const outputExcelFile = './'+todayDate+'_DIC_2521D_TEST.xlsx'; // -------------------------------------------------------- // 답안 폴더 내부에 디렉토리가 아닌 일반 파일이 있을 경우 디렉토리만 필터링 해서 불러옴 @@ -186,7 +188,9 @@ function getGmepScore(gmepData, scoringJson, index) { if (trackListNode) { // CRTrackClip 요소의 ClipIndex를 참조하여 CRClip 요소의 Path와 Type 출력 - const clipIndexes = xpath.select('CRTrackClip[@ClipIndex!="-1"][@Length!="1"]/@ClipIndex' + // @Length(클립재생길이) 5프레임 이하, @ClipLength -1인 항목은 제외 + // 10프레임은 타임라인상 눈에 잘 보여서 5프레임으로 우선 수정 + const clipIndexes = xpath.select('CRTrackClip[not(@Length<="5" and @ClipLength="-1")]/@ClipIndex' , trackListNode); clipIndexes.forEach(indexNode => { const clipIndex = parseInt(indexNode.value, 10) + 1; // XPath는 1-based index를 사용 diff --git a/z.xbook b/z.xbook index b96caed..de698e8 100644 --- a/z.xbook +++ b/z.xbook @@ -1 +1 @@ -[{"kind":1,"language":"markdown","value":"# XPath Notebook\r\nDate: 2025-02-04     Time: 17:56:45"},{"kind":2,"language":"xpath","value":"//CRTransFilter[@ClipIndex=count(//CRTrackList[@Name='비디오1']/CRTrackClip[@Type='2' and @ClipIndex=count(//CRClip[@Path='이미지2.jpg']/preceding-sibling::*)]/preceding-sibling::CRTrackClip)]/@ID|//CRTransFilter[@ClipIndex=count(//CRTrackList[@Name='비디오1']/CRTrackClip[@Type='2' and @ClipIndex=count(//CRClip[@Path='이미지2.jpg']/preceding-sibling::*)]/preceding-sibling::CRTrackClip)]/@Range|//CRTransFilter[@ClipIndex=count(//CRTrackList[@Name='비디오1']/CRTrackClip[@Type='2' and @ClipIndex=count(//CRClip[@Path='이미지2.jpg']/preceding-sibling::*)]/preceding-sibling::CRTrackClip)]/@Type"},{"kind":2,"language":"xpath","value":"//CRTransFilter[@ClipIndex=count(//CRTrackList[@Name='비디오1']/CRTrackClip[@ClipIndex=count(//CRClip[@Path='이미지2.jpg']/preceding-sibling::*)]/preceding-sibling::CRTrackClip)]/@ID"},{"kind":2,"language":"xpath","value":"count(//CRClip[@Path='이미지2.jpg']/preceding-sibling::*)"},{"kind":2,"language":"xpath","value":"//CRVideoTrackArr/CRTrackList[@Name=\"비디오1\"]/CRTrackClip[@ClipIndex!='-1']/@ClipIndex"},{"kind":2,"language":"xpath","value":"//CRVideoTrackArr/CRTrackList[@Name=\"비디오1\"]/CRTrackClip[@ClipIndex!='-1']/@ClipIndex"},{"kind":2,"language":"xpath","value":"(//CRTrackList[@Name='비디오1']/CRTrackClip[@ClipIndex=3])[1]/preceding-sibling::CRTrackClip"},{"kind":2,"language":"xpath","value":"count((//CRTrackList[@Name='비디오1']/CRTrackClip[@ClipIndex=3])[1]/preceding-sibling::CRTrackClip)"},{"kind":2,"language":"xpath","value":"//CRTransFilter[@ClipIndex=count(//CRTrackList[@Name='비디오1']/CRTrackClip[@ClipIndex=count(//CRClip[@Path='이미지2.jpg']/preceding-sibling::*)][1]/preceding-sibling::CRTrackClip)]/@ID"},{"kind":2,"language":"xpath","value":"//CRTrackList[@Name='텍스트']/CRTrackClip[not(@ClipIndex=count(//CROwneUnit[1]/CRCUnitArr/preceding::CROwneUnit))]"},{"kind":2,"language":"xpath","value":"//CRTrackList[@Name='텍스트']/CRTrackClip[not(@ClipIndex=count(//CROwneUnit[1]/CRCUnitArr/preceding::CROwneUnit))]"},{"kind":2,"language":"xpath","value":"sum(//CRTrackList[@Name='텍스트']/CRTrackClip[not(@ClipIndex=count(//CROwneUnit[1]/CRCUnitArr/preceding::CROwneUnit))]/@Length)"},{"kind":2,"language":"xpath","value":"//CRTrackList[@Name='텍스트']/CRTrackClip[not(@ClipIndex=count(//CROwneUnit[2]/CRCUnitArr/preceding::CROwneUnit))]/@Length"},{"kind":2,"language":"xpath","value":"sum(//CRTrackList[@Name='텍스트']/CRTrackClip[not(@ClipIndex=count(//CROwneUnit[2]/preceding-sibling::CROwneUnit))]/@Length)"},{"kind":2,"language":"xpath","value":"//CROwneUnit[2]/preceding-sibling::CROwneUnit"},{"kind":2,"language":"xpath","value":"//CROwneUnit[2]/CRCUnitArr"},{"kind":2,"language":"xpath","value":"/CROASTERP/CRTrackArr[1]/CRVideoTrackArr[1]/CRTrackList[1]/CRTrackClip[@ClipIndex != '-1'][1][@Speed='120']"},{"kind":2,"language":"xpath","value":"//CRTrackList[@Name='비디오1']/CRTrackClip[@ClipIndex=count(//CRClip[@Path='이미지3.jpg']/preceding-sibling::*)]//CRFilter/@ID |//CRTrackList[@Name='비디오1']/CRTrackClip[@ClipIndex=count(//CRClip[@Path='이미지3.jpg']/preceding-sibling::*)]//CRFilter/@VID100"},{"kind":2,"language":"xpath","value":"//CRTrackList[@Name='텍스트']/CRTrackClip[not(@ClipIndex='-1')][@ClipLength - @Length = @Pos]"},{"kind":2,"language":"xpath","value":"//CRTrackList[@Name='텍스트']/CRTrackClip[@ClipIndex=count(//CROwneUnit[.//CRCUnitArr[@Name='젖소와 함께한 시간 With milk cow']]/preceding::CROwneUnit)][@ClipLength - @Length = @Pos]"},{"kind":2,"language":"xpath","value":"//CRTrackList[@Name='텍스트']/CRTrackClip[1][@ClipLength - @Length = @Pos]"},{"kind":2,"language":"xpath","value":"sum(//CRTrackList[@Name='텍스트']/CRTrackClip[not(@ClipIndex=count(//CROwneUnit[1]/CRCUnitArr/preceding::CROwneUnit))]/@Length)"},{"kind":2,"language":"xpath","value":"//CROwneUnitArr/CROwneUnit[//CRTrackList[@Name='텍스트']//CRTrackClip[position()=1]/@ClipIndex+1]"},{"kind":2,"language":"xpath","value":"//CRTrackList[@Name='텍스트']//CRTrackClip[1]/@ClipIndex+1"},{"kind":2,"language":"xpath","value":"//CRClipArr/CRClip[position() = //CRVideoTrackArr/CRTrackList[1]/CRTrackClip/@ClipIndex]/@Path"},{"kind":2,"language":"xpath","value":"//CRClipArr/CRClip[position()=[0,4,3,2]]"},{"kind":2,"language":"xpath","value":"//CRTrackList[@Name=\"비디오1\"]/CRTrackClip[@ClipIndex != \"-1\" or @ClipLength != \"-1\"]/@ClipIndex"},{"kind":2,"language":"xpath","value":"//CRTrackList[@Name=\"비디오1\"]/CRTrackClip[@ClipIndex >= 0 and @ClipIndex <= 4]/@ClipIndex"},{"kind":2,"language":"xpath","value":"//CRTrackList[@Name=\"비디오1\"]/CRTrackClip[@ClipIndex != \"-1\"]/@ClipIndex"},{"kind":2,"language":"xpath","value":"sum(//CRTrackList[@Name='텍스트']/CRTrackClip[not(@ClipIndex=count(//CROwneUnit[1]/CRCUnitArr/preceding::CROwneUnit))]/@Length)"},{"kind":2,"language":"xpath","value":"//CROwneUnitArr/CROwneUnit[//CRTrackList[@Name='텍스트']//CRTrackClip[position()=1]/@ClipIndex+1]"},{"kind":2,"language":"xpath","value":"//CRTrackList[@Name='텍스트']//CRTrackClip[position()=1]"}] \ No newline at end of file +[{"kind":2,"language":"xpath","value":"//CRTrackList[@Name=\"비디오1\"]//CRTrackClip[not(@Length<\"10\" and @ClipLength=\"-1\")]/@ClipIndex\r\n//CRTrackList[@Name=\"비디오1\"]//CRTrackClip[not(@Length<\"10\" and @ClipLength='-1')]"}] \ No newline at end of file