The synchonous add torrent method was replaced with async but this
break backward compatibility with 3rd party plugins and clients.
Added a new add_torrent_file_async method for adding single torrent.
Torrent manager has a new add_async method and split up code to prevent
duplication.
Update any use of add_torrent_file to add_torrent_file_async. Future
refactoring could use add_torrent_files instead.
The parsing of the content-disposition in httpdownloader was not able to
handle missing parameters e.g. "Content-Disposition: attachment" and would
result in an IndexError. Added a test for this use-case.
Fixed the issue using the cgi.parse_header to extract the parameters.
* Add host Edit button to WebUI.
* Updated and fixed associated tests.
* Refactored related gtkui code to better understand code flow.
* Removed dead code in gtkui.
* Continuation of updating code to Python 3 with Python 2 fallback.
* Using io.open allows files to be encoded and decoded automatically on write and read. This
maintains the python boundaries of unicode in code and bytes for output/files so less
explicit encoding or decoding.
* io.StringIO is the replacement for StringIO and will only accept unicode strings.
* io.BytesIO is used where bytes output is required by the enclosing method.
* Update bencode for full compatibility.
- Preparation work for using six or future module for Py2/3 compat. The
code will be written in Python 3 with Python 2 fallbacks.
- Added some Py3 imports with Py2 fallbacks to make it easier to remove
Py2 code in future.
- Replace xrange with range (sort out import as top of files in future).
- Workaround Py2to3 basestring issue with inline if in instances. This means
every usage of basestring is more considered.
- Replace iteritems and itervalues for items and values. There might be a
performance penalty on Py2 so might need to revisit this change.
- Python 3 renames `unicode` type to `str` and introduces `bytes` type.
- Python 2.7 has `bytes` but is only an alias for `str` so restricted
to comparisons but helps keep compatibility.
- To test for unicode string on Py2 and Py3 uses the "''.__class__" type.
- Remove usage of utf8encode and just encode, problems with bytes being passed
in code will be picked up faster.
- Where possible refactor out isinstance for try..except duck-typing.
- Switch to using Python 3 naming convention where str now refers to unicode
and bytes are encoded strings.
- Cleanup docs and code
- Also rename convert_to_utf8 to utf8_encode_structure to clarify functionality.
* Twisted methods require byte-string arguments.
* The headers str conversion in httpdownloader _download_file was
incorrent and left the dict key still as unicode so replaced with
a dict comprehension (py2.7 requirement).
* Added `from __future__ import unicode_literals` to every file so
now all strings in code are forced to be unicode strings unless
marked as byte string `b'str'` or encoded to byte string `'str'.encode('utf-8')`.
This is a large change but we have been working towards the goal of unicode
strings passed in the code so decoding external input and encoding
output as byte strings (where applicable).
Note that in Python 2 the `str` type still refers to byte strings.
* Replaced the use of `str` for `basestring` in isinstance comparison as
this was the original intention but breaks code when encoutering unicode strings.
* Marked byte strings in gtkui as the conversion to utf8 is not always handled, mostly
related to gobject signal names.
- With libtorrent 1.1 dht is enabled from startup and the returned status
contains DHT node values (i.e. non-zero). Should be sufficient to only test for start
and end of the status string to be correct.
- The name needed to be more descriptive of it's function.
- Moved into ui directory because of upcoming changes being made to setup.py
meant it would be easier to include all the 'common' ui files if there
are no sub-dirs such as 'util'.
* A rather disruptive change but for a few reasons such as easier to read,
easier type, keep consistent and javascript code uses single quotes.
* There are a few exceptions for the automated process:
* Any double quotes in comments
* Triple double quotes for docstrings
* Strings containing single quotes are left e.g. "they're"
* To deal with merge conflicts from feature branches it is best to follow
these steps for each commit:
* Create a patch: `git format-patch -1 <sha1>`
* Edit the patch and replace double quotes with single except those in
comments or strings containing an unescaped apostrophe.
* Check the patch `git apply --check <patchfile>` and fix any remaining
issues if it outputs an error.
* Apply the patch `git am < <patchfile>`
This commit is a rewrite of larger parts of the console code. The
motivation behind the rewrite is to cleanup the code and reduce code
duplication to make it easier to understand and modify, and allow any
form of code reuse. Most changes are to the interactive console, but
also to how the different modes (BaseMode subclasses) are used and set
up.
* Address [#2097] - Improve match_torrent search match:
Instead of matching e.g. torrent name with name.startswith(pattern)
now check for asterix at beginning and end of pattern and search
with startswith, endswith or __contains__ according to the pattern.
Various smaller fixes:
* Add errback handler to connection failed
* Fix cmd line console mixing str and unicode input
* Fix handling delete backwards with ALT+Backspace
* Fix handling resizing of message popups
* Fix docs generation warnings
* Lets not stop the reactor on exception in basemode..
* Markup for translation arg help strings
* Main functionality improvements:
- Add support for indentation in formatting code in popup messages (like help)
- Add filter sidebar
- Add ComboBox and UI language selection
- Add columnsview to allow rearranging the torrentlist columns
and changing column widths.
- Removed Columns pane in preferences as columnsview.py is sufficient
- Remove torrent info panel (short cut 'i') as the torrent detail view
is sufficient
* Cleanups and code restructuring
- Made BaseModes subclass of Component
- Rewrite of most of basic window/panel to allow easier code reuse
- Implemented better handling of multple popups by stacking popups. This
makes it easier to return to previous popup when opening multiple popups.
* Refactured console code:
- modes/ for the different modes
- Renamed Legacy mode to CmdLine
- Renamed alltorrent.py to torrentlist.py and split the code into
- torrentlist/columnsview.py
- torrentlist/torrentsview.py
- torrentlist/search_mode.py (minor mode)
- torrentlist/queue_mode.py (minor mode)
- cmdline/ for cmd line commands
- utils/ for utility files
- widgets/ for reusable GUI widgets
- fields.py: Base widgets like TextInput, SelectInput, ComboInput
- popup.py: Popup windows
- inputpane.py: The BaseInputPane used to manage multiple base widgets in a panel
- window.py: The BaseWindow used by all panels needing a curses screen
- sidebar.py: The Sidebar panel
- statusbars.py: The statusbars
- Moved option parsing code from main.py to parser.py
* Use print function
* Fix except as statements
* Remove old twisted 8 code
* Remove empty docstring
* Refactor try statement to only contain the relevant import and
disable pylint import msgs.
* Use flake8 noqa and pylint comment and drop pyflakes workarounds.
* Replace the uses of long with int.
* Replace im_func with __func__ as it has been provided for Python 3 forward-compatibility.
* Fix next/__next__ for Python 3 compatibility.
* Remove the long number literal
* Ensure freespace() returns int
To make the code more Python 3 compatible, I've made a few changes to how we handle keys() or iterkeys() calls on dictionaries. All functionality should remain the same.
* Remove the use of .keys() or .iterkeys() when iterating through a dictionary.
* Remove the use of .keys() when checking if key exists in dictionary.
* Replace dict.keys() with list(dict) to obtain a list of dictionary keys. In Python 3 dict.keys() returns a dict_keys object, not a list.