Hi there,
I use Filebot on a Mac and I am very happy with the tool. Amazing to be honest.
I run it after nzbget is finished downloading stuff, invoked from simple bash shell script.
But I am struggling to capture the new destination folder and I was wondering if there is an easy way to simply call filebot so that it returns nothing but the full path to the last rename action it did of movie file?
I have been trying the history and revert commands (in test mode) but cannot get it to return my last action or any for that matter.
Thanks,
-FF
rednoah wrote:Description:
FileBot keeps an internal history of all rename operations in case you want to revert files to their original names. Run this script on the specified file or folder and revert all files to their original names.
Options: --action define revert operation, e.g. --action move (default) will move files back to their original location whereas --action rename will only change the filename back to the original filename but keep the file in it's current folder. You can run the script in test mode via --action test.
I am not a super scripter in bash but I am familiar with grep. I actually had that working for a while but when I upgraded from v3.4 to v4.0 the output format changed and it broke my script. This is the reasons I am trying a more reliable method so that my scripts can work longer without having to verify with updates.
So ideally I don't catch and parse the log at all, I would simply call the history script with a parameter that will only return the most recent entry in the database. As I only process files sequentially on my system this will always work correctly.
Yep, the script above will show you all rename history in sequential order, the last line will be the last file renamed. The only problem you have is that if in the last batch multiple files have been renamed in the last call then fn:history output can't tell you which files belong to which rename batch.
Alternatively you could read the data you need directly from ~/.filebot/history.xml
yeah as you can see I do have that problem due to the subtitle downloads taking place as well. However, if I look in the list those are always following the actual movie / series entry so I could basically run the history query and search for the directory match. That would return 3 matches at most and 1 at a minimum. I basically always grab the first line then and things should be sweet then.
Now my final question is how to do I tell the history query to only return matching records based on the original directory path which I have in my script in a variable?
Sorry if this is silly question, like I said my bash isn't the best in the world and I've been hitting my head and google for example on how to pass the history query a directory as a param.