From e416b9edf9ba8758833a818b6eae3d5872ec4bb0 Mon Sep 17 00:00:00 2001 From: MisterDaneel Date: Mon, 25 Feb 2019 13:32:54 +0100 Subject: [PATCH] It's work --- code/process_torrent.py | 8 +++++++- ratio.py | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/code/process_torrent.py b/code/process_torrent.py index 97b5d5d..ce26550 100644 --- a/code/process_torrent.py +++ b/code/process_torrent.py @@ -28,7 +28,11 @@ class process_torrent(): self.b_enc = bencoding() self.metainfo = self.b_enc.bdecode(data) self.info = self.metainfo['info'] - # print(pretty_data(self.info)) + if 'length' not in self.info: + self.info['length'] = 0 + for file in self.info['files']: + self.info['length'] += file['length'] + print(pretty_data(self.info['files'])) def tracker_info_hash(self): raw_info = self.b_enc.get_dict('info') @@ -92,6 +96,8 @@ class process_torrent(): def tracker_process(self): while True: + self.tracker_start_request() + print('----------- Sending Command to Tracker --------') # get upload diff --git a/ratio.py b/ratio.py index f5fe775..68e44d3 100644 --- a/ratio.py +++ b/ratio.py @@ -30,6 +30,5 @@ if __name__ == "__main__": sys.exit() to = process_torrent(configuration) - rep = to.tracker_start_request() to.tracker_process()