Skip to content

Commit

Permalink
Merge branch 'release/v0.9.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
rsnitsch committed Jul 23, 2020
2 parents d9ceeca + e005149 commit 9da376c
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 6 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Robert Nitsch
Charlie Unfricht
12 changes: 12 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
Changelog
=========

Version 0.9.7
-------------

*Release date: 2020/07/23*

* new: switch ``--source`` to include a metainfo field 'source', which is required
by some private trackers (contributed by cpurules)
* changed: slightly improved docs on ``--date`` switch (now mentions the special
value -2 for disabling the date field altogether)
* changed: slightly improve handling of negative timestamp values for
``--date`` switch

Version 0.9.6
-------------

Expand Down
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

# General information about the project.
project = u'py3createtorrent'
copyright = u'2013, Robert Nitsch'
copyright = u'2013-2020, Robert Nitsch'

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

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
20 changes: 18 additions & 2 deletions docs/source/user.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
py3createtorrent
py3createtorrent
================

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

Source (``-s``)
^^^^^^^^^^^^^^^

The source field is a non-standard metainfo field used by private trackers to
reduce issues (such as misreported stats) caused by cross-seeding. For
private trackers that forbid their torrent files from being uploaded elsewhere,
it ensures that torrent files uploaded to the tracker from a different source
are unique to the private tracker.

*New in 0.9.7.*

Force (``-f``)
^^^^^^^^^^^^^^

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

You can disable storing a creation date altogether by providing a timestamp
of -2.

Name (``-n``)
^^^^^^^^^^^^^

Expand Down Expand Up @@ -407,4 +423,4 @@ Creating torrents of single files
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

It's almost the same as for creating directories, except, of course, you can't
use the exclude-option anymore.
use the exclude-option anymore.
24 changes: 22 additions & 2 deletions src/py3createtorrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""
Create torrents via command line!
Copyright (C) 2010-2013 Robert Nitsch
Copyright (C) 2010-2020 Robert Nitsch
Licensed according to GPL v3.
"""

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


VERSION = '0.9.6'
VERSION = '0.9.7'

# Note:
# Kilobyte = kB = 1000 Bytes
Expand Down Expand Up @@ -486,6 +486,10 @@ def main(argv):
dest="comment", default=False,
help="include comment")

parser.add_option("-s", "--source", type="string", action="store",
dest="source", default=False,
help="include source")

parser.add_option("-f", "--force", action="store_true",
dest="force", default=False,
help="dont ask anything, just do it")
Expand Down Expand Up @@ -666,6 +670,18 @@ def main(argv):
if options.private:
info['private'] = 1

# Re-use the name regex for source parameter.
if options.source:
options.source = options.source.strip()

regexp = re.compile("^[A-Z0-9_\-\., ]+$", re.I)

if not regexp.match(options.source):
parser.error("Invalid source: '%s'. Allowed chars: A_Z, a-z, 0-9, "
"any of {.,_-} plus spaces." % options.source)

info['source'] = options.source

# Construct outer metainfo dict, which contains the torrent's whole
# information.
metainfo = {
Expand All @@ -686,6 +702,10 @@ def main(argv):
elif options.date >= 0:
# use specified timestamp directly
metainfo['creation date'] = options.date
elif options.date < -2:
parser.error("Invalid date: Negative timestamp values are not possible "
"(except for -1 to use current date automatically or -2 to"
" disable storing a creation date altogether).")

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

0 comments on commit 9da376c

Please sign in to comment.