All pastes #784235 Raw Edit

Mine

public text v1 · immutable
·published 2007-11-19 16:42 UTC
rendered paste body
while(self.keep_alive):
            while(self.client.is_playing()):
                if change_data:
                    self._change_data()
                    change_data = False
                buf = self.current_file.read(4096*4)
                if len(buf) == 0:
                    self.client.log("Done sending '%s'" \
                        % self.current_track)
                    change_data = True
                    continue
                try:
                    self._server.send(buf)
                    self._server.sync()  #THIS CAUSES THE EXAILE INTERFACE TO HANG
                except shout.ShoutException:
                    self.disconnect()
                    self.client.stop()
                # THIS WORKS! BUT IS NOT ACCURATE (we need sync() here!)
#                delay = self._server.delay()/1000.0
#                if delay > 0: time.sleep(delay)