bug fixes

This commit is contained in:
ingvar1995 2016-08-04 12:56:47 +03:00
parent 742d853b11
commit 61e7aad847
3 changed files with 3 additions and 6 deletions

View File

@ -313,7 +313,6 @@ def callback_audio(toxav, friend_number, samples, audio_samples_per_channel, aud
""" """
New audio chunk New audio chunk
""" """
# print(audio_samples_per_channel, audio_channels_count, rate)
Profile.get_instance().call.chunk( Profile.get_instance().call.chunk(
bytes(samples[:audio_samples_per_channel * 2 * audio_channels_count]), bytes(samples[:audio_samples_per_channel * 2 * audio_channels_count]),
audio_channels_count, audio_channels_count,

View File

@ -223,7 +223,7 @@ class ReceiveTransfer(FileTransfer):
def __init__(self, path, tox, friend_number, size, file_number, position=0): def __init__(self, path, tox, friend_number, size, file_number, position=0):
super(ReceiveTransfer, self).__init__(path, tox, friend_number, size, file_number) super(ReceiveTransfer, self).__init__(path, tox, friend_number, size, file_number)
self._file = open(self._path, 'wb', 1371 * 4) self._file = open(self._path, 'wb')
self._file_size = position self._file_size = position
self._file.truncate(position) self._file.truncate(position)
self._missed = set() self._missed = set()

View File

@ -315,8 +315,7 @@ class Profile(contact.Contact, Singleton):
self._paused_file_transfers[ft.get_id()] = [ft.get_path(), friend_num, False, -1] self._paused_file_transfers[ft.get_id()] = [ft.get_path(), friend_num, False, -1]
elif type(ft) is ReceiveTransfer: elif type(ft) is ReceiveTransfer:
self._paused_file_transfers[ft.get_id()] = [ft.get_path(), friend_num, True, ft.total_size()] self._paused_file_transfers[ft.get_id()] = [ft.get_path(), friend_num, True, ft.total_size()]
ft.cancelled() self.cancel_transfer(friend_num, file_num, True)
del self._file_transfers[(friend_num, file_num)]
# ----------------------------------------------------------------------------------------------------------------- # -----------------------------------------------------------------------------------------------------------------
# Typing notifications # Typing notifications
@ -874,7 +873,7 @@ class Profile(contact.Contact, Singleton):
if file_id in self._paused_file_transfers: if file_id in self._paused_file_transfers:
data = self._paused_file_transfers[file_id] data = self._paused_file_transfers[file_id]
pos = data[-1] if os.path.exists(data[0]) else 0 pos = data[-1] if os.path.exists(data[0]) else 0
if pos >= os.path.getsize(data[0]): if pos >= size:
self._tox.file_control(friend_number, file_number, TOX_FILE_CONTROL['CANCEL']) self._tox.file_control(friend_number, file_number, TOX_FILE_CONTROL['CANCEL'])
return return
self._tox.file_seek(friend_number, file_number, pos) self._tox.file_seek(friend_number, file_number, pos)
@ -1075,7 +1074,6 @@ class Profile(contact.Contact, Singleton):
st = SendTransfer(path, self._tox, friend_number, TOX_FILE_KIND['DATA'], file_id) st = SendTransfer(path, self._tox, friend_number, TOX_FILE_KIND['DATA'], file_id)
st.set_transfer_finished_handler(self.transfer_finished) st.set_transfer_finished_handler(self.transfer_finished)
self._file_transfers[(friend_number, st.get_file_number())] = st self._file_transfers[(friend_number, st.get_file_number())] = st
print('In send file', self._file_transfers)
tm = TransferMessage(MESSAGE_OWNER['ME'], tm = TransferMessage(MESSAGE_OWNER['ME'],
time.time(), time.time(),
TOX_FILE_TRANSFER_STATE['OUTGOING_NOT_STARTED'], TOX_FILE_TRANSFER_STATE['OUTGOING_NOT_STARTED'],