def main(): #docopt parse the args arguments = docopt(__doc__, version='0.1.1-dev') #TODO get the version from __init__.py host = arguments.get('--host', 'mafreebox.free.fr') port = arguments.get('--port', '80') password = arguments.get('--password', None) if not password: password = getpass('Freebox password: '******'client', False) download_mode = arguments.get('download', False) #login fbx_client = freeboxClient(host, port, None, password)#params are host, port, username, password login_sucess = fbx_client.login() if client_mode: print "login success : %s" % login_sucess #if download, call the downloader if download_mode: path_or_url = arguments.get('PATH_OR_URL', None) if not path_or_url: print u"Give a file torrent path or url" #no we will find if path_or_url is a path or an url torrent_file = None torrent_url = None if os.path.isfile(path_or_url): torrent_file = path_or_url else: torrent_url = path_or_url downloader = Downloader(fbx_client) downloader.add_file_to_download(torrent_file, torrent_url)