From 61e7aad847dcfba02e7b4cd05941ba33c8061517 Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Thu, 4 Aug 2016 12:56:47 +0300 Subject: [PATCH] bug fixes --- toxygen/callbacks.py | 1 - toxygen/file_transfers.py | 2 +- toxygen/profile.py | 6 ++---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/toxygen/callbacks.py b/toxygen/callbacks.py index bcb4a1b..bfca8a4 100644 --- a/toxygen/callbacks.py +++ b/toxygen/callbacks.py @@ -313,7 +313,6 @@ def callback_audio(toxav, friend_number, samples, audio_samples_per_channel, aud """ New audio chunk """ - # print(audio_samples_per_channel, audio_channels_count, rate) Profile.get_instance().call.chunk( bytes(samples[:audio_samples_per_channel * 2 * audio_channels_count]), audio_channels_count, diff --git a/toxygen/file_transfers.py b/toxygen/file_transfers.py index 1794e63..7b23ffc 100644 --- a/toxygen/file_transfers.py +++ b/toxygen/file_transfers.py @@ -223,7 +223,7 @@ class ReceiveTransfer(FileTransfer): def __init__(self, path, tox, friend_number, size, file_number, position=0): 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.truncate(position) self._missed = set() diff --git a/toxygen/profile.py b/toxygen/profile.py index a6d58b9..9f728bb 100644 --- a/toxygen/profile.py +++ b/toxygen/profile.py @@ -315,8 +315,7 @@ class Profile(contact.Contact, Singleton): self._paused_file_transfers[ft.get_id()] = [ft.get_path(), friend_num, False, -1] elif type(ft) is ReceiveTransfer: self._paused_file_transfers[ft.get_id()] = [ft.get_path(), friend_num, True, ft.total_size()] - ft.cancelled() - del self._file_transfers[(friend_num, file_num)] + self.cancel_transfer(friend_num, file_num, True) # ----------------------------------------------------------------------------------------------------------------- # Typing notifications @@ -874,7 +873,7 @@ class Profile(contact.Contact, Singleton): if file_id in self._paused_file_transfers: data = self._paused_file_transfers[file_id] 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']) return 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.set_transfer_finished_handler(self.transfer_finished) self._file_transfers[(friend_number, st.get_file_number())] = st - print('In send file', self._file_transfers) tm = TransferMessage(MESSAGE_OWNER['ME'], time.time(), TOX_FILE_TRANSFER_STATE['OUTGOING_NOT_STARTED'],