There was a misunderstand about outgoing interface setting in libtorrent
and instead of being able to take both IP and adapater names, it only
accepts adapter names and errors with an IP address, which was the
default of '0.0.0.0' in code.
This fixes the code to not accept IP address and use empty string if it
is given one.
Also includes a bit of code cleanup.
Some new flake8 checkers were added so fix these new warnings and
any issues uncovered.
Use add-trailing-comma to fix missing trailing commas. It does not
format it as well as I would like however it was fast to change and
helps with git changes in future.
Removed pylint from tox due to large number of warnings.
Switching to Pipenv will speed up developement. See the docs for
details on using Pipenv.
- Added more flake8 checks.
- Added `detox` for running tests in parallel locally.
The tests on Python revealed a bug with comparing dev versions.
Switch to comparing by integers and setting non-dev version to infinity.
There is still an issue with suffix release comparisons beyond single
digits but will leave that for now.
Use a sha1 of time.time() can result in identical host_id. This was
evident with Travis tests randomly failing due to host_id collision
returning the wrong host details.
Using uuid4 to generate a random UUID in hex form should fix this issue.
The use of `{env:PWD}` is not available on Windows so switch to
`{toxworkdir}` which is the directory where virtual environments
are created and sub directories for packaging reside.
Instances of libtorrent with Local Service Discovery enabled are leaving
many sockets fd open with every test run and will fail with 'Too many files
open' if ulimit is >=1024.
Config values are either wrong, unused or default is better.
Disable logging of deluge log output in testing.
Newer versions of pytest now use `pytest` cmd so rename.
The synchonous add torrent method was replaced with async but this
break backward compatibility with 3rd party plugins and clients.
Added a new add_torrent_file_async method for adding single torrent.
Torrent manager has a new add_async method and split up code to prevent
duplication.
Update any use of add_torrent_file to add_torrent_file_async. Future
refactoring could use add_torrent_files instead.
There are some blocklists with encoded names that break upon importing
so decode lines to unicode.
Need to use decode_bytes as not all encoded lines are utf8!
This reverts commit 7b87a93862.
After further discussion in the ticket this change is undesired.
> I wrongly assumed that private trackers will count how many bytes you
> download but they don't, they track how many parts(or chunks?) you
> have, when you announce it. So using total_done is fine, no change
> needed.
> Checking for private flag and using total_wanted_done for public
> enables users to be a bit more selfish. They can start a torrent,
> let it run for a bit then deselect the files they don't want and
> only upload enough to make up for what they wanted to download. This
> means they may upload less than they downloaded, hurting the swarm.
> So I personally don't think this would be a good change.
> Overall my suggestion is to close this as not a bug.
The parsing of the content-disposition in httpdownloader was not able to
handle missing parameters e.g. "Content-Disposition: attachment" and would
result in an IndexError. Added a test for this use-case.
Fixed the issue using the cgi.parse_header to extract the parameters.
The original fix was not correct as the strcoll function cannot
accept None only strings. This fix ensures that the value is an
empty string if None for comparison.
* The changes to core api now return a deferred instead of torrent_id
so need to update autoadd to use callbacks.
* Minor refactor to save one indentation level and reuse fail callback.
* Add exception handler for any errors from label plugin.