It's work

This commit is contained in:
MisterDaneel 2019-02-25 13:32:54 +01:00
parent 8dfd3f3cae
commit e416b9edf9
2 changed files with 7 additions and 2 deletions

View File

@ -28,7 +28,11 @@ class process_torrent():
self.b_enc = bencoding() self.b_enc = bencoding()
self.metainfo = self.b_enc.bdecode(data) self.metainfo = self.b_enc.bdecode(data)
self.info = self.metainfo['info'] 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): def tracker_info_hash(self):
raw_info = self.b_enc.get_dict('info') raw_info = self.b_enc.get_dict('info')
@ -92,6 +96,8 @@ class process_torrent():
def tracker_process(self): def tracker_process(self):
while True: while True:
self.tracker_start_request()
print('----------- Sending Command to Tracker --------') print('----------- Sending Command to Tracker --------')
# get upload # get upload

View File

@ -30,6 +30,5 @@ if __name__ == "__main__":
sys.exit() sys.exit()
to = process_torrent(configuration) to = process_torrent(configuration)
rep = to.tracker_start_request()
to.tracker_process() to.tracker_process()