Using select.kqueue to monitor garageband transcode completion
I want to automate a series of functions in python that trigger when
the OSX application Garagband finishes writing to a file called
A Typical transcode process takes 20 minutes , and I fancy starting
the python program immediately after I start the transcode and then
For the present moment I have a silly implementation that does
something like the code pasted below.
I was looking online for smarter I/O monitoring and I came across the
kqueue classes inside of the select module which could be used to
monitor the kernel events in BSD - so it should work on OSX. However
being a newbie , I cannot understand how to setup the select.kqueue
event to look for garageband closing , i.e finish writing the
transcoded mp3 file.
I did see some code on comp.lang.python about this in a post from
Ritesh Nadhani (pasted below as well). But I dont understand what the
events mean . Looking for help to monitor the file closing using
My Pseudocode for clunky monitoring of file i/o completion:
today_file = open("todays_recording.mp3","r")
print "File not ready yet..continuing to wait"
Some source code I came across on comp.lang.python ( courtesy Ritesh
Vadvani) related to this
import select26 as select
kq = select.kqueue()
fd = os.open("/tmp/a.txt", os.O_RDONLY)
# I dont understand this line below
ev = [select.kevent(fd, filter=select.KQ_FILTER_VNODE,
flags=select.KQ_EV_ADD | select.KQ_EV_ENABLE | select.KQ_EV_ONESHOT,
fflags=select.KQ_NOTE_WRITE | select.KQ_NOTE_DELETE
kq.control(ev, 0, 0)
evts = kq.control(ev, 1, None)
|All times are GMT. The time now is 07:05 PM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.