add torrent options to config
This commit is contained in:
parent
c780572e69
commit
a0e5de8f29
2 changed files with 6 additions and 3 deletions
|
@ -276,3 +276,6 @@ class DefaultConfig(object):
|
||||||
|
|
||||||
# Torrent management flags
|
# Torrent management flags
|
||||||
TORRENT_PIECE_SIZE = 512 * 1024
|
TORRENT_PIECE_SIZE = 512 * 1024
|
||||||
|
TORRENT_ANNOUNCE_URL = 'https://localhost:6881/announce'
|
||||||
|
TORRENT_NAMING_SALT = '3ae93fef-c30a-427e-9ba0-eea0fd710419'
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ import resumablehashlib
|
||||||
from app import app
|
from app import app
|
||||||
|
|
||||||
|
|
||||||
TRACKER_ANNOUNCE_URL = app.config.get('BT_TRACKER_ANNOUNCE_URL')
|
ANNOUNCE_URL = app.config.get('TORRENT_ANNOUNCE_URL')
|
||||||
NAMING_SALT = app.config.get('BT_NAMING_SALT')
|
NAMING_SALT = app.config.get('TORRENT_NAMING_SALT')
|
||||||
|
|
||||||
def public_torrent_filename(blob_uuid):
|
def public_torrent_filename(blob_uuid):
|
||||||
return hashlib.sha256(blob_uuid).hexdigest()
|
return hashlib.sha256(blob_uuid).hexdigest()
|
||||||
|
@ -19,7 +19,7 @@ def per_user_torrent_filename(user_uuid, blob_uuid):
|
||||||
|
|
||||||
def make_torrent(name, webseed, length, piece_length, pieces):
|
def make_torrent(name, webseed, length, piece_length, pieces):
|
||||||
return bencode.bencode({
|
return bencode.bencode({
|
||||||
'announce': TRACKER_ANNOUNCE_URL,
|
'announce': ANNOUNCE_URL,
|
||||||
'url-list': webseed,
|
'url-list': webseed,
|
||||||
'encoding': 'UTF-8',
|
'encoding': 'UTF-8',
|
||||||
'created by': 'Quay Container Registry',
|
'created by': 'Quay Container Registry',
|
||||||
|
|
Reference in a new issue