From 4cdfd779cb32a3e92fd22f76013d335af78b9488 Mon Sep 17 00:00:00 2001 From: Garnajee <62147746+garnajee@users.noreply.github.com> Date: Thu, 6 Jun 2024 11:30:32 +0200 Subject: [PATCH] Update Transmission version to (#1) Co-authored-by: garnajee --- README.md | 2 +- code/process_torrent.py | 4 ++-- code/torrentclientfactory.py | 8 ++++---- update_transmission_version.sh | 0 4 files changed, 7 insertions(+), 7 deletions(-) mode change 100644 => 100755 update_transmission_version.sh diff --git a/README.md b/README.md index 797749e..e9714dd 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Ratio.py is a small command line RatioMaster.Net like in Python3. It fakes upload stats of a torrent. Current emulators available are: -- Transmission 3.00 +- Transmission 4.0.6 ### Requirements diff --git a/code/process_torrent.py b/code/process_torrent.py index 5fc9e03..361c086 100644 --- a/code/process_torrent.py +++ b/code/process_torrent.py @@ -1,5 +1,5 @@ from code.decoding_bencoded import bencoding -from code.torrentclientfactory import Transmission300 +from code.torrentclientfactory import Transmission406 from code.pretty import pretty_data, pretty_GET from hashlib import sha1 @@ -19,7 +19,7 @@ class process_torrent(): def __init__(self, configuration): self.configuration = configuration self.open_torrent() - self.torrentclient = Transmission300(self.tracker_info_hash()) + self.torrentclient = Transmission406(self.tracker_info_hash()) def open_torrent(self): torrent_file = self.configuration['torrent'] diff --git a/code/torrentclientfactory.py b/code/torrentclientfactory.py index 48387c6..878212c 100644 --- a/code/torrentclientfactory.py +++ b/code/torrentclientfactory.py @@ -1,9 +1,9 @@ import random import string -class Transmission300(): +class Transmission406(): def __init__(self, info_hash): - self.name = "Transmission 3.00" + self.name = "Transmission/4.0.6" parameters = {} # urlencoded 20-byte SHA1 hash of the value of the info key from the Metainfo file parameters['info_hash'] = info_hash @@ -23,7 +23,7 @@ class Transmission300(): def get_headers(self): headers = {} - headers['User-Agent'] = 'Transmission/3.00' + headers['User-Agent'] = 'Transmission/4.0.6' headers['Accept'] = '*/*' headers['Accept-Encoding'] = 'Accept-Encoding: gzip;q=1.0, deflate, identity' return headers @@ -51,7 +51,7 @@ class Transmission300(): def generate_peer_id(self): chars = string.ascii_lowercase + string.digits rand_id = self.id_generator(chars, 12) - peer_id = "-TR3000-" + rand_id + peer_id = "-TR4060-" + rand_id return peer_id def generate_key(self): diff --git a/update_transmission_version.sh b/update_transmission_version.sh old mode 100644 new mode 100755