summaryrefslogtreecommitdiff
path: root/lib/thandy/SignerCLI.py
diff options
context:
space:
mode:
authorSebastian Hahn <sebastian@torproject.org>2009-08-11 13:43:06 +0200
committerSebastian Hahn <sebastian@torproject.org>2009-08-25 20:10:25 +0200
commitaa0d32f4b675e155e6e004604bf8b6ee4e607873 (patch)
tree110c9722f93380497447c54bf07f4227f11b7206 /lib/thandy/SignerCLI.py
parent6ebc7d6103098e695c33f55f84e6f64f5d795e84 (diff)
Add ability to create .torrent metadata when making a package
Also update the spec with the information where the .torrent metadata file will be stored.
Diffstat (limited to 'lib/thandy/SignerCLI.py')
-rw-r--r--lib/thandy/SignerCLI.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/thandy/SignerCLI.py b/lib/thandy/SignerCLI.py
index d0feef6..06536aa 100644
--- a/lib/thandy/SignerCLI.py
+++ b/lib/thandy/SignerCLI.py
@@ -7,6 +7,7 @@ import sys
import thandy.keys
import thandy.formats
import thandy.util
+import thandy.bt_compat
json = thandy.util.importJSON()
@@ -78,6 +79,19 @@ def makepackage(args):
f = open(location, 'w')
json.dump(signable, f, indent=1, sort_keys=True)
f.close()
+ btcomp = thandy.bt_compat.BtCompat()
+ # If we have bittorrent support, we always create the appropriate metadata.
+ thandy.bt_compat.BtCompat.setUseBt(True)
+ if not thandy.bt_compat.BtCompat.shouldUseBt():
+ print "Not generating BitTorrent metadata files"
+ return
+ print "Generating BitTorrent metadata file"
+ metaFile = btcomp.makeMetaFile(dataFile)
+ mfLocation = os.path.split(btcomp.getBtMetadataLocation(location, dataFile))[-1]
+ print "Writing BitTorrent Metadata file to %s"%mfLocation
+ f = open(mfLocation, 'w')
+ f.write(metaFile)
+ f.close()
def makebundle(args):
options, args = getopt.getopt(args, "", "keyid=")