From 08b225866a502438d58ea820dc8ea4581391a94f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20=27lich=27=20Halber?= Date: Sun, 26 Jun 2016 08:51:33 +0200 Subject: [PATCH] Buxfix: Fixed logging with -l option --- limf/parse_arguments.py | 10 ++++++++-- limf/uploader.py | 2 +- setup.py | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/limf/parse_arguments.py b/limf/parse_arguments.py index 7dfd687..22870f7 100644 --- a/limf/parse_arguments.py +++ b/limf/parse_arguments.py @@ -59,7 +59,10 @@ def parse_arguments(args, clone_list): else: returned_string = upload_files(open(i, 'rb'), \ clone_list[host_number], args.only_link, i) - print(returned_string) + if args.only_link: + print(returned_string[0]) + else: + print(returned_string) except IndexError: #print('Selected server (' + clone_list[host_number][0] + ') is offline.') #print('Trying other host.') @@ -71,7 +74,10 @@ def parse_arguments(args, clone_list): if args.log: with open(os.path.expanduser(args.logfile), "a+") as logfile: - logfile.write(returned_string) + if args.only_link: + logfile.write(returned_string[1]) + else: + logfile.write(returned_string) logfile.write("\n") break else: diff --git a/limf/uploader.py b/limf/uploader.py index 96c6eac..df521a6 100644 --- a/limf/uploader.py +++ b/limf/uploader.py @@ -19,7 +19,7 @@ def upload_files(selected_file, selected_host, only_link, file_name): file_name_1 = re.findall(r'"url": *"((h.+\/){0,1}(.+))"[,\}]', \ answer.text.replace("\\", ""))[0][2] if only_link: - return selected_host[1]+file_name_1 + return [selected_host[1]+file_name_1, "{}: {}{}".format(file_name, selected_host[1], file_name_1)] else: return "{}: {}{}".format(file_name, selected_host[1], file_name_1) except requests.exceptions.ConnectionError: diff --git a/setup.py b/setup.py index 262f2ba..54f49d3 100755 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ from setuptools import setup setup( name='limf', - version='0.6.0', + version='0.6.1', url='http://github.com/lich/limf', license='MIT', author='Mikolaj \'lich\' Halber',