Compare commits

...

8 Commits

Author SHA1 Message Date
0b5f45b486 Merge branch 'release-2.1.1' 2022-07-10 13:20:41 +01:00
05e13a6b20 Release 2.1.1 2022-07-10 13:15:45 +01:00
b64084d248 [Docs] Update changelog and install details 2022-07-08 09:04:57 +01:00
e120536d87 Fix parsing magnet with tracker tiers
Magnets with trackers specified with tr.x param were not being unquoted
so unusable raw tracker string was being set.

Fixed by unquoting tracker and adding test

See-also: https://dev.deluge-torrent.org/ticket/2716
2022-07-08 08:34:29 +01:00
f52cf760e4 Fix missing trackers adding magnets
The changes to remove deprecated lt methods didn't account for magnet
trackers so magnets are missing trackers when added.

Previously the addition of trackers was handled by libtorrent when a url
was passed in add_torrent_params. The url parameter is deprecated so
instead we need to add both the info_hash and trackers.

Trac: https://dev.deluge-torrent.org/ticket/3530
2022-07-05 08:03:33 +01:00
94d790c159 [CI] Bump ifaddr to 0.2.0
With release of ifaddr 0.2.0 no longer need to pin to github commit to
resolve Windows decoding issues.
2022-06-30 21:47:06 +01:00
f78506161d [CI] Fix failing Windows Python 3.10 tests
A recent dependency change caused the tests running on GitHub Actions
under Python 3.10.5 on Windows to fail when starting pytest run:

    ...
    INTERNALERROR>   File "<frozen importlib._bootstrap>", line 123, in acquire
    INTERNALERROR> KeyError: xxxx

The cause seems to have been a newer version of chardet package released
recently.

* Fixed by pinning chardet to v4
* Also pin Windows version to 2019 to match packaging workflow

See-also: https://github.com/deluge-torrent/deluge/actions/runs/2578427588
Issue: https://github.com/chardet/chardet/issues/265
2022-06-29 15:07:23 +01:00
20efcfd345 Release 2.1.0 2022-06-28 19:52:35 +01:00
8 changed files with 43 additions and 27 deletions

View File

@ -65,7 +65,7 @@ jobs:
path: /cores
test-windows:
runs-on: windows-latest
runs-on: windows-2019
strategy:
matrix:
python-version: ["3.7", "3.10"]

View File

@ -1,6 +1,11 @@
# Changelog
## unreleased
## 2.1.1 (2022-07-10)
### Core
- Fix missing trackers added via magnet
- Fix handling magnets with tracker tiers
## 2.1.0 (2022-06-28)

View File

