Changes in libtorrent 1.1 mean that alerts are no longer allowed to be
accessed after the next call to pop_alerts.
> It is safe to call pop_alerts from multiple different threads, as
long as the alerts themselves are not accessed once another thread
calls pop_alerts. Doing this requires manual synchronization between
the popping threads.
The solution is to copy the alert attributes and pass that to the
handlers.
Refs: https://github.com/arvidn/libtorrent/issues/2779#3159
Some changes between lt 1.1 and 1.2 require updates to core code.
- Switch from proxy_type to proxy_type_t
- Replace hardcoded flag value with add_torrent_params_flags_t since
1.2 uses different flag values.
- add_torrent_params requires flags set instead of dict values.
Refs: #3255
On macOS the Quartz windowing is used instead of X11 so make ensure
that the X11 window calls are optional.
Also if gtkosx_application is not available then don't create osxapp.
It would be useful to find out how to pass window timestamps on Quartz.
- Change build from Python 2.7 to 3.6 64-bit.
- Specify py36 for tox since using py3 will choose latest py3 e.g. 3.7!
- Use python 3.6 libtorrent.pyd build
- Use pre-installed OpenSSL 1.1 (matches libtorrent build)
- Add python version output to tox.ini for debugging.
- Updates to the sphinx conf
- Applied Mock fixes to build on Python 3.
- Group patches at bottom of conf file.
- Use just a major.minor for version.
- Specify Sphinx 2.0 version requirement.
- Move requirements.txt to docs dir.
- Add readthedocs config
- Fix docstring code block rst formatting issue.
Encoutered an error reordering files by dragging in the files tab:
TypeError: can't pickle TreePath objects
The issue was get_selected_row now returns a list of TreePath objects which
cannot be pickled. Also the set_text method only accept unicode text to
pickled bytes cannot be used.
The fix is to convert the TreePaths to strings and use json to encode
the list of strings for set_text.
When adding magnets that have been prefetched the tracker details were
lost. A result of returning only the lt.torrent_info.metadata which
does not contain full torrent details, such as trackers.
- Modified torrentmanager prefetch_metadata to return dict instead of
base64 encoded bencoded metadata dict...
- Used a namedtuple to ease identifying tuple contents.
- Updated tests to reflect changes with mock trackers added to
test_torrent.file.torrent.
- Refactor TorrentInfo to accept dict instead of bytes and add
a class method to accept metadata dict with lists of trackers.
- Rename class arg from metainfo to torrent_file, matching
lt.torrent_info.
- Rename metadata property to correct name; metainfo.
- Simplify class variable naming with _filedata and _metainfo for
torrent file contents encoded and decoded respectively.
- Update GTK Add torrent dialog to pass trackers to TorrentInfo.
When adding magnets (without prefetch) the trackers were missing.
The issue was that the magnet uri was being xml escaped twice so that
the ampersand was still escaped when passed to core and everything after
the magnet info_hash was ignored.
Also found unneeded call to core.add_torrent_files when only adding
magnets with core.add_torrent_magnet so check torrents_to_add before
calling.
Passing a non-bencoded dict to bdecode resulted in an unhandled
TypeError.
- Catch TypeError in decode_func.
- Add bdecode tests.
- Replace KeyError and IndexError with base LookupError.
Disable the warn_msg in daemon_entry since the argparse option are all
marked for translation and warnings are being output. The original
intent of this warn_msg was to identify anything in core code that was
incorrectly marked for translation.
This commit reverts namespace for the plugins and uses a module prefix
"deluge_" in it's place. The distribution package name remains the same
for now but will also be considered to use a prefix to help find the
third-party plugins e.g. Deluge-{Plugin} and the pluginmanager will
strip the prefix for displaying.
The change is a result of problems trying to package Deluge with
pyinstaller and the pkg_resources namespaces is not compatible.
Testing alternatives to using the pkgutil or PEP420 (native) namespaces
did not yield any joy either as importing eggs with namespaces does not
work. [1]
At this point importable eggs are considered deprecated but there is no
viable alternative yet. [2]
[1] https://github.com/pypa/packaging-problems/issues/212
[2] https://github.com/pypa/packaging-problems/issues/244
- Added a -m|--move-completed option for specifying a move completed
path when adding a torrent.
- Re-used existing console test and renamed for generic usage.
- Moved setup_translation to tests.__init__ so it is always setup
instead of relying on tests.common import.
Closes#2847
Co-authored-by: Calum Lind <calumlind+deluge@gmail.com>
- Move baseargparser out of deluge/ui since it is also used by the
Daemon and could cause packaging issues if UI code is not available.
- Renamed baseargparser to argparserbase to follow existing Deluge
naming.
- Renamed get_version to distinguish from deluge.common.get_version.
- Translation code is usable by more than just the UIs so also move it
to Deluge namespace and re-use i18n directory and make it a package.
- Renamed setup_translations to singular as it felt more correct.
- Renamed set_dummy_trans to be more descriptive.
Closes: #3081
Trying to display the files for magnet that has no metadata and thus no
files resulted in `'NoneType' object is not iterable` errors.
Only call file prio update method if we have a list of files.
Trying to remove a torrent had no effect and resulted in the following
error: `'TorrentList' object has no attribute 'clear_marked'`
* The clear_marked call needs to be made with torrentview instead.
* Ensure the popup dialog is closed upon deleting the torrent.
* Use EncodingResourceWrapper to replace compress function so that the
proper checks for accept-encoding header are made.
* Ensure only text is compressed and images are left uncompressed.
Should be setting header contents to string not ints and latest version
of Twisted raised an error encountering int. Also correct the header
name for setting length.
The Gdk threading code is causing issue on Windows and this method
of moving the main loop to a thread has been deprecated and advised
against so removing without adding replacement as it currently
only creates one main thread and should still be fine.
If a blocking operation occures and needs solving, see the pygobject
guide for recommened way to use threads in Gtk:
https://pygobject.readthedocs.io/en/latest/guide/threading.html
- Fix new flake8 warnings from latest version.
Note: The `addSlash` variable was orphaned with no reference in
Twisted or Deluge code so removed.
- Update pre-commit config
- New pinned versions.
- Fix prettier output.
- Use new flake8 hook config and add naming plugin.
Added 'TIMESTAMP' key to startup-id string for dbus method. Unsure if
this is the correct way to specify startup id but it seems to work.
Recreate the dbus session with each call since if there is an error
with the dbus method then it will crash and subsequent calls will fail
with a cryptic message:
dbus error the name was not provided by any .service files