Merge branch 'release-2.1.1'
This commit is contained in:
commit
0b5f45b486
|
@ -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"]
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
# Changelog
|
||||
|
||||
## 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)
|
||||
|
||||
### Breaking changes
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue