Skip to content

Commit

Permalink
Improve processing step for update checking
Browse files Browse the repository at this point in the history
  • Loading branch information
Agrarvolution committed Feb 22, 2024
1 parent 8435995 commit 19579d8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
15 changes: 11 additions & 4 deletions src/jsx/KBRG/CacheThumbnails.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,16 +137,23 @@ CacheThumbnails.prototype.extractTimecodeFromThumbnail = function (thumb, search
return true;
}

/**
* Compares all stored thumbnails with timecode udpates and returns the matching data.
* This is used to display changes from csv files in the UI without needing to check every single file.
* If this.logging is false, only the thumbnail data is added that has an error / is not matching.
* @param {array} timecodes
* @returns
*/
CacheThumbnails.prototype.compareTimecodes = function (timecodes) {
var result = {};
var result = [];

for (var i = 0; i < this.mediaCache.length; i++) {
var comparisonCache = this.mediaCache[i].updateThumbnailMetadata(timecodes);
var comparisonCache = this.mediaCache[i].checkMatchingStartTimecodes(timecodes);

if (comparisonCache && this.logging ?
if (comparisonCache !== undefined && (this.logging ?
true :
!comparisonCache.isMatching //error only
) {
)) {
result.push(comparisonCache);
}
}
Expand Down
11 changes: 8 additions & 3 deletions src/jsx/KBRG/KBRG_TimecodeCorrection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,15 @@ Agrarvolution.timecodeCorrection = {
return false;
}

//check processing
/*check processing
* This currently ignores changes to the thumbnails if they are not made with the array update / csv pipeline.
* @Todo Add ability to check every time related type of thumbnail metadata change.
*/
var checkCache = new CacheThumbnails(parameters);
if (input.timecodes) {
return JSON.stringify(checkCache.compareTimecodes(input.timecodes));
if (parameters.timecodes) {
var validatedInput = CacheThumbnails.validateTimecodeArray(parameters.timecodes, Agrarvolution.logToCEP, parameters.logTarget, false);
var checkResults = checkCache.compareTimecodes(validatedInput);
return JSON.stringify(checkResults);
}

Agrarvolution.logToCEP("Time formats for " + processedMedia + " media thumbnails have been updated.",
Expand Down
2 changes: 1 addition & 1 deletion src/jsx/KBRG/tests.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

if (app.eventHandlers) { //uses the fact, that app.eventhandlers is only available if the script is directly called to guard the test scripts
testCache();
//tests();
tests();
}

function testCache() {
Expand Down

0 comments on commit 19579d8

Please sign in to comment.