Allow override location with `--loc`

Using `latitude longitude` given your favorite maps site or application. This
is useful when SpeedTest detected location does not really reflect reality.
This commit is contained in:
Adam Strzelecki 2013-09-30 13:44:46 +02:00
parent 35c7e6d6b5
commit 033aba39da
1 changed files with 6 additions and 0 deletions

View File

@ -382,6 +382,8 @@ def speedtest():
help='Display a list of speedtest.net servers ' help='Display a list of speedtest.net servers '
'sorted by distance') 'sorted by distance')
parser.add_argument('--server', help='Specify a server ID to test against') parser.add_argument('--server', help='Specify a server ID to test against')
parser.add_argument('--loc', type=float, nargs=2, metavar=('lat', 'lon'),
help='Specify own location')
parser.add_argument('--mini', help='URL of the Speedtest Mini server') parser.add_argument('--mini', help='URL of the Speedtest Mini server')
parser.add_argument('--version', action='store_true', parser.add_argument('--version', action='store_true',
help='Show the version number and exit') help='Show the version number and exit')
@ -400,6 +402,10 @@ def speedtest():
print_('Retrieving speedtest.net configuration...') print_('Retrieving speedtest.net configuration...')
config = getConfig() config = getConfig()
if args.loc:
config['client']['lat'] = args.loc[0]
config['client']['lon'] = args.loc[1]
if not args.simple: if not args.simple:
print_('Retrieving speedtest.net server list...') print_('Retrieving speedtest.net server list...')
if args.list or args.server: if args.list or args.server: