Skip to content

Commit 9da376c

Browse files
committed
Merge branch 'release/v0.9.7'
2 parents d9ceeca + e005149 commit 9da376c

File tree

5 files changed

+55
-6
lines changed

5 files changed

+55
-6
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
Robert Nitsch
2+
Charlie Unfricht

docs/source/changelog.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
Changelog
22
=========
33

4+
Version 0.9.7
5+
-------------
6+
7+
*Release date: 2020/07/23*
8+
9+
* new: switch ``--source`` to include a metainfo field 'source', which is required
10+
by some private trackers (contributed by cpurules)
11+
* changed: slightly improved docs on ``--date`` switch (now mentions the special
12+
value -2 for disabling the date field altogether)
13+
* changed: slightly improve handling of negative timestamp values for
14+
``--date`` switch
15+
416
Version 0.9.6
517
-------------
618

docs/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
# General information about the project.
4343
project = u'py3createtorrent'
44-
copyright = u'2013, Robert Nitsch'
44+
copyright = u'2013-2020, Robert Nitsch'
4545

4646
# The version info for the project you're documenting, acts as replacement for
4747
# |version| and |release|, also used in various other places throughout the
@@ -50,7 +50,7 @@
5050
# The short X.Y version.
5151
version = '0.9'
5252
# The full version, including alpha/beta/rc tags.
53-
release = '0.9.6'
53+
release = '0.9.7'
5454

5555
# The language for content autogenerated by Sphinx. Refer to documentation
5656
# for a list of supported languages.

docs/source/user.rst

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
py3createtorrent
1+
py3createtorrent
22
================
33

44
*Create torrents via command line!*
@@ -151,6 +151,8 @@ Syntax::
151151
-P, --private create private torrent
152152
-c COMMENT, --comment=COMMENT
153153
include comment
154+
-s SOURCE, --source=SOURCE
155+
include torrent source
154156
-f, --force dont ask anything, just do it
155157
-v, --verbose verbose mode
156158
-q, --quiet be quiet, e.g. don't print summary
@@ -232,6 +234,17 @@ BitTorrent clients in the torrent info.
232234
By default py3createtorrent uses "created by py3createtorrent <version>" as
233235
comment (to change this behavior, consult the :ref:`configuration` section).
234236

237+
Source (``-s``)
238+
^^^^^^^^^^^^^^^
239+
240+
The source field is a non-standard metainfo field used by private trackers to
241+
reduce issues (such as misreported stats) caused by cross-seeding. For
242+
private trackers that forbid their torrent files from being uploaded elsewhere,
243+
it ensures that torrent files uploaded to the tracker from a different source
244+
are unique to the private tracker.
245+
246+
*New in 0.9.7.*
247+
235248
Force (``-f``)
236249
^^^^^^^^^^^^^^
237250

@@ -294,6 +307,9 @@ file. You can fake any creation date you like.
294307
The creation date is specified as `UNIX timestamp
295308
<https://en.wikipedia.org/wiki/Unix_time>`_.
296309

310+
You can disable storing a creation date altogether by providing a timestamp
311+
of -2.
312+
297313
Name (``-n``)
298314
^^^^^^^^^^^^^
299315

@@ -407,4 +423,4 @@ Creating torrents of single files
407423
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
408424

409425
It's almost the same as for creating directories, except, of course, you can't
410-
use the exclude-option anymore.
426+
use the exclude-option anymore.

src/py3createtorrent.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"""
33
Create torrents via command line!
44
5-
Copyright (C) 2010-2013 Robert Nitsch
5+
Copyright (C) 2010-2020 Robert Nitsch
66
Licensed according to GPL v3.
77
"""
88

@@ -55,7 +55,7 @@
5555
# do not touch anything below this line unless you know what you're doing!
5656

5757

58-
VERSION = '0.9.6'
58+
VERSION = '0.9.7'
5959

6060
# Note:
6161
# Kilobyte = kB = 1000 Bytes
@@ -486,6 +486,10 @@ def main(argv):
486486
dest="comment", default=False,
487487
help="include comment")
488488

489+
parser.add_option("-s", "--source", type="string", action="store",
490+
dest="source", default=False,
491+
help="include source")
492+
489493
parser.add_option("-f", "--force", action="store_true",
490494
dest="force", default=False,
491495
help="dont ask anything, just do it")
@@ -666,6 +670,18 @@ def main(argv):
666670
if options.private:
667671
info['private'] = 1
668672

673+
# Re-use the name regex for source parameter.
674+
if options.source:
675+
options.source = options.source.strip()
676+
677+
regexp = re.compile("^[A-Z0-9_\-\., ]+$", re.I)
678+
679+
if not regexp.match(options.source):
680+
parser.error("Invalid source: '%s'. Allowed chars: A_Z, a-z, 0-9, "
681+
"any of {.,_-} plus spaces." % options.source)
682+
683+
info['source'] = options.source
684+
669685
# Construct outer metainfo dict, which contains the torrent's whole
670686
# information.
671687
metainfo = {
@@ -686,6 +702,10 @@ def main(argv):
686702
elif options.date >= 0:
687703
# use specified timestamp directly
688704
metainfo['creation date'] = options.date
705+
elif options.date < -2:
706+
parser.error("Invalid date: Negative timestamp values are not possible "
707+
"(except for -1 to use current date automatically or -2 to"
708+
" disable storing a creation date altogether).")
689709

690710
# Add the "created by" field.
691711
metainfo['created by'] = 'py3createtorrent v%s' % VERSION

0 commit comments

Comments
 (0)