Page 1 of 1

export processed files in json format

Posted: 09 May 2019, 13:40
by robfbot
Is there any way to export the log of files that were just processed in JSON format?

I want to connect my CLI script to feed another script which logs the information.

Re: export processed files in json format

Posted: 09 May 2019, 18:11
by rednoah
What kind of information are you looking for specifically?

* the console output is generally just line-by-line human-readable and there's no machine-readable option for log files

Re: export processed files in json format

Posted: 10 May 2019, 02:36
by robfbot
well the more information the better really. Just a list of the items renamed would be good but ideally, having file name, tvdb id, seperated episode/season etc. etc.

Re: export processed files in json format

Posted: 10 May 2019, 05:10
by rednoah
After processing files with FileBot, completely unrelated to logging, you'll be able to read episode / movie metadata from xattr:
viewtopic.php?f=3&t=324

e.g.

Code: Select all

filebot -script fn:xattr /path/to/files

Re: export processed files in json format

Posted: 10 May 2019, 09:49
by robfbot
yeah i saw that one. But i only want the data of the most recently run rename script.

Re: export processed files in json format

Posted: 10 May 2019, 10:49
by rednoah
You can have your own post-process script do things, whatever these things may be:

Code: Select all

-exec /path/to/doSomething.sh {f} {json}
doSomething.sh

Code: Select all

#!/bin/sh -xu
echo "FILE: $1"
echo "META: $2"
:idea: viewtopic.php?f=4&t=5047

Re: export processed files in json format

Posted: 11 May 2019, 01:40
by robfbot
thats bloody perfect.

cheers mate.

Re: export processed files in json format

Posted: 20 May 2019, 05:14
by robfbot
Sorry mate one last thing.
Is there any way to get the number of processed files (other than working it out from the json output etc. within the script?)

Or better yet, is there are reference anywhere of all the output options that can be parsed to the script? f.whatever ?

Re: export processed files in json format

Posted: 20 May 2019, 06:37
by rednoah
1.
You could use [+] to make -exec combine all arguments into a single call, so the number of arguments will be the number of files processed:

Code: Select all

-exec /path/to/doSomething.sh {f} +
or

Code: Select all

-exec /path/to/doSomething.sh "{f} | {json}" +
:idea: In this case, it's probably easier to read the json metadata from each file in the script, so you don't have to interpret arguments in some complicated way. I'm using | here because it's typically not allowed in file paths.


2.
I've added some docs on how to navigate references here:
viewtopic.php?f=9&t=10824