Author Topic: What's wrong in this script?  (Read 1115 times)

mkling

  • Jr. Member
  • **
  • Posts: 2
    • View Profile
What's wrong in this script?
« on: July 16, 2019, 17:05:13 »
I'm getting this error   26:Uncaught SyntaxError: Unexpected Identifier

I'm trying to make a script that marks files in audio results. I want to mark a file in each pair  only if the bitrate is lower and the rating is lower.

/*
Author: Similarity Team and edited by user
Version: 1.0
Description:
Mark files after scan only if tags restrictions satisfied. Priority by rating (you can simply change it).
*/


{
// unmark all files
results.audio.unmark();



// simple mark by lower bitrate
var dups = results.audio.dups;
var dups1 = results.anaysis.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;
    // check for our special tag restrictions
    if (!checkRestrictions(dups[idx].item1, dups[idx].item2)) continue;
    // ok now we select by our priority
    if (dups[idx].item1.analysis.rating > dups[idx].item2.analysis.rating) and (dups1[idx].item1.audio.bitrate > dups1[idx].item2.audio.bitrate) dups[idx].item2.marked = true;

}
}


Admin

  • Administrator
  • Hero Member
  • *****
  • Posts: 663
    • View Profile
    • https://www.smilarityapp.com
Re: What's wrong in this script?
« Reply #1 on: September 11, 2019, 19:48:42 »
Sorry for the delay, I think you want this:

Code: [Select]
// unmark all files
results.audio.unmark();

// simple mark by lower bitrate
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;
    // check for our special tag restrictions
    //if (!checkRestrictions(dups[idx].item1, dups[idx].item2)) continue;
    // ok now we select by our priority
    if (dups[idx].item1.analysis.rating > dups[idx].item2.analysis.rating && dups[idx].item1.audio.bitrate > dups[idx].item2.audio.bitrate)
dups[idx].item2.marked = true;
}