ExifTool SubSecTimeOriginal collision & empty tag output when chaining New Name + JS Script method in 4.04
Hi everyone,
I am running into an intermittent batch verification error (Error 102: Duplicate New Filename in batch + occasional empty ExifTool tag strings) in Advanced Renamer 4.04 (64-bit) when renaming folders of ~1,400 Sony A7IV .ARW + .JPG burst pairs.
My batch preset chains two active methods:
1. New Name Method: `<ExifTool:DateTimeOriginal>_<ExifTool:SubSecTimeOriginal>_<Inc Nr:001>` with Name collision rule set to "Append number" (separator `_`).
2. Script Method (JavaScript):
```js
const rawDt = app.parseTags("<ExifTool:DateTimeOriginal>");
const subSec = app.parseTags("<ExifTool:SubSecTimeOriginal>");
if (!subSec || subSec === "") {
return item.newBasename + "_f" + ("00" + index).slice(-3);
}
return rawDt.replace(/[: ]/g, "-") + "_" + subSec;
```
Screenshot of the Batch Runner table and ExifTool stdout pipe log (`DSC08412.ARW` / `DSC08415.ARW`):
https://files.media2url.com/free/e24401a1016b4a.png
(Full-res capture via https://media2url.com/screenshot-to-url: https://media2url.com/m/e24401a1016b4a )
Two things seem to be happening:
1. When two consecutive 10fps Hi+ frames share the exact same `SubSecTimeOriginal` value (`410`), returning a string from the Script Method (`Method #2`) appears to bypass the collision rule configured in `Method #1`, unless a second New Name method is placed after the Script method.
2. Around every 300-400 files (`DSC08415.ARW`, `DSC08416.ARW`), `app.parseTags("<ExifTool:DateTimeOriginal>")` inside the JS Script returns an empty string `""` when the ExifTool `-stay_open True` stdout buffer takes >250ms to flush.
Is there a way to make `app.parseTags()` reuse the already-cached ExifTool metadata from Method #1 instead of spawning a second ExifTool lookup inside the JS Script method, or should the collision rule always be applied in a post-script pass?
Thanks in advance for any pointers!
I am running into an intermittent batch verification error (Error 102: Duplicate New Filename in batch + occasional empty ExifTool tag strings) in Advanced Renamer 4.04 (64-bit) when renaming folders of ~1,400 Sony A7IV .ARW + .JPG burst pairs.
My batch preset chains two active methods:
1. New Name Method: `<ExifTool:DateTimeOriginal>_<ExifTool:SubSecTimeOriginal>_<Inc Nr:001>` with Name collision rule set to "Append number" (separator `_`).
2. Script Method (JavaScript):
```js
const rawDt = app.parseTags("<ExifTool:DateTimeOriginal>");
const subSec = app.parseTags("<ExifTool:SubSecTimeOriginal>");
if (!subSec || subSec === "") {
return item.newBasename + "_f" + ("00" + index).slice(-3);
}
return rawDt.replace(/[: ]/g, "-") + "_" + subSec;
```
Screenshot of the Batch Runner table and ExifTool stdout pipe log (`DSC08412.ARW` / `DSC08415.ARW`):
https://files.media2url.com/free/e24401a1016b4a.png
(Full-res capture via https://media2url.com/screenshot-to-url: https://media2url.com/m/e24401a1016b4a )
Two things seem to be happening:
1. When two consecutive 10fps Hi+ frames share the exact same `SubSecTimeOriginal` value (`410`), returning a string from the Script Method (`Method #2`) appears to bypass the collision rule configured in `Method #1`, unless a second New Name method is placed after the Script method.
2. Around every 300-400 files (`DSC08415.ARW`, `DSC08416.ARW`), `app.parseTags("<ExifTool:DateTimeOriginal>")` inside the JS Script returns an empty string `""` when the ExifTool `-stay_open True` stdout buffer takes >250ms to flush.
Is there a way to make `app.parseTags()` reuse the already-cached ExifTool metadata from Method #1 instead of spawning a second ExifTool lookup inside the JS Script method, or should the collision rule always be applied in a post-script pass?
Thanks in advance for any pointers!
Reply to #1:
Hi Sagar,
I won't say you can't do that, but if it were me I'd move the logic of the "New name" method into the script. Then you'd definitely have access to the values and could manipulate it along with everything else just the way you want.
Looks like this might be a starting place, although Randy can probably help with the finer points if necessary.
const rawDt = app.parseTags("<ExifTool:DateTimeOriginal>");
const subSec = app.parseTags("<ExifTool:SubSecTimeOriginal>");
let nBN = rawDt+ "_" + subSec + "_" + app.parseTags('<Inc Nr:001>') ;
if (!subSec || subSec === "") {
return nBN + "_f" + ("00" + index).slice(-3);
}
return rawDt.replace(/[: ]/g, "-") + "_" + subSec;
EDIT: Just out of curiosity, why are you running v4.04 and not a later version? ENDEDIT
Best,
DF
Hi Sagar,
I won't say you can't do that, but if it were me I'd move the logic of the "New name" method into the script. Then you'd definitely have access to the values and could manipulate it along with everything else just the way you want.
Looks like this might be a starting place, although Randy can probably help with the finer points if necessary.
const rawDt = app.parseTags("<ExifTool:DateTimeOriginal>");
const subSec = app.parseTags("<ExifTool:SubSecTimeOriginal>");
let nBN = rawDt+ "_" + subSec + "_" + app.parseTags('<Inc Nr:001>') ;
if (!subSec || subSec === "") {
return nBN + "_f" + ("00" + index).slice(-3);
}
return rawDt.replace(/[: ]/g, "-") + "_" + subSec;
EDIT: Just out of curiosity, why are you running v4.04 and not a later version? ENDEDIT
Best,
DF