Skip to content

Commit

Permalink
Version 1.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kz26 committed Mar 20, 2017
1 parent c959e89 commit 5e04e6d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
5 changes: 5 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

1.9.0
-----
* Increase MAX_PIECE_SIZE to 64 MiB
* Minor docstring improvements

1.8.0
-----
* Human-friendly piece size specification in CLI
Expand Down
2 changes: 1 addition & 1 deletion docs/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ available in your system path.
--md5 Add per-file MD5 hashes
--verbose, -v verbose mode

dottorrent/1.8.0 (https://github.com/kz26/dottorrent)
dottorrent/1.9.0 (https://github.com/kz26/dottorrent)


When creating a torrent, all dotfiles (filenames beginning with a '.') are excluded. On Windows systems running Python 3.5+, all hidden files are excluded as well.
Expand Down
16 changes: 9 additions & 7 deletions dottorrent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@


MIN_PIECE_SIZE = 2 ** 14
MAX_PIECE_SIZE = 2 ** 22
MAX_PIECE_SIZE = 2 ** 26


if sys.version_info >= (3, 5) and os.name == 'nt':
Expand Down Expand Up @@ -139,22 +139,24 @@ def piece_size(self, value):
if value > 0 and (value & (value-1) == 0):
if value < MIN_PIECE_SIZE:
raise exceptions.InvalidPieceSizeException(
"Piece size should be at least 16 KB")
"Piece size should be at least 16 KiB")
if value > MAX_PIECE_SIZE:
print_err("Warning: piece size is greater than 4 MB")
print_err("Warning: piece size is greater than 64 MiB")
self._piece_size = value
else:
raise exceptions.InvalidPieceSizeException(
"Piece size must be a power of 2")
"Piece size must be a power of 2 bytes")
else:
self._piece_size = None

def get_info(self):
"""
Scans the input path and automatically determines the optimal
piece size (up to 4 MB), along with other basic info such
as the total size and the total number of files. If ``piece_size``
has already been set, the custom value will be used instead.
piece size based on ~1500 pieces (up to MAX_PIECE_SIZE) along
with other basic info, including total size (in bytes), the
total number of files, piece size (in bytes), and resulting
number of pieces. If ``piece_size`` has already been set, the
custom value will be used instead.
:return: ``(total_size, total_files, piece_size, num_pieces)``
"""
Expand Down
2 changes: 1 addition & 1 deletion dottorrent/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.8.0'
__version__ = '1.9.0'

0 comments on commit 5e04e6d

Please sign in to comment.