Browse Source

py-i2phosts-injector: add argument for auto-approving hosts

pull/1/head
Hidden Z 14 years ago
parent
commit
2ab6566db2
  1. 10
      py-i2phosts-injector

10
py-i2phosts-injector

@ -22,12 +22,20 @@ parser.add_argument('-f', '--file', default=os.environ['HOME'] + '/.i2p/hosts.tx
help='hosts.txt for parsing') help='hosts.txt for parsing')
parser.add_argument('-d', '--description', default='Auto-added from external hosts.txt', parser.add_argument('-d', '--description', default='Auto-added from external hosts.txt',
help='provide custom description message') help='provide custom description message')
parser.add_argument('-a', '--approve', action='store_true',
help='add hosts as approved')
parser.add_argument('-s', '--supress', action='store_true', parser.add_argument('-s', '--supress', action='store_true',
help='supress warnings about already existed hostnames'), help='supress warnings about already existed hostnames'),
parser.add_argument('-q', '--quiet', action='store_true', parser.add_argument('-q', '--quiet', action='store_true',
help='be completely quiet, print only errors') help='be completely quiet, print only errors')
args = parser.parse_args() args = parser.parse_args()
# determine approve hosts or not
if args.approve:
approved = True
else:
approved = False
if args.quiet: if args.quiet:
args.supress = True args.supress = True
@ -57,7 +65,7 @@ for line in f:
print 'Adding %s' % hostname print 'Adding %s' % hostname
host = i2phost(name=hostname, b64hash=base64, host = i2phost(name=hostname, b64hash=base64,
description=args.description, description=args.description,
activated=False, external=True) activated=False, external=True, approved=approved)
host.save() host.save()
else: else:
if not args.supress: if not args.supress:

Loading…
Cancel
Save