{EncodedDate} only returning date

Running FileBot from the console, Groovy / FileBot scripting, shell scripts, etc
Post Reply
bdfrase
Posts: 3
Joined: 16 Feb 2019, 13:41

{EncodedDate} only returning date

Post by bdfrase » 16 Feb 2019, 14:22

I'm trying to rename home videos my wife takes with her iDevices with creation timestamp data, like the default for Android. (eg. 20190418_142030.mp4). The .MOV files contain the data I need in EncodedDate (UTC timestamp). However, when I use the {EncodedDate} binding, it only returns the date portion.

I can't find "encodeddate" in the binding reference, and I only got this far by blunt force trial and error.

For help, I'd love to get a link to a solid binding reference or how to get the entire tag data for EncodedDate. I'm probably missing something fundamental about how Filebot accesses the tags in MediaInfo...

Image showing tag data.
Image

Image showing results of binding.
Image

Image showing error message
Image

User avatar
rednoah
The Source
Posts: 16971
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: {EncodedDate} only returning date

Post by rednoah » 16 Feb 2019, 15:17

Please read this:
viewtopic.php?f=5&t=4285


You can access raw MediaInfo fields like so:

Code: Select all

{media.EncodedDate}
:idea: This will give you a String object, and not a Date object, so you can't do any date formatting.


FileBot does provider a convenience binding {encodedDate} which does give you a Date object, but with Year / Month / Day precision only, and without Hours / Minutes / Seconds information, which explains why HHmmdd doesn't work:

Code: Select all

{encodedDate}

You could take matters into your own hands and do something like this:

Code: Select all

{media.EncodedDate.parseDate('zzz yyyy-MM-dd HH:mm:ss').format('yyyyMMdd_HHmmdd')}
:!: Date.parseDate may require a newer FileBot 4.8.5 pre-release build.
:idea: Please read the FAQ and How to Request Help.

bdfrase
Posts: 3
Joined: 16 Feb 2019, 13:41

Re: {EncodedDate} only returning date

Post by bdfrase » 16 Feb 2019, 15:24

Thank you!

bdfrase
Posts: 3
Joined: 16 Feb 2019, 13:41

Re: {EncodedDate} only returning date

Post by bdfrase » 16 Feb 2019, 15:57

For anyone with the same problem, this works in the current release:

Code: Select all

{media.EncodedDate.after("UTC ").replaceAll("-").colon("").space("_")}.{ext}

Post Reply