Navigation Menu

Skip to content
This repository has been archived by the owner on Jan 18, 2023. It is now read-only.

Commit

Permalink
BF: Update btreannounce to correctly set announce-list
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Aug 6, 2016
1 parent 969c3a3 commit d4e42fb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
17 changes: 8 additions & 9 deletions BitTornado/Application/reannounce.py
Expand Up @@ -15,14 +15,13 @@ def reannounce(fname, announce, announce_list=None, verbose=False):

metainfo['announce'] = announce

if 'announce-list' in metainfo:
if verbose:
print('old announce-list for {}: {}'.format(
fname, '|'.join(','.join(tier)
for tier in metainfo['announce-list'])))
if announce_list is not None:
metainfo['announce-list'] = announce_list
else:
metainfo.pop('announce-list', None)
if 'announce-list' in metainfo and verbose:
print('old announce-list for {}: {}'.format(
fname, '|'.join(','.join(tier)
for tier in metainfo['announce-list'])))
if announce_list is not None:
metainfo['announce-list'] = announce_list
else:
metainfo.pop('announce-list', None)

metainfo.write(fname)
6 changes: 3 additions & 3 deletions btreannounce.py
Expand Up @@ -25,8 +25,8 @@ def main(argv):
for l in announcelist_details.split('\n')[:-2])))

try:
opts, args = getopt.getopt(argv[1:], "hav",
("help", "announce_list", "verbose"))
opts, args = getopt.getopt(argv[1:], "ha:v",
("help", "announce_list=", "verbose"))
except getopt.error as msg:
print(msg)
return 1
Expand All @@ -44,7 +44,7 @@ def main(argv):
print(helpmsg)
return 0
elif opt in ('-a', '--announce_list'):
announce_list = [tier.split(',') for tier in arg.split('|')]
announce_list = arg
elif opt in ('-v', '--verbose'):
verbose = True

Expand Down

0 comments on commit d4e42fb

Please sign in to comment.