Changing trackers in announce-list corrupts save
See original GitHub issueHi,
First thanks for taking the time to write this.
#
I’m trying to strip out existing (dead) trackers from torrent files and replace them with known good ones. But, changing trackers in the announce-list results in a corrupted (non-working) announce-list. [You can change the “announce” tracker successfully.]
For testing I’ve been using the MX-19.2_x64.iso torrent file. It seems to be no longer available, but similar files are at https://mxlinux.org/torrent-files/ .
Output testing is by loading into qBittorrent v4.2.3 and checking the “Trackers” tab. All tests fail by not loading the changed “announce-list” tracker to the Tracker List in qBittorrent.
See toradd.py code at bottom. I’ve used “pytp” to visualize the outputed torrent files.
Request:
Have the code,
tracker_03a = 'http://tracker.opentrackr.org:1337/announce'
data['announce-list'][0] = tracker_03a
correctly replace the tracker so that it loads successfully into qBittorrent.
Control pass:
Changes: Straight read, no changes, and a write to separate file.
Results: All trackers show up in qBittorrent
michael@local [~/trash]# toradd.py arg1 arg2
michael@local [~/trash]# ./pytp '/home/michael/data/Downloads/isos/torrentfiles/MX-19.2_x64.iso.torrent' -d -i 2 > /home/michael/trash/torout.txt
michael@local [~/trash]# head torout.txt
{
"announce": "http://l2.mxrepo.com:6969/announce",
"announce-list": [
[
"http://l2.mxrepo.com:6969/announce"
],
[
"http://it.mxrepo.com:6969/announce"
]
],
Test 01-a:
Changes:
data['announce-list'][0] = tracker_03a
#data['announce-list'][1] = tracker_01
Results: Loads only tracker http://it.mxrepo.com:6969/announce
Output
michael@local [~/trash]# toradd.py arg1 arg2
michael@local [~/trash]# ./pytp '/home/michael/trash/test.torrent' -d -i 2 > /home/michael/trash/torout2.txt
michael@local [~/trash]# head torout2.txt
{
"announce": "http://tracker.opentrackr.org:1337/announce",
"announce-list": [
"http://tracker.opentrackr.org:1337/announce",
[
"http://it.mxrepo.com:6969/announce"
]
],
"created by": "mktorrent 1.0",
"creation date": 1591050075,
Test 01-b:
Changes:
data['announce-list'][0] = tracker_03a
data['announce-list'][1] = tracker_01
Results: Loads only tracker http://tracker.opentrackr.org:1337/announce
Output
michael@local [~/trash]# toradd.py arg1 arg2
michael@local [~/trash]# ./pytp '/home/michael/trash/test.torrent' -d -i 2 > /home/michael/trash/torout2.txt
michael@local [~/trash]# head torout2.txt
{
"announce": "http://tracker.opentrackr.org:1337/announce",
"announce-list": [
"http://tracker.opentrackr.org:1337/announce",
"http://tracker.dler.org:6969/announce"
],
"created by": "mktorrent 1.0",
"creation date": 1591050075,
"info": {
"length": 1609564160,
Test 02:
Changes:
data['announce-list'][0] = tracker_03b
data['announce-list'][1] = tracker_01
Results: Loads only tracker http://tracker.opentrackr.org:1337/announce
Output
michael@local [~/trash]# toradd.py arg1 arg2
michael@local [~/trash]# ./pytp '/home/michael/trash/test.torrent' -d -i 2 > /home/michael/trash/torout2.txt
michael@local [~/trash]# head torout2.txt
{
"announce": "http://tracker.opentrackr.org:1337/announce",
"announce-list": [
"[\"http://tracker.opentrackr.org:1337/announce\"]",
"http://tracker.dler.org:6969/announce"
],
"created by": "mktorrent 1.0",
"creation date": 1591050075,
"info": {
"length": 1609564160,
Test 03:
Changes:
data['announce-list'][0] = tracker_03c
data['announce-list'][1] = tracker_01
Results: Loads only tracker http://tracker.opentrackr.org:1337/announce
Output
michael@local [~/trash]# toradd.py arg1 arg2
michael@local [~/trash]# ./pytp '/home/michael/trash/test.torrent' -d -i 2 > /home/michael/trash/torout2.txt
michael@local [~/trash]# head torout2.txt
{
"announce": "http://tracker.opentrackr.org:1337/announce",
"announce-list": [
"[http://tracker.opentrackr.org:1337/announce]",
"http://tracker.dler.org:6969/announce"
],
"created by": "mktorrent 1.0",
"creation date": 1591050075,
"info": {
"length": 1609564160,
Test 04:
Changes:
data['announce-list'][0] = tracker_03d
data['announce-list'][1] = tracker_01
Results: Loads only tracker http://tracker.opentrackr.org:1337/announce
Output
michael@local [~/trash]# toradd.py arg1 arg2
michael@local [~/trash]# ./pytp '/home/michael/trash/test.torrent' -d -i 2 > /home/michael/trash/torout2.txt
michael@local [~/trash]# head torout2.txt
{
"announce": "http://tracker.opentrackr.org:1337/announce",
"announce-list": [
"['http://tracker.opentrackr.org:1337/announce']",
"http://tracker.dler.org:6969/announce"
],
"created by": "mktorrent 1.0",
"creation date": 1591050075,
"info": {
"length": 1609564160,
Program used
I was in the middle of passing trackers into the program, so ignore the other testing junk…
michael@local [~/common/bin]# cat toradd.py
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
import torrent_parser as tp
if len(sys.argv) > 2: # Need 2 arguments
print(True)
else:
print(False)
sys.exit(43)
print ('Number of arguments:', len(sys.argv), 'arguments.')
print ('Argument List:', str(sys.argv))
tor_file_in = '/home/michael/data/Downloads/isos/torrentfiles/MX-19.2_x64.iso.torrent'
tor_file_out = '/home/michael/trash/test.torrent'
tracker_00 = "http://tracker.opentrackr.org:1337/announce"
tracker_01 = "http://tracker.dler.org:6969/announce"
tracker_02 = ''
tracker_03a = 'http://tracker.opentrackr.org:1337/announce'
tracker_03b = '["http://tracker.opentrackr.org:1337/announce"]'
tracker_03c = '[http://tracker.opentrackr.org:1337/announce]'
tracker_03d = "['http://tracker.opentrackr.org:1337/announce']"
data = tp.parse_torrent_file(tor_file_in)
print(data['announce'])
print(data['info']['name'])
print(data['announce-list'][0])
print(data['announce-list'][1])
data['announce'] = tracker_00
data['announce-list'][0] = tracker_03c
data['announce-list'][1] = tracker_01
print(data['announce'])
tp.create_torrent_file(tor_file_out, data)
sys.exit(0)
General output of toradd.py
It’s repetitive so I stripped it out of the above to reduce clutter…
michael@local [~/trash]# toradd.py arg1 arg2
True
Number of arguments: 3 arguments.
Argument List: ['/home/michael/common/bin/toradd.py', 'arg1', 'arg2']
http://l2.mxrepo.com:6969/announce
MX-19.2_x64.iso
['http://l2.mxrepo.com:6969/announce']
['http://it.mxrepo.com:6969/announce']
http://tracker.opentrackr.org:1337/announce
Edit: Header bits for the input and output .torrent files
MX-19.2_x64.iso.torrent
d8:announce34:http://l2.mxrepo.com:6969/announce13:announce-listll34:http://l2.mxrepo.com:6969/announceel34:http://it.mxrepo.com:6969/announceee10:created by13:mktorrent 1.013:creation
test.torrent
d8:announce43:http://tracker.opentrackr.org:1337/announce13:announce-listl47:['http://tracker.opentrackr.org:1337/announce']37:http://tracker.dler.org:6969/announcee10:created by13:mktorrent 1.013:creation
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (5 by maintainers)
7sDream,
You obviously never bothered to test your own code, since instead of replying with the proper syntax, you said, “try this.”
As a suggestion, never, ever list this github account on any resume you submit to a potential employer.
You can close this for all I care, I’ll use something else.
I’m pretty sure the
announce-list
can be modified(increased) normally using the code I’ve given.This is not the “syntax problem” you mentioned, but you have absolutely no understanding of the format of the torrent file, nor a basic understanding of the Python language.
I have no responsibility or obligation to guide you on how to use my project, and I don’t care what project you end up using to accomplish your goals. Because of your arrogant attitude, I have no interest in continuing to communicate with you. Good lucks, and please do not use any of my code anymore.