AMC moving files currently extracting

Any questions? Need some help?
Post Reply
rix
Posts: 8
Joined: 19 Jun 2015, 11:04

AMC moving files currently extracting

Post by rix »

I am using AMC quite frequently, through a custom script. It watches my downloads folder to automatically sort files, once they appear.

I had to create a workaround in bash to detect files, currently being extracted:

Code: Select all

for f in $(find /downloads/RSScrawler/ -type f  -name '*.m*');
do
  # Check if the mkv/mp4/mp3 has been modified (extracted) in the last 60 seconds
  if ! [ `stat --format=%Z $f` -le $(( `date +%s` - 60 )) ]; then
    youngfile=true
   echo "[$f wird gerade entpackt. Breche ab!]"
  fi
done
IFS=$SAVEIFS
# if no young file was found, execute the main script
if [ "$youngfile" = false ] ; then
do stuff, and also call amc afterwards

But sometimes filebot takes to long (because of the amount of files) to sort stuff. Meanwhile, downloading has continued and another file is being extracted. Filebot happily takes these files not fully extracted and sorts them away. This leaves behind broken files in my library, and I cannot wrap filebot in a better way to prevent this from happening.

Is there any way to stop AMC/filebot from moving files that are currently being modified (/increasing in size)?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC moving files currently extracting

Post by rednoah »

No.

Watching folders for changes is usually a bad idea because of these kinds of corner cases. You'll want to chain download / extract / sort in exactly that order and make sure filebot is only called on files that have already been extracted.

So filebot shouldn't be called based on file changes, but by the extract process after files have been sucessfully extracted. But how exactly that works is different depending on the programs are using.

If you really must watch folders, then instead of calling filebot on a folder, you could just pass in all the individual files you want to process, and then you can do any filtering yourself, such as files that are increasing in size over time, implementation of that being up to you.
:idea: Please read the FAQ and How to Request Help.
rix
Posts: 8
Joined: 19 Jun 2015, 11:04

Re: AMC moving files currently extracting

Post by rix »

Thanks for the clarification. Individual file movement it is.. probably :P
Post Reply