Table of Contents
loglog(message); Add message to the Similarity log. processprocess(path, callback1, [callback2]); Start enumerating files and folders from path, calling callback1 for files and callback2 for folders. callback1 called with FileItem object as argument, callback2 with string containing folder path. This function always asynchronous (ie. doesn't wait for completion before returning, completed callbacks can be called before any other API method). The JavaScript process is still single threaded. waitwait(); Wait before all pending asynchronous callbacks completed. openFileopenFile(path, [flags]);
Open/create path file for writing or reading, all files processed as text file with UTF-8 encoding, flags can be: settings.folderssettings.folders; List of selected folders in the Folders tab. Returns array of objects with structure:
path - folder path settings.audiosettings.audio; Return object with settings of audio comparing. Current properties:
tags - threshold for tag comparing algorithm settings.imagesettings.image; Return object with settings of image comparing. Current properties:
content - threshold for content comparing algorithm audio.prepareaudio.prepare(item, [algorithms, callback]);
Prepares audio algorithms in advance, primary for optimization. item is FileItem object or string with path. Algorithms list can be an array or just arguments list. If you add any callback (function argument), this method works as asyncronous. Callback format callback(item, result), item your prepared FileItem object, result boolean argument with result (success or fail). audio.prepare('c:\Media\Folder\file1.mp3', ['tags', 'content', 'precise']); audio.prepare(file1, ['tags', 'content', 'precise']); function onprepare(file, result) { if (!result) return; ... } audio.prepare(file1, ['tags', 'content', 'precise'], onprepare); audio.prepare(file1, ['tags', 'content', 'precise'], function(file, result) { if (!result) return; ... }); This function can be asynchronous (ie. doesn't wait for completion before returning, completed callbacks can be called before any other API method). The JavaScript process is still single threaded. audio.queueaudio.queue(item, [algorithms, callback]);
Queue item for comparing (using audio.compare method) and prepare audio algorithms in advance. item is FileItem object or string with path. Algorithms list can be an array, or just arguments list. If you add any callback (function argument), this method works as asyncronous. Callback format callback(item, result), item your prepared FileItem object, result boolean argument with result (success or fail). audio.queue('c:\Media\Folder\file1.mp3', ['tags', 'content', 'precise']); audio.queue(file1, ['tags', 'content', 'precise']); function onqueue(file, result) { if (!result) return; ... } audio.queue(file1, ['tags', 'content', 'precise'], onqueue); audio.queue(file1, ['tags', 'content', 'precise'], function(file, result) { if (!result) return; ... }); This function can be asynchronous (ie. doesn't wait for completion before returning, completed callbacks can be called before any other API method). The JavaScript process is still single threaded. audio.compareaudio.compare(item, callback); Call callback on all items previously queued with audio.queue. callback(item1, item2) first argument is item, second argument is each queued item added with audio.queue before this call. This function always asynchronous (ie. doesn't wait for completion before returning, completed callbacks can be called before any other API method). The JavaScript process is still single threaded. audio.calculateaudio.calculate(item1, item2, [algorithms]); Calculate scores for selected algorithms (or all of them). item1, item2 - FileItem objects or any strings with pathes. Algorithms list can be an array or just arguments list. var scores = audio.calculate('c:\Media\Folder\file1.mp3', 'c:\Media\Folder\file2.ogg'); var scores = audio.calculate('c:\Media\Folder\file1.mp3', 'c:\Media\Folder\file2.ogg', 'precise'); var scores = audio.calculate(file1, file2, ['content', 'precise']); image.prepareimage.prepare(item, [algorithms, callback]);
Prepares image algorithms in advance, primary for optimization. item is FileItem object or string with path. Algorithms list can be an array or just arguments list. If you add any callback (function argument), this method works as asyncronous. Callback format callback(item, result), item your prepared FileItem object, result boolean argument with result (success or fail). image.prepare('c:\Media\Folder\file1.jpg', ['content', 'experimental']); image.prepare(file1, ['content', 'experimental']); function onprepare(file, result) { if (!result) return; ... } image.prepare(file1, ['content', 'experimental'], onprepare); image.prepare(file1, ['content', 'experimental'], function(file, result) { if (!result) return; ... }); This function can be asynchronous (ie. doesn't wait for completion before returning, completed callbacks can be called before any other API method). The JavaScript process is still single threaded. image.queueimage.queue(item, [algorithms, callback]);
Queue item for comparing (using image.compare method) and prepare image algorithms in advance. item is FileItem object or string with path. Algorithms list can be an array, or just arguments list. If you add any callback (function argument), this method works as asyncronous. Callback format callback(item, result), item your prepared FileItem object, result boolean argument with result (success or fail). image.queue('c:\Media\Folder\file1.jpg', ['content', 'experimental']); image.queue(file1, ['content', 'experimental']); function onqueue(file, result) { if (!result) return; ... } image.queue(file1, ['content', 'experimental'], onqueue); image.queue(file1, ['content', 'experimental'], function(file, result) { if (!result) return; ... }); This function can be asynchronous (ie. doesn't wait for completion before returning, completed callbacks can be called before any other API method). The JavaScript process is still single threaded. image.compareimage.compare(item, callback); Call callback on all items previously queued with image.queue. callback(item1, item2) first argument is item, second argument is each queued item added with image.queue before this call. This function always asynchronous (ie. doesn't wait for completion before returning, completed callbacks can be called before any other API method). The JavaScript process is still single threaded. image.calculateimage.calculate(item1, item2, [algorithms]); Calculate scores for selected algorithms (or all of them). item1, item2 - FileItem objects or any strings with pathes. Algorithms list can be an array or just arguments list. var scores = image.calculate('c:\Media\Folder\file1.jpg', 'c:\Media\Folder\file2.png'); var scores = image.calculate('c:\Media\Folder\file1.jpg', 'c:\Media\Folder\file2.png', 'content'); var scores = image.calculate(file1, file2, ['content', 'experimental']); analysis.prepareanalysis.prepare(item, [callback]);
Prepares analysis data in advance, primary for optimization. item is FileItem object or string with path. If you add any callback (function argument), this method works as asyncronous. Callback format callback(item, status), item your prepared FileItem object, result boolean argument with result (success or fail). analysis.prepare('c:\Media\Folder\file1.mp3'); analysis.prepare(file1); function onprepare(file, result) { if (!result) return; ... } analysis.prepare(file1, onprepare); analysis.prepare(file1, function(file, result) { if (!result) return; ... }); This function can be asynchronous (ie. doesn't wait for completion before returning, completed callbacks can be called before any other API method). The JavaScript process is still single threaded. text.calculatetext.calculate(text1, text2);
Calculates similarity score between text1 and text2. Score result lies between [0,1]. res = text.calculate('test', 'tst'); res = text.calculate('test value', '1234'); results.audio.items, results.audio.filesresults.audio.items; Returns array of FileItem objects containing all files shown in Audio Results tab. Each FileItem object additionally has pairs, dups, duplicates property that conatain array of duplicate files. This property structure:
[0], item1, file1 - first FileItem object in pair (same with base FileItem item) var files = results.audio.files; for (var idx = 0; idx < files.length; ++idx) { // receiving duplicates for files[idx] only var dups = files[idx].dups; for (var idx2 = 0; idx2 < dups.length; ++idx2) { ... } } results.audio.pairs, results.audio.dups, results.audio.duplicatesresults.audio.pairs; Returns all pairs shown in Audio Results tab. Array of objects with structure:
[0], item1, file1 - first FileItem object in pair (same with base FileItem item) var dups = results.audio.dups; for (var idx = 0; idx < dups.length; ++idx) { // skip counter-pair (1-2 and 2-1), process pair only once if (dups[idx].item1.path > dups[idx].item2.path) continue; ... } results.audio.clearresults.audio.clear(); Clear all results from Audio Results tab. results.audio.addresults.audio.add(item1, item2, [scores]); Add new duplicate pair into Audio Results tab. item1, item2 - FileItem objects or any strings with pathes. Additional argument is object with scores example {'tags' : 0.7, 'content' : 0.0, 'precise' : 1.0} or just list of arguments with scores example 'tags', 0.7, 'content', 0.0, 'precise', 1.0 function oncompare(item1, item2) { // calculate results for all algorithms var scores = audio.calculate(item1, item2); var mix = scores.tags * scores.content * scores.precise; if (mix > 0.7) { results.audio.add(item1, item2, { 'precise': mix }); } } results.audio.ismarkedresults.audio.ismarked(item); Checks if item is marked in the Audio Results tab. Returns true if item marked or false if not or absent. results.audio.markresults.audio.mark(item, [mark]); Set item to marked or mark boolean value in the Audio Results tab. results.audio.unmarkresults.audio.unmark([item]); Remove mark from item in the Audio Results tab. Without arguments remove all marks from Audio Results tab. results.image.items, results.image.filesresults.image.items; Returns array of FileItem objects containing all files shown in Image Results tab. Each FileItem object additionally has pairs, dups, duplicates property that conatain array of duplicate files. This property structure:
[0], item1, file1 - first FileItem object in pair (same with base FileItem item) var files = results.image.files; for (var idx = 0; idx < files.length; ++idx) { // receiving duplicates for files[idx] only var dups = files[idx].dups; for (var idx2 = 0; idx2 < dups.length; ++idx2) { ... } } results.image.pairs, results.image.dups, results.image.duplicatesresults.image.pairs; Returns all pairs shown in Image Results tab. Array of objects with structure:
[0], item1, file1 - first FileItem object in pair (same with base FileItem item) var dups = results.image.dups; for (var idx = 0; idx < dups.length; ++idx) { // skip counter-pair (1-2 and 2-1), process pair only once if (dups[idx].item1.path > dups[idx].item2.path) continue; ... } results.image.clearresults.image.clear(); Clear all results from Image Results tab. results.image.addresults.image.add(item1, item2, [scores]); Add new duplicate pair into Image Results tab. item1, item2 - FileItem objects or any strings with pathes. Additional argument is object with scores example {'content' : 0.7, 'experimental' : 1.0} or just list of arguments with scores example 'content', 0.7, 'experimental', 1.0 function oncompare(item1, item2) { // calculate results for all algorithms var scores = image.calculate(item1, item2); var mix = scores.content * scores.experimental; if (mix > 0.7) { results.image.add(item1, item2, { 'content': mix }); } } results.image.ismarkedresults.image.ismarked(item); Checks if item is marked in the Image Results tab. Returns true if item marked or false if not or absent. results.image.markresults.image.mark(item, [mark]); Set item to marked or mark boolean value in the Image Results tab. results.image.unmarkresults.image.unmark([item]); Remove mark from item in the Image Results tab. Without arguments remove all marks from Image Results tab. results.analysis.items, results.analysis.filesresults.analysis.items; Returns array of FileItem objects containing all files shown in Analysis Results tab. results.analysis.clearresults.analysis.clear(); Clear all results from Analysis Results tab. results.analysis.addresults.analysis.add(item, [rating]); Add new item into Analysis Results tab. item - FileItem object or any string with path. Additional arguments is object with user defined rating example {'rating' : 1.0} or just list of arguments with rating example 'rating', 0.7 function onprepare(file, result) { results.analysis.add(file, 'rating', myrating(file.analysis)); } function myrating(data) { var score = 1.0; // sample rate score *= 0.5 + 0.5 * (Math.min(44100, Math.max(22050, data.samplerate)) - 22050) / 22050; // bitrate if (data.bitrate > 0) score *= 0.5 + 0.5 * (Math.min(128000, Math.max(64000, data.bitrate)) - 64000) / 64000; return score; } results.analysis.ismarkedresults.analysis.ismarked(item); Checks for item is marked in the Analysis Results tab. Returns true if item marked or false if not or absent. results.analysis.markresults.analysis.mark(item, [mark]); Set item to marked or mark boolean value in the Analysis Results tab. results.analysis.unmarkresults.analysis.unmark([item]); Remove mark from item in the Analysis Results tab. Without arguments remove all marks from Audio Results tab. FileItem classWrapper on processing file FileItem constructornew FileItem(path); Constructs a FileItem object. FileItem.pathFileItem.path; Returns file path FileItem.filenameFileItem.filename; Returns filename and extension FileItem.markedFileItem.marked; Sets or receive marked status of item. Marked status received and set on all tabs (Audio, Image, Analysis) FileItem.markFileItem.mark([mark]); Set to marked or mark boolean value in the Results tab. Marked status received and set on all tabs (Audio, Image, Analysis) FileItem.unmarkFileItem.unmark(); Remove mark in the Results tab. Marked status received and set on all tabs (Audio, Image, Analysis) FileItem.copyTagsFileItem.copyTags(srcPath); Copy all tags (including images, extended tags) from srcPath file to this FileItem. srcPath can be any FileItem object or path string. var fileDst = new FileItem("c:\\Music\\WMA to AAC\\23 - Gibson Brothers - Cuba.m4a"); var fileSrc = new FileItem("c:\\Music\\WMA to AAC\\23 - Gibson Brothers - Cuba.wma"); fileDst.copyTags(fileSrc); FileItem.attributes.archiveFileItem.attributes.archive; Retreive archive boolean file attribute. FileItem.attributes.encryptedFileItem.attributes.encrypted; Retreive encrypted boolean file attribute. FileItem.attributes.compressedFileItem.attributes.compressed; Retreive compressed boolean file attribute. FileItem.attributes.hidden; Retreive hidden boolean file attribute. FileItem.attributes.readonlyFileItem.attributes.readonly; Retreive readonly boolean file attribute. FileItem.attributes.systemFileItem.attributes.system; Retreive system boolean file attribute. FileItem.attributes.rawFileItem.attributes.raw; Raw integer file attribute value (system depended). FileItem.attributes.sizeFileItem.attributes.size; Returns file size value in bytes. FileItem.attributes.creationTimeFileItem.attributes.creationTime; Returns DateTime object of file creation. FileItem.attributes.modificationTimeFileItem.attributes.modificationTime; Returns DateTime object of last file modification. FileItem.audio.formatFileItem.audio.format; Returns format of audio file. Example 'MP3', 'AC-3', etc. FileItem.audio.bitrateFileItem.audio.bitrate; Returns bitrate of audio file. FileItem.audio.durationFileItem.audio.duration; Returns duration in ms of audio file. FileItem.audio.artistFileItem.audio.artist; Returns artist tag of audio file, retreved by decoder. FileItem.audio.albumFileItem.audio.album; Returns album tag of audio file, retreved by decoder. FileItem.audio.titleFileItem.audio.title; Returns title tag of audio file, retreved by decoder. FileItem.image.formatFileItem.image.format; Returns format of image file. Example 'JPEG', 'PNG', etc. FileItem.image.bppFileItem.image.bpp; Returns number of bits per pixel of image file. Example 8, 16. FileItem.image.widthFileItem.image.width; Returns width of image file. FileItem.image.heightFileItem.image.height; Returns height of image file. FileItem.tags.titleFileItem.tags.title; Set/Receive title tag from file, value returned by tagger. Value is string. FileItem.tags.albumFileItem.tags.album; Set/Receive album tag from file, value returned by tagger. Value is string. FileItem.tags.artistFileItem.tags.artist; Set/Receive artist tag from file, value returned by tagger. Value is string. FileItem.tags.genreFileItem.tags.genre; Set/Receive genre tag from file, value returned by tagger. Value is string. FileItem.tags.commentFileItem.tags.comment; Set/Receive comment tag from file, value returned by tagger. Value is string. FileItem.tags.yearFileItem.tags.year; Set/Receive year tag from file, value returned by tagger. Value is integer. FileItem.tags.trackFileItem.tags.track; Set/Receive track tag from file, value returned by tagger. Value is integer. FileItem.analysis.artistFileItem.analysis.artist; Returns artist tag of audio file, retreved by decoder. FileItem.analysis.albumFileItem.analysis.album; Returns album tag of audio file, retreved by decoder. FileItem.analysis.titleFileItem.analysis.title; Returns title tag of audio file, retreved by decoder. FileItem.analysis.bitrateFileItem.analysis.bitrate; Returns bitrate of audio file. FileItem.analysis.durationFileItem.analysis.duration; Returns duration in ms of audio file. FileItem.analysis.samplerateFileItem.analysis.samplerate; Returns sample rate of audio file. FileItem.analysis.datatypeFileItem.analysis.datatype; Returns data type of audio file. Possible values '8', '16', 'float'. FileItem.analysis.channelsFileItem.analysis.channels; Returns channels format of audio file. Possible values 'mono', 'stereo', '5.1', '7.1'. FileItem.analysis.formatFileItem.analysis.format; Returns format of audio file. Example 'MP3', 'AC-3', etc. FileItem.analysis.clipsFileItem.analysis.clips; Returns analysis clips value. FileItem.analysis.silenceFileItem.analysis.silence; Returns analysis silence value. FileItem.analysis.absMeanFileItem.analysis.absMean; Returns analysis absMean value. FileItem.analysis.minStepFileItem.analysis.minStep; Returns analysis minStep value. FileItem.analysis.absMaxFileItem.analysis.absMax; Returns analysis absMax value. FileItem.analysis.maxFreqFileItem.analysis.maxFreq; Returns analysis maxFreq value. FileItem.analysis.clicksFileItem.analysis.clicks; Returns analysis clicks value. FileItem.analysis.ratingFileItem.analysis.rating; Returns analysis rating value. FileIO classClass for working with UTF-8 text files. FileIO.openFileIO.open(path, [flags]); Open FileIO object, arguments same as openFile. FileIO.closeFileIO.close(); Close already opened file. FileIO.writeFileIO.write(text); Write text data into opened file. FileIO.readFileIO.read([size]); Read size bytes from file. Without size read entire file. Return readed data as string. |
Downloads
Premium version
Latest news
2021-11-17 Version 2.5.1 released2020-10-28 Version 2.4.4 released (Mac)2020-09-19 Beta 2.5.0 available2019-11-15 Version 2.4.3 released (Mac) |