@ -734,6 +734,8 @@ MAGNET_SCHEME = 'magnet:?'
XT_BTIH_PARAM = 'xt=urn:btih:'
DN_PARAM = 'dn='
TR_PARAM = 'tr='
TR_TIER_PARAM = 'tr.'
TR_TIER_REGEX = re.compile(r'^tr.(\d+)=(\S+)')
def is_magnet(uri):
@ -776,8 +778,6 @@ def get_magnet_info(uri):
"""
tr0_param = 'tr.'
tr0_param_regex = re.compile(r'^tr.(\d+)=(\S+)')
if not uri.startswith(MAGNET_SCHEME):
return {}
@ -805,12 +805,14 @@ def get_magnet_info(uri):
tracker = unquote_plus(param[len(TR_PARAM) :])
trackers[tracker] = tier
tier += 1
elif param.startswith(tr0_param):
try:
tier, tracker = re.match(tr0_param_regex, param).groups()
trackers[tracker] = tier
except AttributeError:
pass
elif param.startswith(TR_TIER_PARAM):
tracker_match = re.match(TR_TIER_REGEX, param)
if not tracker_match:
continue
tier, tracker = tracker_match.groups()
tracker = unquote_plus(tracker)
trackers[tracker] = int(tier)
if info_hash:
if not name:

View File

@ -436,8 +436,8 @@ class TorrentManager(component.Component):
magnet_info = get_magnet_info(magnet)
if magnet_info:
add_torrent_params['name'] = magnet_info['name']
add_torrent_params['trackers'] = list(magnet_info['trackers'])
torrent_id = magnet_info['info_hash']
# Workaround lt 1.2 bug for magnet resume data with no metadata
add_torrent_params['info_hash'] = bytes(bytearray.fromhex(torrent_id))
else:
raise AddTorrentError(

View File

@ -7,6 +7,7 @@
import os
import sys
import tarfile
from urllib.parse import quote_plus
import pytest
@ -19,6 +20,7 @@ from deluge.common import (
fsize,
fspeed,
ftime,
get_magnet_info,
get_path_size,
is_infohash,
is_interface,
@ -209,3 +211,16 @@ class TestCommon:
if tar_info.name == 'archive_message.txt':
result = tar.extractfile(tar_info).read().decode()
assert result == 'test'
def test_get_magnet_info_tiers(self):
tracker1 = 'udp://tracker1.example.com'
tracker2 = 'udp://tracker2.example.com'
magnet = (
'magnet:?xt=urn:btih:SU5225URMTUEQLDXQWRB2EQWN6KLTYKN'
f'&tr.1={quote_plus(tracker1)}'
f'&tr.2={quote_plus(tracker2)}'
)
result = get_magnet_info(magnet)
assert result['info_hash'] == '953bad769164e8482c7785a21d12166f94b9e14d'
assert result['trackers'][tracker1] == 1
assert result['trackers'][tracker2] == 2

View File

@ -222,10 +222,15 @@ class TestCore(BaseTestCase):
@pytest_twisted.inlineCallbacks
def test_add_torrent_magnet(self):
info_hash = '60d5d82328b4547511fdeac9bf4d0112daa0ce00'
uri = deluge.common.create_magnet_uri(info_hash)
tracker = 'udp://tracker.example.com'
name = 'test magnet'
uri = deluge.common.create_magnet_uri(info_hash, name=name, trackers=[tracker])
options = {}
torrent_id = yield self.core.add_torrent_magnet(uri, options)
assert torrent_id == info_hash
torrent_status = self.core.get_torrent_status(torrent_id, ['name', 'trackers'])
assert torrent_status['trackers'][0]['url'] == tracker
assert torrent_status['name'] == name
def test_resume_torrent(self):
tid1 = self.add_torrent('test.torrent', paused=True)

View File

@ -48,9 +48,9 @@ One-click [**Install**](https://dl.flathub.org/repo/appstream/org.deluge_torrent
## <i class="fa fa-windows"></i> Windows
Unfortunately no official installer package currently available.
Download [installer](https://ftp.osuosl.org/pub/deluge/windows/?C=M;O=D)
See [Alternative Installs](#alternative-installs)
Availble for Windows 7, 8 & 10 for both 32-bit and 64-bit OSes.
## <i class="fa fa-apple"></i> macOS
@ -96,15 +96,6 @@ The [development PPA] contains daily builds from the `develop` branch.
sudo add-apt-repository -u ppa:deluge-team/develop
sudo apt install deluge
### Windows Community
Due to move to GTK3 and Python 3 and problems with pyinstaller there are only community
created installers available.
Check sticky topics in [Windows Forum] for latest updates.
For reference [issue #3201] is tracking progress on an official installer.
### macOS Community
#### Unofficial `.app` packages
@ -138,7 +129,5 @@ sudo port install deluge
[development ppa]: https://launchpad.net/~deluge-team/+archive/ubuntu/develop/
[stable ppa]: https://launchpad.net/~deluge-team/+archive/ubuntu/stable/
[homebrew]: https://brew.sh/
[issue #3201]: https://dev.deluge-torrent.org/ticket/3201
[windows forum]: https://forum.deluge-torrent.org/viewforum.php?f=12
[macos forum]: https://forum.deluge-torrent.org/viewforum.php?f=13
[depends]: ../depends.md

View File

@ -6,7 +6,7 @@ pyxdg
pillow
mako
setuptools
chardet
chardet==4.0.0
setproctitle
pywin32; sys_platform == 'win32'
certifi; sys_platform == 'win32'
@ -14,4 +14,4 @@ windows-curses; sys_platform == 'win32'
zope.interface>=4.4.2
distro; 'linux' in sys_platform or 'bsd' in sys_platform
pygeoip
https://github.com/pydron/ifaddr/archive/37cb5334f392f12811d38d90ec891746e3247c76.zip
ifaddr==0.2.0