Posts Tagged ‘python’

SVN stat + externals = visual horror

February 23, 2009

The student robotics firmwares pull in a library, Rob has implemented this wizzardy with svn externals. Whilst I enjoy the idea, I find the modified output of svn stat quite hard to scan quickly and therefore hard to read:

X      lib-fw/flash430/trunk/types
X      motor/firmware/trunk/flash430
X      motor/firmware/trunk/types
?      pwm/svn-stat-dump
?      pwm/svn-stat-dumppy
X      pwm/firmware/trunk/flash430
X      pwm/firmware/trunk/types
M      pwm/firmware/trunk/main.c
X      jointio/firmware/trunk/flash430
X      jointio/firmware/trunk/types
?      power/pcb/trunk/gerbers/power-bstop.gbr
?      power/pcb/trunk/gerbers/power-tstop.gbr
X      power/firmware/trunk/flash430
X      power/firmware/trunk/types

Performing status on external item at ‘motor/firmware/trunk/flash430′
X      motor/firmware/trunk/flash430/types

Performing status on external item at ‘motor/firmware/trunk/flash430/types’

Performing status on external item at ‘motor/firmware/trunk/types’

Performing status on external item at ‘pwm/firmware/trunk/flash430′
X      pwm/firmware/trunk/flash430/types

Performing status on external item at ‘pwm/firmware/trunk/flash430/types’

Performing status on external item at ‘pwm/firmware/trunk/types’

Performing status on external item at ‘lib-fw/flash430/trunk/types’

Performing status on external item at ‘jointio/firmware/trunk/flash430′
X      jointio/firmware/trunk/flash430/types

Performing status on external item at ‘jointio/firmware/trunk/flash430/types’

Each external adds at least two lines, three if modified. So five minutes produced this

usage is:  svn stat | pystat.py, I think I will add an alias as I use it quite a bit.

giving a cleaner output (the white space is a bit mangled by wordpress! X,M,? etc should all line up, I should probably find a way to fix this):

X      lib-fw/flash430/trunk/types
X      motor/firmware/trunk/flash430
X      motor/firmware/trunk/types
?      pwm/svn-stat-dump
?      pwm/svn-stat-dumppy
X      pwm/firmware/trunk/flash430
X      pwm/firmware/trunk/types
M      pwm/firmware/trunk/main.c
X      jointio/firmware/trunk/flash430
X      jointio/firmware/trunk/types
?      power/pcb/trunk/gerbers/power-bstop.gbr
?      power/pcb/trunk/gerbers/power-tstop.gbr
X      power/firmware/trunk/flash430
X      power/firmware/trunk/types
ext  X      motor/firmware/trunk/flash430/types
ext  X      pwm/firmware/trunk/flash430/types
ext  X      jointio/firmware/trunk/flash430/types
ext  X      power/firmware/trunk/flash430/types

This was also one of those things Ive been thinking about for ages, but unwilling to commit the time for such a minor irritant. Once I eventually broke, I decided to time the implementation, it really was sub 5 min including (swift) testing! So yes it was definitely worth it for reduced groan!

Dictation pedals

February 16, 2009

At about 1930 on Tuesday I decided to go and see Jeff’s jewellery at the Southampton artsoc’s exhibition. The timing is important  because it was that evening. To make any use of the evening, I had to be in Southampton by 2100. The hours journey time gave me 30 minutes to pack, ablute and generate the necessary black tie for the evening. Needless to say, it was somewhat neglected after its last outing. The restricted spin up time meant I packed minimum of clothes and more crucially, didn’t take the hacking box.

After Southampton, I headed down to Exeter to see Rob and Anne. Anne is a PHD student, as part of her research she has conducted a bunch of interviews, which need transcribing. She borrowed some dictation pedals from the secretaries in her department but could not get them to work with her mac….. need I say more. The idea of these pedals is that one can pause, play and rewind the playback of dictated recordings. This sounded like a hack in the making. Whilst wondering around the town centre, I picked up some seeds of an idea, a £12 game controller and some bits of hardware. Having left the hacking box at home the only tools available to me were my leatherman and any kitchen implements found in a well stocked student kitchen. Later that night, after an evening in the real world, the hack was on. Some major bodgery combined pygame and vlc through the medium of python into some very sketchy dictation software. Its seriously unpleasant due to limited development time but can be found here.

After a bit of flailing, I managed to attach a footplate (angle bracket) to one of the thumb pads. The screws I bought from the hardware store in town were too long so I needed a spacer. As the pictures show, the best thing I could find was the handle of my disposable razor, cut with some scissors – yuk!

After a few hours debugging, the system was put to the test. I transcribed 16min of recording in about 3 hours. I was amazed it takes so long!

The basic usage is to start the program, listen and transcribe simultaneously until ones mental buffer reaches capacity, then hit the foot pedal – whilst continuing to type from ones mental FIFO. The first pedal press pauses playback and rewinds five seconds. After transcribing as far as memory permits, the pedal is pressed again, restarting playback. The five second rewind permits error checking and allows you to re-sync with the data-stream. Further, consecutive stop-start cycles rewind further in blocks of approximately five seconds.

Using the vlc RC interface in addition to the standard gui permits more advanced functions to be performed in the “normal way” eg slowing playback by clicking a button.

joy-pedal

joy-pedal-use

I intend to leave the “pedal” with Anne in actual deployment so hopefully there will be more feedback soon.

Ps, using the vlc RC interface in the manner I have is a really bad idea, its massively un-resilient to change because it is not possible to flush the pipes. Hence it is easy to get in an unexpected state – see all the debug statements left in!

Pps: This is a sample of the interview I transcribed:

” But I mean there are, you, you, you could actually, there are places which ive tried to do something with temporarily. But its not warm, its cold. It lets all the cold air in so therefore its not efficient. It lets all my heat out as-well, if it lets the cold in, the heat must go out.”

I dont envie Anna, its really very hard dealing with what is being said on the recordings, mainly because people often tend to mumble total drivel! Good luck to her.

Ppps: Thanks to Mr Steve who gave me a quick pointer on the tkinter being included in python.