diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-02-19 15:05:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-02-19 15:05:49 +0000 |
commit | d395bd510fa4f4376dc5237ab2f8d190a920d35d (patch) | |
tree | 3e3b16b44064938be801aede14381562bae14f6a /deluge/ui/gtk3/addtorrentdialog.py | |
parent | Adding upstream version 2.0.3. (diff) | |
download | deluge-d395bd510fa4f4376dc5237ab2f8d190a920d35d.tar.xz deluge-d395bd510fa4f4376dc5237ab2f8d190a920d35d.zip |
Adding upstream version 2.1.1.upstream/2.1.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'deluge/ui/gtk3/addtorrentdialog.py')
-rw-r--r-- | deluge/ui/gtk3/addtorrentdialog.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/deluge/ui/gtk3/addtorrentdialog.py b/deluge/ui/gtk3/addtorrentdialog.py index 9ede710..cf3851d 100644 --- a/deluge/ui/gtk3/addtorrentdialog.py +++ b/deluge/ui/gtk3/addtorrentdialog.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com> # @@ -7,11 +6,9 @@ # See LICENSE for more details. # -from __future__ import division, unicode_literals - import logging import os -from base64 import b64encode +from base64 import b64decode, b64encode from xml.sax.saxutils import escape as xml_escape from xml.sax.saxutils import unescape as xml_unescape @@ -19,6 +16,7 @@ from gi.repository import Gtk from gi.repository.GObject import TYPE_INT64, TYPE_UINT64 import deluge.component as component +from deluge.bencode import bdecode from deluge.common import ( create_magnet_uri, decode_bytes, @@ -271,6 +269,7 @@ class AddTorrentDialog(component.Component): return if metadata: + metadata = bdecode(b64decode(metadata)) info = TorrentInfo.from_metadata(metadata, [[t] for t in trackers]) self.files[info_hash] = info.files self.infos[info_hash] = info.filedata @@ -301,7 +300,7 @@ class AddTorrentDialog(component.Component): self.builder.get_object('prefetch_hbox').hide() def add_from_magnets(self, uris): - """Add a list of magnet uris to torrent_liststore.""" + """Add a list of magnet URIs to torrent_liststore.""" already_added = 0 for uri in uris: @@ -775,7 +774,7 @@ class AddTorrentDialog(component.Component): else: ErrorDialog( _('Invalid URL'), - '%s %s' % (url, _('is not a valid URL.')), + '{} {}'.format(url, _('is not a valid URL.')), self.dialog, ).run() @@ -817,7 +816,7 @@ class AddTorrentDialog(component.Component): dialog.destroy() ErrorDialog( _('Download Failed'), - '%s %s' % (_('Failed to download:'), url), + '{} {}'.format(_('Failed to download:'), url), details=result.getErrorMessage(), parent=self.dialog, ).run() @@ -853,11 +852,11 @@ class AddTorrentDialog(component.Component): log.debug('Create torrent tracker lines: %s', trackers_text) trackers = list(trackers_tiers_from_text(trackers_text).keys()) - # Convert the information to a magnet uri, this is just easier to + # Convert the information to a magnet URI, this is just easier to # handle this way. log.debug('trackers: %s', trackers) magnet = create_magnet_uri(infohash, infohash, trackers) - log.debug('magnet uri: %s', magnet) + log.debug('magnet URI: %s', magnet) self.add_from_magnets([magnet]) entry.set_text('') |