From c88ab58f2818d469eb98f6c276ab95bd673967ad Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Tue, 14 May 2013 12:11:55 +0200 Subject: [PATCH] hide cursor --- pandora_client/__init__.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pandora_client/__init__.py b/pandora_client/__init__.py index 814913e..282dbfc 100644 --- a/pandora_client/__init__.py +++ b/pandora_client/__init__.py @@ -104,6 +104,13 @@ def ignore_file(client, path): return True return False +def hide_cursor(): + sys.stdout.write("\033[?25l") + sys.stdout.flush() + +def show_cursor(): + sys.stdout.write("\033[?25h") + sys.stdout.flush() class Client(object): _configfile = None @@ -636,7 +643,7 @@ class Client(object): for oshash in data: data = {} info = self.info(oshash) - if not 'error' in info: + if info and not 'error' in info: for path in self.path(oshash): if os.path.exists(path): if not self.api.uploadVideo(path, @@ -826,6 +833,7 @@ class API(ox.API): data = self._json_request(url, form) print filename + hide_cursor() result_url = data.get('url') if 'uploadUrl' in data: uploadUrl = data['uploadUrl'] @@ -897,6 +905,7 @@ class API(ox.API): else: print ' ' * 80 print '' + show_cursor() return data and 'result' in data and data.get('result') == 1 else: if DEBUG: