Torrent downloads from rutracker responds with the header:
Content-Type: application/x-bittorrent; charset=Windows-1251
The problem is that httpdownloader was using the charset to re-encode
the downloaded file, corrupting the binary torrent file download.
Fixed by only re-encoding text content types, since it is very rare
that non-text content types would actually have a non-utf8 codeset and
if there is a requirement we would need to determine it on a type by
type basis.
The GTKUI tests were failing and the saved config for the tab bar
position was not being restored.
Fixed by moving the setting of notebook.tabs_pos to TorrentDetail init.
Replaced more deprecated methods that were showing up in tests.
The tabs placement for the torrentdetails notebook might not be to
everyone's liking so add a menu item to configure it.
Default the position back to top.
Notifications plugin uses pygame for sound notifications however pygame
show a console message "Hello from the pygame community." whenever
starting deluge from console.
Refs: https://stackoverflow.com/a/55769463/175584
Users were encountering the following error while attempting to delete
magnet torrents and had the config 'Delete copy of torrent file'
enabled. This was due to removing a magnet before the metadata was
downloaded and the torrent.filename was still set to None so raises
exceptions when string operations are performed with it.
File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 1317, in delete_torrentfile
os.path.join(self.config['torrentfiles_location'], self.filename)
...
TypeError: join() argument must be str or bytes, not 'NoneType'
Fixed by both setting a default empty string for self.filename and only
deleting the torrent file copy if filename is set.
The tests in ConsoleUIWithDaemonBaseTestCase could fail to the hard coded
port 58900 being busy.
Fix by using the proper port found in self.listen_port
Also convert unnecessary use of assertTrue where more appropriate
assert functions should be used, such as assertEqual and assertIn
Encoutering an error when webui attempts to download tracker icon:
Error occurred downloading file from "http://b'acg.rip'/": invalid
hostname: b'acg.rip'
Fixed by ensuring the request.tracker_name is decoded from bytes before
looking up the icon name.
* Fixed black hook requiring Py3.6 to installed locally. Will now assume
Py3.6+ in installed.
* Added isort traceback in pre-commit flake8 hook fails
* Updated versions of Black, Prettier and isort
* Keep Flake8 at 3.7.9 due to E402 issue: https://gitlab.com/pycqa/flake8/-/issues/638
* New pyproject config for isort v5 with fixes for Python 2 imports.
* Fixed travis config to run Python 3.6 for lint run. Replaced the
virtualenv with_system_site_packages config with Travis specific Python
config value so lint run doesn't attempt to append with_system_site_packages
to Python 3.6 command.
Comparisons on Python 3 are much stricter resulting in the following
error comparing with None:
TypeError: '>' not supported between instances of 'NoneType' and 'str'
Fix this by getting the type of the other value and getting it's default
value.
If a host in hostlist failed DNS lookup or other issue it was returning
a tuple instead of deferred. Fix this in hostlist by returning a
defer.succeed.
A race condition with BaseMode was also encountered when
update_hosts_status calls update_select_host_popup and
ConnectionManager does not have a rows attribute. Fix this by init
BaseMode before update_hosts_status and remove already called
update_select_host_popup.
Python3 has stricter type checking and passing a port as string results
in libtorrent raising a TypeError.
Fixed by casting port to int, along with refactoring to ensure ipv6 is
correctly parsing and a useful error is output to user with invalid ip
or port details.
https://dev.deluge-torrent.org/ticket/3348
If a password or other string contained a double-quote then the config
would fail to be loaded on startup and reset.
This occurred due to fixing a similar issue with curly braces for #3079
in commit 33e9545cd4 and the checking for double-quotes had unforseen
consequences.
To resolve both these issues the code to check for json objects in
config files was simplified and utilises the json module raw_decode
method to ensure the extracted string indexes are json objects.
Commit b32c5d824 changed the logged message in deluge/core/daemon_entry.py
when libtorrent fails to listen on the given port, without updating the
trigger expression in deluge/tests/common.py:start_core to match the new output.
Fix by updating the trigger match expressions to match the new log output
Accessing pytest.config is deprecated and produces:
PytestDeprecationWarning: the pytest.config global is deprecated. Please use
request.config or pytest_configure (if you're a pytest plugin) instead.
Fix by using a pytest.fixture
Currently, the dialog window is displayed until after the callback has returned.
The result is that if a new dialog is opened from the callback, the first dialog
is still displayed until the new dialog is destroyed.
Fix by destroying the dialog before running the callback.
The exception string "No module named libtorrent" was changed to
"No module named 'libtorrent'" in python 3.3, which results in a
"unknown Import Error" message being displayed instead of the
message meant for libtorrent import error.
Change to raising LibtorrentImportError in _libtorrent.py and
catch this error to display libtorrent specific import errors.
* Error occurring with Pytest 5.4 so pin to below that version.
* Fix minor issues with Travis config.
* Use full command-switches for pytest in tox config.
* Remove pin for pip as issue with pip-wheel-metadata was fixed in 19.3
* Remove tox-venv as causing issues of incompatible packages installed.
The latest versions of the virtualenv package should handle these
duties.
GitHub user JohnDoee reported that config settings are not decoded
correctly, this error can be reproduced with a command like
deluge-console -c /config/ "config --set download_location /downloads"
> AttributeError: 'str' object has no attribute 'decode'
The tokenize code was using 'string-escape' to decode strings but there
is no direct replacement in Python 3 but also unnecessary. However the
tokenize code is complex and buggy and not really suitable for the task
of evaluating config values.
A better alternative is to evaluate the config values using the json
decoder with some additional logic to allow for previous syntax usage,
such as parentheses.
Added a comprehensive set of tests to check for potential config values
passed in from command line.
Deluge's logger class extends Python's `logging.Logger`. Since Python
3.8, it takes an additional argument `stacklevel`.
The implementation in Deluge does not support that. Work around the
problem by ignoring additional arguments.
When trying to load a torrents.state from version 1.3 users were
encountering the following error:
UnicodeDecodeError: 'ascii' codec can't decode byte
This was due to the way that Python 2 was pickling state with torrent
filenames that contained non-ascii characters and Python 3 was
unpickling the state using ascii encoding and failing. The fix is to
specify utf-8 encoding when loading torrents.state.
When a user clicked ESC key or X button, the Options and Add windows
didn't open again. This happened because the windows were closed and
not hidden, which deleted the instance of those windows.
This fix changed the behavior of the close action to 'hide'.
Some users have been reporting unhandled UnicodeDecodeErrors and the
traces show it occuring in the call to `peer.client`. Although unable to
replicate it seems prudent to put a try..except around the call to
ensure it does not break the UIs.
Refs: https://github.com/arvidn/libtorrent/issues/3858Closes: #3279
If dbus org.freedesktop.FileManager1 service is missing then show_file
raised an unhandled exception. The service is not available on certain
desktop environments e.g. i3wm.
The solution is to fallback to xdg-open.
Fixes: #3272