Author Topic: Glitch in Metadata Mechanic App  (Read 159 times)

thrinn

  • Hero Member
  • ***
  • Posts: 584
Glitch in Metadata Mechanic App
« on: July 06, 2019, 09:15:57 PM »
Hi Mario,
I think I found a small glitch in the very helpful MD Mechanic App: The app checks if the existing value has indeed be changed by the selected replacement logic. If the value is the same as before, a write back is unnecessary and can be skipped. This check is performed in lines 768 to 771 in app.js:
Code: [Select]
if (newVal != v) {
  targetValues[v] = newVal;
  modified = true;
}

This does not work because v contains the index of the array element, not the content. It is easy to fix by replacing v with targetValues[v] in the comparison:
Code: [Select]
if (newVal != targetValues[v]) {
  targetValues[v] = newVal;
  modified = true;
}

No real harm done, because the only effect is that MD Mechanic sets the "unwritten metadata" flag even is the resulting value is the same as before. So one gets more metadata writebacks than strictly necessary.
Thorsten
Win 10 / 64, IMatch 2018, IMA

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 23018
Re: Glitch in Metadata Mechanic App
« Reply #1 on: July 07, 2019, 09:42:54 AM »
Thanks. Good catch.
Fixed for the next release.