diff --git a/docs/changelog.rst b/docs/changelog.rst index 269106f..30de31d 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -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 diff --git a/docs/cli.rst b/docs/cli.rst index 0903df1..7908d93 100644 --- a/docs/cli.rst +++ b/docs/cli.rst @@ -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. diff --git a/dottorrent/__init__.py b/dottorrent/__init__.py index 20ef68b..5a6475d 100644 --- a/dottorrent/__init__.py +++ b/dottorrent/__init__.py @@ -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': @@ -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)`` """ diff --git a/dottorrent/version.py b/dottorrent/version.py index b280975..e5102d3 100644 --- a/dottorrent/version.py +++ b/dottorrent/version.py @@ -1 +1 @@ -__version__ = '1.8.0' +__version__ = '1.9.0'