#NEWLINE# def shriek( self , station ) : #NEWLINE# #INDENT# log . info ( ( 'Sending the contents of station: %s' % repr ( station ) ) ) #NEWLINE# while True : #NEWLINE# #INDENT# for name in station . objects ( ) : #NEWLINE# #INDENT# encoded = base64 . b64encode ( station [ name ] ) #NEWLINE# length = len ( encoded ) #NEWLINE# log . info ( ( 'Yelling %s (%d bytes)' % ( name , length ) ) ) #NEWLINE# header_bytes = map ( ord , struct . pack ( '>h' , length ) ) #NEWLINE# header_bytes = [ ( header_bytes [ 0 ] & 15 ) , ( ( header_bytes [ 0 ] >> 4 ) & 15 ) , ( header_bytes [ 1 ] & 15 ) , ( ( header_bytes [ 1 ] >> 4 ) & 15 ) ] #NEWLINE# header_bytes = map ( ( lambda x : ( x | 128 ) ) , header_bytes ) #NEWLINE# header_bytes = map ( chr , header_bytes ) #NEWLINE# send_bytes ( header_bytes , self . tones ) #NEWLINE# log . info ( ( 'Sent header for %s' % name ) ) #NEWLINE# send_bytes ( encoded , self . tones )