hide cursor

This commit is contained in:
j 2013-05-14 12:11:55 +02:00
parent 0b22ea5604
commit c88ab58f28

View file

@ -104,6 +104,13 @@ def ignore_file(client, path):
return True return True
return False 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): class Client(object):
_configfile = None _configfile = None
@ -636,7 +643,7 @@ class Client(object):
for oshash in data: for oshash in data:
data = {} data = {}
info = self.info(oshash) info = self.info(oshash)
if not 'error' in info: if info and not 'error' in info:
for path in self.path(oshash): for path in self.path(oshash):
if os.path.exists(path): if os.path.exists(path):
if not self.api.uploadVideo(path, if not self.api.uploadVideo(path,
@ -826,6 +833,7 @@ class API(ox.API):
data = self._json_request(url, form) data = self._json_request(url, form)
print filename print filename
hide_cursor()
result_url = data.get('url') result_url = data.get('url')
if 'uploadUrl' in data: if 'uploadUrl' in data:
uploadUrl = data['uploadUrl'] uploadUrl = data['uploadUrl']
@ -897,6 +905,7 @@ class API(ox.API):
else: else:
print ' ' * 80 print ' ' * 80
print '' print ''
show_cursor()
return data and 'result' in data and data.get('result') == 1 return data and 'result' in data and data.get('result') == 1
else: else:
if DEBUG: if DEBUG: