Skip to content
This repository has been archived by the owner on May 29, 2022. It is now read-only.

Commit

Permalink
fixed bug when not auto configuring client
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnDoee committed Jun 24, 2015
1 parent b15d035 commit e682b87
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions autotorrent/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ def commandline_handler():
src = os.path.join(os.path.dirname(__file__), 'autotorrent.conf.dist')
shutil.copy(src, args.create_config_file)
print('Created configuration file %r' % args.create_config_file)

client_config = {
'client': 'rtorrent',
'url': 'http://user:pass@127.0.0.1/RPC2',
'label': 'autotorrent',
}

if query_yes_no('Do you want to try and auto-configure torrent client?'):
working_clients = []
Expand All @@ -78,12 +84,6 @@ def commandline_handler():
except:
continue

client_config = {
'client': 'rtorrent',
'url': 'http://user:pass@127.0.0.1/RPC2',
'label': 'autotorrent',
}

if working_clients:
print('Found %i clients - please choose a client to use' % len(working_clients))
for i, client in enumerate(working_clients, 1):
Expand Down Expand Up @@ -113,13 +113,13 @@ def commandline_handler():
else:
print('Unable to auto-detect any clients, you will have to configure it manually.')

config = configparser.ConfigParser()
config.read(args.create_config_file)
for k, v in client_config.items():
config.set('client', k, v)
config = configparser.ConfigParser()
config.read(args.create_config_file)
for k, v in client_config.items():
config.set('client', k, v)

with open(args.create_config_file, 'w') as configfile:
config.write(configfile)
with open(args.create_config_file, 'w') as configfile:
config.write(configfile)

quit()

Expand Down Expand Up @@ -236,4 +236,4 @@ def commandline_handler():
print('')

if __name__ == '__main__':
commandline_handler()
commandline_handler()

0 comments on commit e682b87

Please sign in to comment.