rndusr / torf

Python module to create, parse and edit torrent files and magnet links

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Trying to create torrent with single announce url

PyR8zdl opened this issue · comments

I'm trying to create a torrent with a single announce url but I'm having issues.

try: torrent = torf.Torrent(path=path, trackers='https://example.com/announce/dhjhj5h4hfh4fkejfs9dhfgj0', private=True, comment='This is a comment', piece_size=piece_size, created_by='torf/3.0.0', source='EXP')

Gives this error...

Traceback (most recent call last): File "/home/<REDACTED>/bin/autoup3.py", line 383, in <module> torrent_path = str(create_torrent(path, args.overwrite)) File "/home/<REDACTED>/bin/autoup3.py", line 348, in create_torrent source='EXP') File "/home/<REDACTED>/env/lib/python3.6/site-packages/torf/_torrent.py", line 96, in __init__ self.trackers = trackers File "/home/<REDACTED>/env/lib/python3.6/site-packages/torf/_torrent.py", line 390, in trackers tier = [utils.validated_url(str(item))] File "/home/<REDACTED>/env/lib/python3.6/site-packages/torf/_utils.py", line 47, in validated_url raise error.URLError(url) torf._errors.URLError: h: Invalid URL

The only way I can make it create a torrent successfully is to make trackers a list with the single tracker url and that adds announce-list to the torrent file.

I only want announce in the torrent file with a single url.

Am I doing this wrong?

I'm just trying to create a torrent that is a lean as can be. And there is no sense and having announce-list if there is only one tracker.

I thought I read somewhere that if it was a str it would add a single announce and if it was a list it would make an announce-list.

Which is why I was thinking there was someting wrong with the url check since mine was a string.

But now I can't figure out where I saw that. It might have been a different project entirely.

The trackers property is now really smart. Every time it is set or manipulated
it will automatically set and/or remove "announce" and "announce-list".