From 80634db44c5e7c4cd4c90d57b33aeb5eff022c2c Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Thu, 20 Aug 2009 22:27:40 +0000 Subject: [PATCH] Fix num_pieces calculation --- deluge/maketorrent.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deluge/maketorrent.py b/deluge/maketorrent.py index 304c0aeec..585dcaa4e 100644 --- a/deluge/maketorrent.py +++ b/deluge/maketorrent.py @@ -133,6 +133,9 @@ class TorrentMetadata(object): # Calculate the number of pieces we will require for the data num_pieces = datasize / piece_size + if datasize % piece_size: + num_pieces += 1 + torrent["info"]["piece length"] = piece_size # Create the info