diff --git a/AUTHORS b/AUTHORS index 479ae32..cdf0b84 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1 +1,2 @@ Robert Nitsch +Charlie Unfricht diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index 5750d3d..aca0fc3 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -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 ------------- diff --git a/docs/source/conf.py b/docs/source/conf.py index d56a54a..1b84be9 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -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 @@ -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. diff --git a/docs/source/user.rst b/docs/source/user.rst index c340372..58b7d00 100644 --- a/docs/source/user.rst +++ b/docs/source/user.rst @@ -1,4 +1,4 @@ -py3createtorrent +py3createtorrent ================ *Create torrents via command line!* @@ -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 @@ -232,6 +234,17 @@ BitTorrent clients in the torrent info. By default py3createtorrent uses "created by py3createtorrent " 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``) ^^^^^^^^^^^^^^ @@ -294,6 +307,9 @@ file. You can fake any creation date you like. The creation date is specified as `UNIX timestamp `_. +You can disable storing a creation date altogether by providing a timestamp +of -2. + Name (``-n``) ^^^^^^^^^^^^^ @@ -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. \ No newline at end of file +use the exclude-option anymore. diff --git a/src/py3createtorrent.py b/src/py3createtorrent.py index aab0bef..ce2c09c 100644 --- a/src/py3createtorrent.py +++ b/src/py3createtorrent.py @@ -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. """ @@ -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 @@ -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") @@ -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 = { @@ -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