JohnDoee / autotorrent2

Cross-seed matching and torrent lifecycle tool
https://johndoee.github.io/autotorrent2/
MIT License
142 stars 10 forks source link

at2 is unable to add torrent files #31

Closed varoOP closed 1 year ago

varoOP commented 1 year ago

Error:

Matching 1 torrent
Traceback (most recent call last):
  File "/home/username/bin/at2", line 8, in <module>
    sys.exit(cli())
  File "/home/username/.autotorrent/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/username/.autotorrent/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/username/.autotorrent/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/username/.autotorrent/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/username/.autotorrent/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/username/.autotorrent/lib/python3.9/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/username/.autotorrent/lib/python3.9/site-packages/autotorrent/__main__.py", line 485, in add
    torrent = parse_torrent(torrent_data, utf8_compat_mode=db.utf8_compat_mode)
  File "/home/username/.autotorrent/lib/python3.9/site-packages/autotorrent/utils.py", line 618, in parse_torrent
    tracker = tracker.decode()
AttributeError: 'list' object has no attribute 'decode'

If I download the same torrent from the site directly, at2 is able to add it. However, the exact same torrent downloaded by cross-seed throws this error. I am at a loss as to why. Both torrent files, when added to a torrent client like qBittorrent work fine.

When I cat the torrent file that is causing the error, it does have the announce at the top:

cat \[pack\]\[trackername\] Torrent Name.torrent 
d8:announce71:https://tracker.trackername.com/url/announce13:announce-listll71:https://tracker.trackername.com/url/announceee7:comment42:https://trackername.com/torrent/00223/group10:created by22:Creator TorrentClass13:creation datei1659738312e4:infod6:lengthi1448517644e4:name57:Torrent Name12:piece lengthi524288e6:pieces55260:

This is the same torrent's torrent file but at2 is able to add this one:

cat Torrent Name.torrent 
d8:announce71:https://tracker.trackername.com/url/announce7:comment42:https://tracker.com/torrent/00223/group10:created by22:Creator TorrentClass13:creation datei1659738164e4:infod6:lengthi1448517644e4:name57:Torrent Name:piece lengthi524288e6:pieces55260:

Looks like cross-seed is already decoding the announce list and then saving torrent file and that is the difference.

JohnDoee commented 1 year ago

wops, I forgot to take grouped trackers into consideration.

JohnDoee commented 1 year ago

Fixed in v1.2.2