Skip to content

Commit

Permalink
Version 1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kz26 committed Aug 27, 2016
1 parent e030c48 commit b072020
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
4 changes: 4 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

1.3.0
-----
* Unicode support

1.2.2
-----
* Fix auto piece sizing in generate() with small files
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Features
--------

* Fast (capable of several hundred MB/s)
* Full Unicode support
* Automatic and manual piece size selection
* HTTP/web seeds support `(BEP 19) <http://www.bittorrent.org/beps/bep_0019.html>`_
* Private flag support `(BEP 27) <http://www.bittorrent.org/beps/bep_0027.html>`_
Expand Down
20 changes: 11 additions & 9 deletions dottorrent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,35 +232,37 @@ def generate(self, callback=None):
# Create the torrent data structure
data = OrderedDict()
if len(self.trackers) == 1:
data['announce'] = self.trackers[0]
data['announce'] = self.trackers[0].encode()
elif len(self.trackers) > 1:
data['announce-list'] = [[x] for x in self.trackers]
data['announce-list'] = [[x.encode()] for x in self.trackers]
if self.comment:
data['comment'] = self.comment
data['comment'] = self.comment.encode()
if self.created_by:
data['created by'] = self.created_by
data['created by'] = self.created_by.encode()
else:
data['created by'] = DEFAULT_CREATOR
data['created by'] = DEFAULT_CREATOR.encode()
if self.creation_date:
data['creation date'] = int(self.creation_date.timestamp())
if self.web_seeds:
data['url-list'] = self.web_seeds
data['url-list'] = [x.encode() for x in self.web_seeds]
data['info'] = OrderedDict()
if single_file:
data['info']['length'] = files[0][1]
if self.include_md5:
data['info']['md5sum'] = files[0][2]['md5sum']
data['info']['name'] = files[0][0].split(os.sep)[-1]
data['info']['name'] = files[0][0].split(os.sep)[-1].encode()
else:
data['info']['files'] = []
for x in files:
fx = OrderedDict()
fx['length'] = x[1]
if self.include_md5:
fx['md5sum'] = x[2]['md5sum']
fx['path'] = x[0].replace(self.path, '')[1:].split(os.sep)
fx['path'] = [y.encode()
for y in x[0].replace(self.path, '')[1:]
.split(os.sep)]
data['info']['files'].append(fx)
data['info']['name'] = self.path.split(os.sep)[-1]
data['info']['name'] = self.path.split(os.sep)[-1].encode()
data['info']['pieces'] = bytes(self._pieces)
data['info']['piece length'] = self.piece_size
data['info']['private'] = int(self.private)
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.2.2'
__version__ = '1.3.0'

0 comments on commit b072020

Please sign in to comment.