Page 1 of 1

Watch continuously written files

PostPosted: Fri Jan 18, 2013 9:10 am
by Jup
I'm using the tivi.tv app to watch and record tv movies. Tizi is using ONE folder for recording and writes continuously (append)into it's file during the recording. You can even use VLC to play it during the recording. It is possible to determine when the writing has been finished (no more data will be written) to process this file with Hazel?

Re: Watch continuously written files

PostPosted: Mon Jan 21, 2013 6:30 pm
by a_freyer
That completely depends on your program. Generally speaking, programs that continually write to files will mark the file as locked. If this is the case, the Hazel will skip the file until it is unlocked.

If this is not the case, you could use a rule that includes something like this:

Code: Select all
if (all) of the following conditions are met for (the file or folder being processed):
     date last modified is not in the last 1 minute

Do the following to the matched file or folder:
     …

Re: Watch continuously written files

PostPosted: Tue Jan 22, 2013 6:50 am
by Jup
The file isn't locked and the way you describes was in my mind too. The question is, when Hazel will get control and check the file. For every byte written? In this case I would need some delay like: "check it every 5 minutes" to avoid a slowdown in processing (that could hurt the video stream).

Re: Watch continuously written files

PostPosted: Tue Jan 22, 2013 1:47 pm
by Mr_Noodle
It depends on the file event system, which is more at the OS level. Hazel will try and wake up for busy files on its own schedule, and that uses a back-off timer (the intervals get longer the longer it's busy). In this case, though, it will probably get woken up more frequently based on how often data is flushed to the filesystem. I'd test it out as it may not be resource-intensive in actual use.