From: Mike Frysinger Date: Thu, 20 Oct 2016 02:21:04 +0000 (-0700) Subject: vlc-rc: polish behavior a bit X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=8250a409a027b89d315026b8695e3268bfd6f53a;p=home.git vlc-rc: polish behavior a bit --- diff --git a/.bin/vlc-rc b/.bin/vlc-rc index ef6bb1e..f2d0d61 100755 --- a/.bin/vlc-rc +++ b/.bin/vlc-rc @@ -56,7 +56,8 @@ def connection(host, port, quiet=False): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: if not quiet: - print('Connecting to %s:%s ...' %(host, port), end='') + print('Connecting to %s:%s ... ' %(host, port), end='') + sys.stdout.flush() try: s.connect((host, port)) except socket.error as e: @@ -101,7 +102,7 @@ class VlcConsole(code.InteractiveConsole): try: result += self.server.recv(1024 * 1024) except socket.timeout: - if result: + if '\n' in result: break if passthru: self.write(result) @@ -194,7 +195,11 @@ class VlcConsole(code.InteractiveConsole): offset *= -1 position = current_position + offset else: - position = opts.position + try: + position = int(opts.position) + except ValueError: + logging.error('seek takes an int, not "%s"', opts.position) + return self._run_command('seek %s' % (position,), passthru=True)